mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Updates
* Show horizontal scrollbar for table only when needed. * Cache-Control for static files.
This commit is contained in:
parent
32dd070e49
commit
fc71601074
16
lolisafe.js
16
lolisafe.js
@ -32,11 +32,21 @@ safe.use('/api/register/', limiter)
|
||||
safe.use(bodyParser.urlencoded({ extended: true }))
|
||||
safe.use(bodyParser.json())
|
||||
|
||||
if (config.serveFilesWithNode) {
|
||||
safe.use('/', express.static(config.uploads.folder))
|
||||
const setHeaders = (res, path, stat) => {
|
||||
if (/\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|js|css|eot|svg|ttf|woff|woff2)$/.test(path)) {
|
||||
const day = 86400000
|
||||
res.set('Access-Control-Allow-Origin', '*')
|
||||
res.append('Cache-Control', `must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800, max-age=${day * 30}`) // 30 days
|
||||
} else {
|
||||
res.append('Cache-Control', 'max-age=14400') // 4 hours
|
||||
}
|
||||
}
|
||||
|
||||
safe.use('/', express.static('./public'))
|
||||
if (config.serveFilesWithNode) {
|
||||
safe.use('/', express.static(config.uploads.folder, { setHeaders }))
|
||||
}
|
||||
|
||||
safe.use('/', express.static('./public', { setHeaders }))
|
||||
safe.use('/', album)
|
||||
safe.use('/api', api)
|
||||
|
||||
|
@ -37,6 +37,9 @@
|
||||
"standard": "^10.0.3"
|
||||
},
|
||||
"standard": {
|
||||
"envs": ["browser", "node"]
|
||||
"envs": [
|
||||
"browser",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -153,5 +153,5 @@ hr {
|
||||
}
|
||||
|
||||
.table-container {
|
||||
overflow-x: scroll;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user