mirror of https://github.com/AlphaNecron/Void.git
refactor(lib): moved constant declarations into `constants.ts`
This commit is contained in:
parent
bb6f0e5d4e
commit
996b487048
|
@ -8,18 +8,20 @@ generator client {
|
|||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
username String
|
||||
password String
|
||||
token String @unique
|
||||
isAdmin Boolean @default(false)
|
||||
useEmbed Boolean? @default(false)
|
||||
embedSiteName String? @default("Void")
|
||||
embedTitle String?
|
||||
embedColor String @default("#B794F4")
|
||||
embedDesc String?
|
||||
files File[]
|
||||
urls Url[]
|
||||
id Int @id @default(autoincrement())
|
||||
username String
|
||||
password String
|
||||
token String @unique
|
||||
isAdmin Boolean @default(false)
|
||||
useEmbed Boolean? @default(false)
|
||||
embedSiteName String? @default("Void")
|
||||
embedTitle String?
|
||||
embedColor String @default("#B794F4")
|
||||
embedDesc String?
|
||||
discordUsername String?
|
||||
discordId String?
|
||||
files File[]
|
||||
urls Url[]
|
||||
}
|
||||
|
||||
model Url {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { extname, join } from 'path';
|
|||
import deployDb from './scripts/deployDb';
|
||||
import prismaRun from './scripts/prismaRun';
|
||||
import { error, info } from './src/lib/logger';
|
||||
import mimetypes from './src/lib/mimetypes';
|
||||
import { mimetypes } from './src/lib/constants';
|
||||
import validate from './src/lib/validateConfig';
|
||||
import readConfig from './src/lib/configReader';
|
||||
import start from './twilight/twilight';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Select, VStack } from '@chakra-ui/react';
|
||||
import languages from 'lib/languages';
|
||||
import { languages } from 'lib/constants';
|
||||
import React, { useState } from 'react';
|
||||
import { Prism as Code } from 'react-syntax-highlighter';
|
||||
import theme from 'react-syntax-highlighter/dist/cjs/styles/prism/coldark-dark';
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Download, X } from 'react-feather';
|
|||
export default function ShareXDialog({ open, onClose, token }) {
|
||||
const ref = React.useRef();
|
||||
const [name, setName] = useState('Void');
|
||||
const [generator, setGenerator] = useState('random');
|
||||
const [generator, setGenerator] = useState('plain');
|
||||
const [tab, setTab] = useState(0);
|
||||
const [usePassword, setUsePassword] = useState(false);
|
||||
const [preserveFileName, setPreserveFileName] = useState(false);
|
||||
|
@ -84,7 +84,7 @@ export default function ShareXDialog({ open, onClose, token }) {
|
|||
onChange={g => setGenerator(g.target.value)}
|
||||
size='sm'
|
||||
>
|
||||
<option value='random'>Random</option>
|
||||
<option value='plain'>Plain</option>
|
||||
<option value='zws'>Invisible</option>
|
||||
<option value='emoji'>Emoji</option>
|
||||
</Select>
|
||||
|
@ -105,7 +105,7 @@ export default function ShareXDialog({ open, onClose, token }) {
|
|||
onChange={g => setGenerator(g.target.value)}
|
||||
size='sm'
|
||||
>
|
||||
<option value='random'>Random</option>
|
||||
<option value='plain'>Plain</option>
|
||||
<option value='zws'>Invisible</option>
|
||||
<option value='emoji'>Emoji</option>
|
||||
</Select>
|
||||
|
|
|
@ -9,7 +9,7 @@ export default function Upload() {
|
|||
const { token } = useStoreSelector(state => state.user);
|
||||
const toast = useToast();
|
||||
const [preserve, setPreserve] = useState(true);
|
||||
const [generator, setGenerator] = useState('random');
|
||||
const [generator, setGenerator] = useState('plain');
|
||||
const [file, setFile] = useState(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const showToast = (srv, title, description?) => {
|
||||
|
@ -81,7 +81,7 @@ export default function Upload() {
|
|||
<HStack justify='stretch' width='385'>
|
||||
<Checkbox width='160' isChecked={preserve} colorScheme='purple' onChange={p => setPreserve(p.target.checked)}>Preserve filename</Checkbox>
|
||||
<Select size='sm' variant='filled' width='110' value={generator} onChange={selection => setGenerator(selection.target.value)}>
|
||||
<option value='random'>Random</option>
|
||||
<option value='plain'>Plain</option>
|
||||
<option value='zws'>Invisible</option>
|
||||
<option value='emoji'>Emoji</option>
|
||||
</Select>
|
||||
|
|
|
@ -84,7 +84,7 @@ export default function URLs() {
|
|||
</PopoverHeader>
|
||||
<PopoverArrow/>
|
||||
<PopoverCloseButton/>
|
||||
<Formik validationSchema={schema} initialValues={{ destination: '', vanity: '', generator: 'random', urlPassword: '' }} onSubmit={(values, actions) => { handleSubmit(values, actions); }}>
|
||||
<Formik validationSchema={schema} initialValues={{ destination: '', vanity: '', generator: 'plain', urlPassword: '' }} onSubmit={(values, actions) => { handleSubmit(values, actions); }}>
|
||||
{props => (
|
||||
<Form>
|
||||
<PopoverBody>
|
||||
|
@ -109,7 +109,7 @@ export default function URLs() {
|
|||
<FormControl>
|
||||
<FormLabel htmlFor='generator'>URL generator</FormLabel>
|
||||
<Select {...field} size='sm' id='generator' mb={2}>
|
||||
<option value='random'>Random</option>
|
||||
<option value='plain'>Plain</option>
|
||||
<option value='zws'>Invisible</option>
|
||||
<option value='emoji'>Emoji</option>
|
||||
</Select>
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,60 +0,0 @@
|
|||
const languages = {
|
||||
'None': 'text',
|
||||
'HTML': 'html',
|
||||
'XML': 'xml',
|
||||
'C#': 'cs',
|
||||
'CSS': 'css',
|
||||
'JavaScript': 'js',
|
||||
'JavaScript React': 'jsx',
|
||||
'Arduino': 'arduino',
|
||||
'ASP.NET': 'aspnet',
|
||||
'AutoIt': 'autoit',
|
||||
'Bash': 'bash',
|
||||
'Batch': 'batch',
|
||||
'C': 'c',
|
||||
'C++': 'cpp',
|
||||
'Clojure': 'clojure',
|
||||
'cmake': 'cmake',
|
||||
'D': 'd',
|
||||
'Dart': 'dart',
|
||||
'Diff': 'diff',
|
||||
'EJS': 'ejs',
|
||||
'F#': 'fsharp',
|
||||
'Git': 'git',
|
||||
'Go': 'go',
|
||||
'Haskell': 'hs',
|
||||
'Http': 'http',
|
||||
'INI': 'ini',
|
||||
'Java': 'java',
|
||||
'JSON': 'json',
|
||||
'Kotlin': 'kt',
|
||||
'Less': 'less',
|
||||
'Lua': 'lua',
|
||||
'Makefile': 'makefile',
|
||||
'Markdown': 'md',
|
||||
'Objective C': 'objc',
|
||||
'Pascal': 'pascal',
|
||||
'Perl': 'perl',
|
||||
'PHP': 'php',
|
||||
'Powershell': 'powershell',
|
||||
'Pug': 'pug',
|
||||
'Q#': 'qs',
|
||||
'QML': 'qml',
|
||||
'Python': 'py',
|
||||
'R': 'r',
|
||||
'Razor C#': 'cshtml',
|
||||
'Ruby': 'rb',
|
||||
'Solution': 'sln',
|
||||
'SQL': 'sql',
|
||||
'TOML': 'toml',
|
||||
'TypeScript': 'ts',
|
||||
'TypeScript React': 'tsx',
|
||||
'V': 'v',
|
||||
'VB.NET': 'vbnet',
|
||||
'Vim': 'vim',
|
||||
'Visual Basic': 'vb',
|
||||
'WebAssembly': 'wasm',
|
||||
'YAML': 'yml'
|
||||
};
|
||||
|
||||
export default languages;
|
|
@ -1,80 +0,0 @@
|
|||
const mimetypes = {
|
||||
'.aac': 'audio/aac',
|
||||
'.abw': 'application/x-abiword',
|
||||
'.arc': 'application/x-freearc',
|
||||
'.avi': 'video/x-msvideo',
|
||||
'.azw': 'application/vnd.amazon.ebook',
|
||||
'.bin': 'application/octet-stream',
|
||||
'.bmp': 'image/bmp',
|
||||
'.bz': 'application/x-bzip',
|
||||
'.bz2': 'application/x-bzip2',
|
||||
'.cda': 'application/x-cdf',
|
||||
'.csh': 'application/x-csh',
|
||||
'.css': 'text/css',
|
||||
'.csv': 'text/csv',
|
||||
'.doc': 'application/msword',
|
||||
'.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'.eot': 'application/vnd.ms-fontobject',
|
||||
'.epub': 'application/epub+zip',
|
||||
'.gz': 'application/gzip',
|
||||
'.gif': 'image/gif',
|
||||
'.htm': 'text/html',
|
||||
'.html': 'text/html',
|
||||
'.ico': 'image/vnd.microsoft.icon',
|
||||
'.ics': 'text/calendar',
|
||||
'.jar': 'application/java-archive',
|
||||
'.jpeg': 'image/jpeg',
|
||||
'.jpg': 'image/jpeg',
|
||||
'.js': 'text/javascript',
|
||||
'.json': 'application/json',
|
||||
'.jsonld': 'application/ld+json',
|
||||
'.mid': 'audio/midi',
|
||||
'.midi': 'audio/midi',
|
||||
'.mjs': 'text/javascript',
|
||||
'.mp3': 'audio/mpeg',
|
||||
'.mp4': 'video/mp4',
|
||||
'.mpeg': 'video/mpeg',
|
||||
'.mpkg': 'application/vnd.apple.installer+xml',
|
||||
'.odp': 'application/vnd.oasis.opendocument.presentation',
|
||||
'.ods': 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'.odt': 'application/vnd.oasis.opendocument.text',
|
||||
'.oga': 'audio/ogg',
|
||||
'.ogv': 'video/ogg',
|
||||
'.ogx': 'application/ogg',
|
||||
'.opus': 'audio/opus',
|
||||
'.otf': 'font/otf',
|
||||
'.png': 'image/png',
|
||||
'.pdf': 'application/pdf',
|
||||
'.php': 'application/x-httpd-php',
|
||||
'.ppt': 'application/vnd.ms-powerpoint',
|
||||
'.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'.rar': 'application/vnd.rar',
|
||||
'.rtf': 'application/rtf',
|
||||
'.sh': 'application/x-sh',
|
||||
'.svg': 'image/svg+xml',
|
||||
'.swf': 'application/x-shockwave-flash',
|
||||
'.tar': 'application/x-tar',
|
||||
'.tif': 'image/tiff',
|
||||
'.tiff': 'image/tiff',
|
||||
'.ts': 'video/mp2t',
|
||||
'.ttf': 'font/ttf',
|
||||
'.txt': 'text/plain',
|
||||
'.vsd': 'application/vnd.visio',
|
||||
'.wav': 'audio/wav',
|
||||
'.weba': 'audio/webm',
|
||||
'.webm': 'video/webm',
|
||||
'.webp': 'image/webp',
|
||||
'.woff': 'font/woff',
|
||||
'.woff2': 'font/woff2',
|
||||
'.xhtml': 'application/xhtml+xml',
|
||||
'.xls': 'application/vnd.ms-excel',
|
||||
'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'.xml': 'application/xml',
|
||||
'.xul': 'application/vnd.mozilla.xul+xml',
|
||||
'.zip': 'application/zip',
|
||||
'.3gp': 'video/3gpp',
|
||||
'.3g2': 'video/3gpp2',
|
||||
'.7z': 'application/x-7z-compressed'
|
||||
};
|
||||
|
||||
export default mimetypes;
|
|
@ -2,7 +2,7 @@ import { Box, Button, Center, Heading, Input, useColorModeValue, useToast, VStac
|
|||
import FileViewer from 'components/FileViewer';
|
||||
import config from 'lib/config';
|
||||
import useFetch from 'lib/hooks/useFetch';
|
||||
import languages from 'lib/languages';
|
||||
import { languages } from 'lib/constants';
|
||||
import prisma from 'lib/prisma';
|
||||
import { bytesToHr } from 'lib/utils';
|
||||
import { GetServerSideProps } from 'next';
|
||||
|
|
|
@ -32,10 +32,11 @@ export default function Error({ code }) {
|
|||
'504': 'Gateway Timeout',
|
||||
'505': 'HTTP Version Not Supported'
|
||||
};
|
||||
this.title = `${code} ${errors[String(code)]}`
|
||||
return (
|
||||
<Center h='100vh'>
|
||||
<VStack>
|
||||
<Heading>{code}: {errors[String(code)]}</Heading>
|
||||
<Heading>{code} {errors[String(code)]}</Heading>
|
||||
<Link href='/dash' passHref>
|
||||
<Button justifyContent='flex-start' colorScheme='purple' leftIcon={<ArrowLeftCircle/>}>Go back</Button>
|
||||
</Link>
|
||||
|
|
|
@ -3,7 +3,7 @@ import cfg from 'lib/config';
|
|||
import generate, { emoji, zws } from 'lib/generators';
|
||||
import { info } from 'lib/logger';
|
||||
import { NextApiReq, NextApiRes, withVoid } from 'lib/middleware/withVoid';
|
||||
import mimetypes from 'lib/mimetypes';
|
||||
import { mimetypes } from 'lib/constants';
|
||||
import prisma from 'lib/prisma';
|
||||
import multer from 'multer';
|
||||
import { join } from 'path';
|
||||
|
|
|
@ -6,7 +6,7 @@ import url from 'url';
|
|||
import config from '../../src/lib/config';
|
||||
import generate, { emoji, zws } from '../../src/lib/generators';
|
||||
import { info, error } from '../../src/lib/logger';
|
||||
import mimetypes from '../../src/lib/mimetypes';
|
||||
import { mimetypes } from '../../src/lib/constants';
|
||||
import prisma from '../../src/lib/prisma';
|
||||
import schemify from 'url-schemify';
|
||||
|
||||
|
|
Loading…
Reference in New Issue