@@ -40,6 +40,7 @@ import { DoramaController } from './controllers/dorama.controller';
4040import { DoramaBerkasController } from './controllers/dorama-/dorama-berkas.controller' ;
4141import { DoramaFansubController } from './controllers/dorama-/dorama-fansub.controller' ;
4242import { DoramaSeasonalController } from './controllers/dorama-/dorama-seasonal.controller' ;
43+ import { FanshareController } from './controllers/fanshare.controller' ;
4344import { FansubController } from './controllers/fansub.controller' ;
4445import { FansubAllController } from './controllers/fansub-/fansub-all.controller' ;
4546import { FansubAnimeController } from './controllers/fansub-/fansub-anime.controller' ;
@@ -195,6 +196,7 @@ import { UserPremiumService } from './repository/user-premium.service';
195196 DoramaBerkasController ,
196197 DoramaFansubController ,
197198 DoramaSeasonalController ,
199+ FanshareController ,
198200 FansubController ,
199201 FansubAllController ,
200202 FansubAnimeController ,
@@ -339,7 +341,8 @@ export class AppModule {
339341 { path : '/api/google-verifikasi' , method : RequestMethod . GET } ,
340342 { path : '/api/line-verifikasi' , method : RequestMethod . GET } ,
341343 { path : '/api/aktivasi' , method : RequestMethod . GET } ,
342- { path : '/api/verify-sosmed' , method : RequestMethod . GET }
344+ { path : '/api/verify-sosmed' , method : RequestMethod . GET } ,
345+ { path : '/api/fanshare/u0' , method : RequestMethod . ALL }
343346 ) . forRoutes (
344347 { path : '*' , method : RequestMethod . ALL }
345348 ) ;
@@ -349,7 +352,8 @@ export class AppModule {
349352 { path : '/api/verify-sosmed' , method : RequestMethod . GET } ,
350353 { path : '/api/login' , method : RequestMethod . POST } ,
351354 { path : '/api/register' , method : RequestMethod . POST } ,
352- { path : '/api/lost-account-*' , method : RequestMethod . POST }
355+ { path : '/api/lost-account-*' , method : RequestMethod . POST } ,
356+ { path : '/api/fanshare/u0' , method : RequestMethod . ALL }
353357 ) . forRoutes (
354358 { path : '*' , method : RequestMethod . ALL }
355359 ) ;
@@ -401,17 +405,51 @@ export class AppModule {
401405 mc . apply (
402406 uploadx . upload ( {
403407 storage : new S3Storage ( {
404- path : '/fanshare/u0 ' ,
408+ path : '/fanshare' ,
405409 region : 'auto' ,
406- allowMIME : CONSTANTS . fileTypeAttachmentAllowed ,
410+ // allowMIME: CONSTANTS.fileTypeAttachmentAllowed,
407411 bucket : environment . cloudflare . r2 . bucket ,
408412 endpoint : `https://${ environment . cloudflare . r2 . endpoint } ` ,
409413 credentials : {
410414 accessKeyId : environment . cloudflare . r2 . accessKeyId ,
411415 secretAccessKey : environment . cloudflare . r2 . secretAccessKey
412416 } ,
417+ requestChecksumCalculation : 'WHEN_REQUIRED' ,
418+ responseChecksumValidation : 'WHEN_REQUIRED' ,
413419 filename : ( file : S3File , req ) => {
414- return `u0/${ file . name } ` ;
420+ console . log ( 'filename' , ) ;
421+ console . log ( file ) ;
422+ const fileName = file . originalName
423+ . replace ( CONSTANTS . regexIllegalFileName , '-' )
424+ . replace ( / \s / g, '_' )
425+ . replace ( / ^ [ - . ~ ] + | [ - . ~ ] + $ / g, '' )
426+ . substring ( 0 , 255 ) ;
427+ return `u0/${ new Date ( ) . getTime ( ) } _${ fileName } ` ;
428+ } ,
429+ onCreate : ( file : S3File ) => {
430+ console . log ( 'onCreate' ) ;
431+ console . log ( file ) ;
432+ return file ;
433+ } ,
434+ onUpdate : ( file : S3File ) => {
435+ console . log ( 'onUpdate' ) ;
436+ console . log ( file ) ;
437+ return file ;
438+ } ,
439+ onComplete : ( file : S3File ) => {
440+ console . log ( 'onComplete' ) ;
441+ console . log ( file ) ;
442+ return file ;
443+ } ,
444+ onDelete : ( file : S3File ) => {
445+ console . log ( 'onDelete' ) ;
446+ console . log ( file ) ;
447+ return file ;
448+ } ,
449+ onError : ( error ) => {
450+ console . log ( 'onError' ) ;
451+ console . log ( error ) ;
452+ return error ;
415453 } ,
416454 forcePathStyle : true ,
417455 clientDirectUpload : true ,
@@ -420,7 +458,10 @@ export class AppModule {
420458 maxAge : '3d' ,
421459 purgeInterval : '20min'
422460 } ,
423- logLevel : environment . production ? 'error' : 'debug'
461+ metaStorageConfig : {
462+ directory : 'dist/alt-site/temp'
463+ } ,
464+ logLevel : 'debug'
424465 } )
425466 } )
426467 ) . forRoutes (
0 commit comments