fix: stuff
This commit is contained in:
parent
e2fd27cbba
commit
68d346e69d
7 changed files with 32 additions and 5 deletions
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
|
@ -19,8 +19,13 @@ jobs:
|
||||||
id: cache-restore
|
id: cache-restore
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: |
|
||||||
key: ${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }}
|
node_modules
|
||||||
|
${{ github.workspace }}/.next/cache
|
||||||
|
key: ${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }}-
|
||||||
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: steps.cache-restore.outputs.cache-hit != 'true'
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
||||||
|
|
|
@ -32,6 +32,8 @@ A ShareX/file upload server that is easy to use, packed with features, and with
|
||||||
- Fully customizable Discord webhook notifications
|
- Fully customizable Discord webhook notifications
|
||||||
- OAuth2 registration (Discord and GitHub)
|
- OAuth2 registration (Discord and GitHub)
|
||||||
- User invites
|
- User invites
|
||||||
|
- File Chunking (for large files)
|
||||||
|
- File deletion once it reaches a certain amount of views
|
||||||
- Easy setup instructions on [docs](https://zipl.vercel.app/) (One command install `docker-compose up -d`)
|
- Easy setup instructions on [docs](https://zipl.vercel.app/) (One command install `docker-compose up -d`)
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
|
@ -5,6 +5,7 @@ import Image from 'next/image';
|
||||||
export default function DiscordIcon({ ...props }) {
|
export default function DiscordIcon({ ...props }) {
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
|
alt='discord'
|
||||||
src='https://assets-global.website-files.com/6257adef93867e50d84d30e2/62595384f934b806f37f4956_145dc557845548a36a82337912ca3ac5.svg'
|
src='https://assets-global.website-files.com/6257adef93867e50d84d30e2/62595384f934b806f37f4956_145dc557845548a36a82337912ca3ac5.svg'
|
||||||
width={24}
|
width={24}
|
||||||
height={24}
|
height={24}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import Image from 'next/image';
|
||||||
export default function FlameshotIcon({ ...props }) {
|
export default function FlameshotIcon({ ...props }) {
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
|
alt='flameshot'
|
||||||
src='https://raw.githubusercontent.com/flameshot-org/flameshot/master/data/img/app/flameshot.svg'
|
src='https://raw.githubusercontent.com/flameshot-org/flameshot/master/data/img/app/flameshot.svg'
|
||||||
width={24}
|
width={24}
|
||||||
height={24}
|
height={24}
|
||||||
|
|
|
@ -3,5 +3,7 @@
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
|
||||||
export default function ShareXIcon({ ...props }) {
|
export default function ShareXIcon({ ...props }) {
|
||||||
return <Image src='https://getsharex.com/img/ShareX_Logo.svg' width={24} height={24} {...props} />;
|
return (
|
||||||
|
<Image alt='sharex' src='https://getsharex.com/img/ShareX_Logo.svg' width={24} height={24} {...props} />
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Button, Group, PasswordInput, Select, Tabs, Title, Tooltip } from '@mantine/core';
|
import { Button, Group, NumberInput, PasswordInput, Select, Tabs, Title, Tooltip } from '@mantine/core';
|
||||||
import { Prism } from '@mantine/prism';
|
import { Prism } from '@mantine/prism';
|
||||||
import { Language } from 'prism-react-renderer';
|
import { Language } from 'prism-react-renderer';
|
||||||
import { showNotification, updateNotification } from '@mantine/notifications';
|
import { showNotification, updateNotification } from '@mantine/notifications';
|
||||||
|
@ -17,6 +17,7 @@ export default function Upload() {
|
||||||
const [lang, setLang] = useState('txt');
|
const [lang, setLang] = useState('txt');
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
const [expires, setExpires] = useState('never');
|
const [expires, setExpires] = useState('never');
|
||||||
|
const [maxViews, setMaxViews] = useState<number>(undefined);
|
||||||
|
|
||||||
const handleUpload = async () => {
|
const handleUpload = async () => {
|
||||||
const file = new File([value], 'text.' + lang);
|
const file = new File([value], 'text.' + lang);
|
||||||
|
@ -97,6 +98,7 @@ export default function Upload() {
|
||||||
|
|
||||||
expires !== 'never' && req.setRequestHeader('Expires-At', 'date=' + expires_at.toISOString());
|
expires !== 'never' && req.setRequestHeader('Expires-At', 'date=' + expires_at.toISOString());
|
||||||
password !== '' && req.setRequestHeader('Password', password);
|
password !== '' && req.setRequestHeader('Password', password);
|
||||||
|
maxViews && maxViews !== 0 && req.setRequestHeader('Max-Views', String(maxViews));
|
||||||
|
|
||||||
req.send(body);
|
req.send(body);
|
||||||
};
|
};
|
||||||
|
@ -139,6 +141,9 @@ export default function Upload() {
|
||||||
icon={<TypeIcon />}
|
icon={<TypeIcon />}
|
||||||
searchable
|
searchable
|
||||||
/>
|
/>
|
||||||
|
<Tooltip label='After the file reaches this amount of views, it will be deleted automatically. Leave blank for no limit.'>
|
||||||
|
<NumberInput placeholder='Max Views' min={0} value={maxViews} onChange={(x) => setMaxViews(x)} />
|
||||||
|
</Tooltip>
|
||||||
<Tooltip label='Add a password to your files (optional, leave blank for none)'>
|
<Tooltip label='Add a password to your files (optional, leave blank for none)'>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
style={{ width: '252px' }}
|
style={{ width: '252px' }}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
Title,
|
Title,
|
||||||
Card,
|
Card,
|
||||||
Center,
|
Center,
|
||||||
|
NumberInput,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useForm } from '@mantine/form';
|
import { useForm } from '@mantine/form';
|
||||||
import { showNotification } from '@mantine/notifications';
|
import { showNotification } from '@mantine/notifications';
|
||||||
|
@ -32,6 +33,7 @@ export default function Urls() {
|
||||||
initialValues: {
|
initialValues: {
|
||||||
url: '',
|
url: '',
|
||||||
vanity: '',
|
vanity: '',
|
||||||
|
maxViews: undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -47,17 +49,25 @@ export default function Urls() {
|
||||||
return form.setFieldError('url', 'Invalid URL');
|
return form.setFieldError('url', 'Invalid URL');
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = {
|
const data: {
|
||||||
|
url: string;
|
||||||
|
vanity?: string;
|
||||||
|
} = {
|
||||||
url: cleanURL,
|
url: cleanURL,
|
||||||
vanity: cleanVanity === '' ? null : cleanVanity,
|
vanity: cleanVanity === '' ? null : cleanVanity,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const headers = {};
|
||||||
|
|
||||||
|
if (values.maxViews && values.maxViews !== 0) headers['Max-Views'] = values.maxViews;
|
||||||
|
|
||||||
setCreateOpen(false);
|
setCreateOpen(false);
|
||||||
const res = await fetch('/api/shorten', {
|
const res = await fetch('/api/shorten', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: user.token,
|
Authorization: user.token,
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
...headers,
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
|
@ -92,6 +102,7 @@ export default function Urls() {
|
||||||
<form onSubmit={form.onSubmit((v) => onSubmit(v))}>
|
<form onSubmit={form.onSubmit((v) => onSubmit(v))}>
|
||||||
<TextInput id='url' label='URL' {...form.getInputProps('url')} />
|
<TextInput id='url' label='URL' {...form.getInputProps('url')} />
|
||||||
<TextInput id='vanity' label='Vanity' {...form.getInputProps('vanity')} />
|
<TextInput id='vanity' label='Vanity' {...form.getInputProps('vanity')} />
|
||||||
|
<NumberInput id='maxViews' label='Max Views' {...form.getInputProps('maxViews')} />
|
||||||
|
|
||||||
<Group position='right' mt='md'>
|
<Group position='right' mt='md'>
|
||||||
<Button onClick={() => setCreateOpen(false)}>Cancel</Button>
|
<Button onClick={() => setCreateOpen(false)}>Cancel</Button>
|
||||||
|
|
Loading…
Reference in a new issue