refactor: unset pattern in / middlewares

not having it set equals to having it be on / pattern to begin with
This commit is contained in:
Bobby Wibowo 2022-07-21 23:59:46 +07:00
parent 61461d2c26
commit 33d0428e74
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -123,7 +123,7 @@ if (config.accessControlAllowOrigin) {
const nunjucksRendererInstance = new NunjucksRenderer('views', { const nunjucksRendererInstance = new NunjucksRenderer('views', {
watch: isDevMode watch: isDevMode
}) })
safe.use('/', nunjucksRendererInstance.middleware) safe.use(nunjucksRendererInstance.middleware)
// Array of routes to apply CDN Cache-Control onto, // Array of routes to apply CDN Cache-Control onto,
// and additionally call Cloudflare API to have their CDN caches purged when lolisafe starts // and additionally call Cloudflare API to have their CDN caches purged when lolisafe starts
@ -146,7 +146,7 @@ if (config.cacheControl) {
} }
// By default soft cache everything // By default soft cache everything
safe.use('/', (req, res, next) => { safe.use((req, res, next) => {
res.header('Cache-Control', cacheControls.validate) res.header('Cache-Control', cacheControls.validate)
return next() return next()
}) })
@ -194,18 +194,18 @@ const serveLiveDirectoryPublicInstance = new ServeLiveDirectory(
{ path: paths.public }, { path: paths.public },
{ setHeaders: setHeadersForStaticAssets } { setHeaders: setHeadersForStaticAssets }
) )
safe.use('/', serveLiveDirectoryPublicInstance.middleware) safe.use(serveLiveDirectoryPublicInstance.middleware)
const serveLiveDirectoryDistInstance = new ServeLiveDirectory( const serveLiveDirectoryDistInstance = new ServeLiveDirectory(
{ path: paths.dist }, { path: paths.dist },
{ setHeaders: setHeadersForStaticAssets } { setHeaders: setHeadersForStaticAssets }
) )
safe.use('/', serveLiveDirectoryDistInstance.middleware) safe.use(serveLiveDirectoryDistInstance.middleware)
// Routes // Routes
safe.use('/', album) safe.use(album)
safe.use('/', file) safe.use(file)
safe.use('/', nojs) safe.use(nojs)
safe.use('/', player) safe.use(player)
safe.use('/api', api) safe.use('/api', api)
;(async () => { ;(async () => {