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'}`));