* Show horizontal scrollbar for table only when needed.

* Cache-Control for static files.
This commit is contained in:
Bobby Wibowo 2018-01-24 23:04:21 +07:00
parent 32dd070e49
commit fc71601074
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
3 changed files with 18 additions and 5 deletions

View File

@ -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)

View File

@ -37,6 +37,9 @@
"standard": "^10.0.3"
},
"standard": {
"envs": ["browser", "node"]
"envs": [
"browser",
"node"
]
}
}

View File

@ -153,5 +153,5 @@ hr {
}
.table-container {
overflow-x: scroll;
overflow-x: auto;
}