@@ -12,18 +12,18 @@ import { Console } from './lib/logger';
12
12
import { AddressInfo } from 'net' ;
13
13
import { magenta , bold , green , reset , blue , red } from '@dicedtomato/colors' ;
14
14
import { Configuration } from './lib/Config' ;
15
- import { UserController } from './lib/api/ controllers/UserController' ;
16
- import { RootController } from './lib/api/ controllers/RootController' ;
15
+ import { UserController } from './lib/controllers/UserController' ;
16
+ import { RootController } from './lib/controllers/RootController' ;
17
17
import { join } from 'path' ;
18
- import { ImagesController } from './lib/api/ controllers/ImagesController' ;
19
- import { URLSController } from './lib/api/ controllers/URLSController' ;
18
+ import { ImagesController } from './lib/controllers/ImagesController' ;
19
+ import { URLSController } from './lib/controllers/URLSController' ;
20
20
import { checkVersion } from './lib/Util' ;
21
21
import { existsSync , readFileSync } from 'fs' ;
22
22
import { Image } from './lib/entities/Image' ;
23
23
import { User } from './lib/entities/User' ;
24
24
import { Zipline } from './lib/entities/Zipline' ;
25
25
import { URL } from './lib/entities/URL' ;
26
- import { MultiFactorController } from './lib/api/ controllers/MultiFactorController' ;
26
+ import { MultiFactorController } from './lib/controllers/MultiFactorController' ;
27
27
const dev = process . env . NODE_ENV !== 'production' ;
28
28
29
29
( async ( ) => {
@@ -218,3 +218,20 @@ server.addHook('preHandler', async (req, reply) => {
218
218
return ( reply . sent = true ) ;
219
219
}
220
220
} ) ;
221
+
222
+ server . addHook ( 'onResponse' , ( req , res , done ) => {
223
+ if (
224
+ ! req . url . startsWith ( '/_next' ) &&
225
+ ! req . url . startsWith ( '/api/upload' ) &&
226
+ ! req . url . startsWith ( '/api/shorten' ) &&
227
+ ! req . url . startsWith ( '/api/user' ) &&
228
+ ! req . url . startsWith ( '/api/theme' )
229
+ ) {
230
+ const status =
231
+ res . statusCode !== 200
232
+ ? bold ( red ( res . statusCode . toString ( ) ) )
233
+ : bold ( green ( res . statusCode . toString ( ) ) ) ;
234
+ Console . logger ( 'server' ) . info ( `${ status } ${ req . url } was accessed` ) ;
235
+ }
236
+ done ( ) ;
237
+ } ) ;
0 commit comments