|
|
|
@ -69,10 +69,11 @@ 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'))
|
|
|
|
|
: fs.readFile(path('.github', 'README.md'))
|
|
|
|
|
.then((bytes) => bytes.toString())
|
|
|
|
|
.then((data) => marked(data))
|
|
|
|
|
.then((d) => res.render('index', { data: d }))
|
|
|
|
@ -97,6 +98,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'}`));
|
|
|
|
|