mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Updates
This commit is contained in:
parent
f17d375107
commit
00a4e44758
@ -584,7 +584,7 @@ uploadsController.scanFiles = (req, infoMap) => {
|
||||
for (const info of infoMap)
|
||||
scanner.scanFile(info.path).then(reply => {
|
||||
if (!reply.includes('OK') || reply.includes('FOUND')) {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const virus = reply.replace(/^stream: /, '').replace(/ FOUND\u0000$/, '')
|
||||
console.log(`ClamAV: ${info.data.filename}: ${virus} FOUND.`)
|
||||
return resolve(virus)
|
||||
|
58
lolisafe.js
58
lolisafe.js
@ -64,39 +64,39 @@ safe.use('/', album)
|
||||
safe.use('/', nojs)
|
||||
safe.use('/api', api)
|
||||
|
||||
if (Array.isArray(config.pages) && config.pages.length) {
|
||||
for (const page of config.pages)
|
||||
if (fs.existsSync(`./pages/custom/${page}.html`)) {
|
||||
safe.get(`/${page}`, (req, res, next) => res.sendFile(`${page}.html`, {
|
||||
root: './pages/custom/'
|
||||
}))
|
||||
} else if (page === 'home') {
|
||||
safe.get('/', (req, res, next) => res.render('home', {
|
||||
maxSize: config.uploads.maxSize,
|
||||
urlMaxSize: config.uploads.urlMaxSize,
|
||||
urlDisclaimerMessage: config.uploads.urlDisclaimerMessage,
|
||||
urlExtensionsFilterMode: config.uploads.urlExtensionsFilterMode,
|
||||
urlExtensionsFilter: config.uploads.urlExtensionsFilter,
|
||||
gitHash: safe.get('git-hash')
|
||||
}))
|
||||
} else if (page === 'faq') {
|
||||
const fileLength = config.uploads.fileLength
|
||||
safe.get('/faq', (req, res, next) => res.render('faq', {
|
||||
whitelist: config.extensionsFilterMode === 'whitelist',
|
||||
extensionsFilter: config.extensionsFilter,
|
||||
fileLength,
|
||||
tooShort: (fileLength.max - fileLength.default) > (fileLength.default - fileLength.min),
|
||||
noJsMaxSize: parseInt(config.cloudflare.noJsMaxSize) < parseInt(config.uploads.maxSize),
|
||||
chunkSize: config.uploads.chunkSize
|
||||
}))
|
||||
} else {
|
||||
safe.get(`/${page}`, (req, res, next) => res.render(page))
|
||||
}
|
||||
} else {
|
||||
if (!Array.isArray(config.pages) || !config.pages.length) {
|
||||
console.error('config.pages is not an array or is an empty array. This won\t do!')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
for (const page of config.pages)
|
||||
if (fs.existsSync(`./pages/custom/${page}.html`)) {
|
||||
safe.get(`/${page}`, (req, res, next) => res.sendFile(`${page}.html`, {
|
||||
root: './pages/custom/'
|
||||
}))
|
||||
} else if (page === 'home') {
|
||||
safe.get('/', (req, res, next) => res.render('home', {
|
||||
maxSize: config.uploads.maxSize,
|
||||
urlMaxSize: config.uploads.urlMaxSize,
|
||||
urlDisclaimerMessage: config.uploads.urlDisclaimerMessage,
|
||||
urlExtensionsFilterMode: config.uploads.urlExtensionsFilterMode,
|
||||
urlExtensionsFilter: config.uploads.urlExtensionsFilter,
|
||||
gitHash: safe.get('git-hash')
|
||||
}))
|
||||
} else if (page === 'faq') {
|
||||
const fileLength = config.uploads.fileLength
|
||||
safe.get('/faq', (req, res, next) => res.render('faq', {
|
||||
whitelist: config.extensionsFilterMode === 'whitelist',
|
||||
extensionsFilter: config.extensionsFilter,
|
||||
fileLength,
|
||||
tooShort: (fileLength.max - fileLength.default) > (fileLength.default - fileLength.min),
|
||||
noJsMaxSize: parseInt(config.cloudflare.noJsMaxSize) < parseInt(config.uploads.maxSize),
|
||||
chunkSize: config.uploads.chunkSize
|
||||
}))
|
||||
} else {
|
||||
safe.get(`/${page}`, (req, res, next) => res.render(page))
|
||||
}
|
||||
|
||||
safe.use((req, res, next) => {
|
||||
res.status(404).sendFile(config.errorPages[404], { root: config.errorPages.rootDir })
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user