From ad5a20e317224a5027687d533d51a305e1942c01 Mon Sep 17 00:00:00 2001 From: tycrek Date: Sun, 3 Oct 2021 19:50:50 -0600 Subject: [PATCH 1/2] Fixed custom index loading trying to load as Boolean --- ass.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ass.js b/ass.js index e4b160d..5a68b50 100755 --- a/ass.js +++ b/ass.js @@ -66,8 +66,9 @@ useSsl && app.use(helmet.hsts({ preload: true })); // skipcq: JS-0093 app.use(nofavicon); // Use custom index, otherwise render README.md -const ASS_INDEX = indexFile !== '' && fs.existsSync(`./${indexFile}`) && (typeof require(`./${indexFile}`) === typeof Function); -app.get('/', (req, res, next) => ASS_INDEX // skipcq: JS-0229 +const ASS_INDEX = indexFile !== '' && fs.existsSync(`./${indexFile}`) && require(`./${indexFile}`); +const ASS_INDEX_ENABLED = typeof ASS_INDEX === typeof Function; +app.get('/', (req, res, next) => ASS_INDEX_ENABLED // skipcq: JS-0229 ? ASS_INDEX(req, res, next) : fs.readFile(path('README.md')) .then((bytes) => bytes.toString()) @@ -94,6 +95,6 @@ log .info('Files', `${data.size}`) .info('Data engine', data.name, data.type) .info('Frontend', ASS_FRONTEND.enabled ? ASS_FRONTEND.brand : 'disabled', `${ASS_FRONTEND.enabled ? `${getTrueHttp()}${getTrueDomain()}${ASS_FRONTEND.endpoint}` : ''}`) - .info('Custom index', ASS_INDEX ? `enabled` : 'disabled') + .info('Custom index', ASS_INDEX_ENABLED ? `enabled` : 'disabled') .blank() .express().Host(app, port, host, () => log.success('Ready for uploads', `Storing resources ${s3enabled ? 'in S3' : 'on disk'}`)); From 03ecbb9520d4b8572f05cd5986d102ba3dabda6d Mon Sep 17 00:00:00 2001 From: tycrek Date: Sun, 3 Oct 2021 19:52:34 -0600 Subject: [PATCH 2/2] Fixed incorrect path for loading README as index --- ass.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ass.js b/ass.js index 5a68b50..9a4af69 100755 --- a/ass.js +++ b/ass.js @@ -70,7 +70,7 @@ const ASS_INDEX = indexFile !== '' && fs.existsSync(`./${indexFile}`) && require const ASS_INDEX_ENABLED = typeof ASS_INDEX === typeof Function; app.get('/', (req, res, next) => ASS_INDEX_ENABLED // skipcq: JS-0229 ? ASS_INDEX(req, res, next) - : fs.readFile(path('README.md')) + : fs.readFile(path('.github', 'README.md')) .then((bytes) => bytes.toString()) .then(marked) .then((d) => res.render('index', { data: d }))