From 33d0428e7436c14480eb4c876a371c2bf81b4881 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Thu, 21 Jul 2022 23:59:46 +0700 Subject: [PATCH] refactor: unset pattern in / middlewares not having it set equals to having it be on / pattern to begin with --- lolisafe.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lolisafe.js b/lolisafe.js index 2c1b928..17a8f43 100644 --- a/lolisafe.js +++ b/lolisafe.js @@ -123,7 +123,7 @@ if (config.accessControlAllowOrigin) { const nunjucksRendererInstance = new NunjucksRenderer('views', { watch: isDevMode }) -safe.use('/', nunjucksRendererInstance.middleware) +safe.use(nunjucksRendererInstance.middleware) // Array of routes to apply CDN Cache-Control onto, // 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 - safe.use('/', (req, res, next) => { + safe.use((req, res, next) => { res.header('Cache-Control', cacheControls.validate) return next() }) @@ -194,18 +194,18 @@ const serveLiveDirectoryPublicInstance = new ServeLiveDirectory( { path: paths.public }, { setHeaders: setHeadersForStaticAssets } ) -safe.use('/', serveLiveDirectoryPublicInstance.middleware) +safe.use(serveLiveDirectoryPublicInstance.middleware) const serveLiveDirectoryDistInstance = new ServeLiveDirectory( { path: paths.dist }, { setHeaders: setHeadersForStaticAssets } ) -safe.use('/', serveLiveDirectoryDistInstance.middleware) +safe.use(serveLiveDirectoryDistInstance.middleware) // Routes -safe.use('/', album) -safe.use('/', file) -safe.use('/', nojs) -safe.use('/', player) +safe.use(album) +safe.use(file) +safe.use(nojs) +safe.use(player) safe.use('/api', api) ;(async () => {