1
1
import { loadConfig } from '@ryanke/venera' ;
2
- import bytes from 'bytes' ;
3
2
import c from 'chalk' ;
4
3
import { randomBytes } from 'crypto' ;
5
4
import dedent from 'dedent' ;
@@ -9,14 +8,15 @@ import z, { any, array, boolean, number, record, strictObject, string, union } f
9
8
import { fromZodError } from 'zod-validation-error' ;
10
9
import { expandMime } from './helpers/expand-mime.js' ;
11
10
import { HostService } from './modules/host/host.service.js' ;
11
+ import { parseBytes } from './helpers/parse-bytes.js' ;
12
12
13
13
export type MicroHost = ReturnType < typeof enhanceHost > ;
14
14
15
15
const schema = strictObject ( {
16
16
databaseUrl : string ( ) . startsWith ( 'postgresql://' ) ,
17
17
secret : string ( ) . min ( 6 ) ,
18
18
inquiries : string ( ) . email ( ) ,
19
- uploadLimit : string ( ) . transform ( bytes . parse ) ,
19
+ uploadLimit : string ( ) . transform ( parseBytes ) ,
20
20
maxPasteLength : number ( ) . default ( 500000 ) ,
21
21
allowTypes : z
22
22
. union ( [ array ( string ( ) ) , string ( ) ] )
@@ -25,7 +25,7 @@ const schema = strictObject({
25
25
storagePath : string ( ) ,
26
26
restrictFilesToHost : boolean ( ) . default ( true ) ,
27
27
purge : strictObject ( {
28
- overLimit : string ( ) . transform ( bytes . parse ) ,
28
+ overLimit : string ( ) . transform ( parseBytes ) ,
29
29
afterTime : string ( ) . transform ( ms ) ,
30
30
} ) . optional ( ) ,
31
31
email : strictObject ( {
@@ -36,7 +36,7 @@ const schema = strictObject({
36
36
strictObject ( {
37
37
from : union ( [ array ( string ( ) ) , string ( ) ] ) . transform ( ( value ) => new Set ( expandMime ( value ) ) ) ,
38
38
to : string ( ) ,
39
- minSize : string ( ) . transform ( bytes . parse ) . optional ( ) ,
39
+ minSize : string ( ) . transform ( parseBytes ) . optional ( ) ,
40
40
} ) ,
41
41
) . optional ( ) ,
42
42
hosts : array (
0 commit comments