server: put app assets in a private folder to let users use "client" and "assets" as folder names

This commit is contained in:
jean-emmanuel 2022-05-22 12:32:10 +02:00
parent 534b6e90fc
commit 1368a109c2
3 changed files with 12 additions and 11 deletions

View file

@ -100,7 +100,7 @@ function httpRoute(req, res) {
} else {
if (url.indexOf('theme.css') != -1) {
if (url.indexOf('__APP__/theme.css') != -1) {
res.setHeader('Content-Type', 'text/css')
if (settings.read('theme')) {
@ -112,11 +112,11 @@ function httpRoute(req, res) {
}
res.end()
} else if (/^\/(assets|client)\//.test(url)){
} else if (/^\/__APP__\//.test(url)){
if (prod) res.setHeader('Cache-Control', 'public, max-age=2592000')
try {
res.sendFile(path.resolve(__dirname + '/..' + url))
res.sendFile(path.resolve(__dirname + '/..' + url.replace('__APP__', '')))
return true
} catch(e) {}