mirror of https://github.com/aredn/aredn.git
Improve portable themes (#1470)
This commit is contained in:
parent
861e299251
commit
0cb8138250
|
@ -599,18 +599,19 @@ global.handle_request = function(env)
|
|||
return;
|
||||
}
|
||||
|
||||
const rpath = `${config.application}/resource/${env.PATH_INFO}`;
|
||||
const gzrpath = `${rpath}.gz`;
|
||||
|
||||
const localnode = env.HTTP_HOST === "localnode" || env.HTTP_HOST === "localnode.local.mesh";
|
||||
const cachecontrol = localnode || !config.resourcehash ? "no-store" : "max-age=604800";
|
||||
if (localnode && config.resourcehash) {
|
||||
if (localnode && config.resourcehash && fs.access(gzrpath)) {
|
||||
const themecss = fs.readlink(`${config.application}/resource/css/theme.version`);
|
||||
if (env.PATH_INFO !== `/css/theme.${themecss}.css` && index(env.PATH_INFO || "", "/css/theme.") === 0 && uciMethods.get("aredn", "@theme[0]", "portable") === "1") {
|
||||
if (env.PATH_INFO !== `/css/theme.${themecss}.css` && index(env.PATH_INFO, "/css/theme.") === 0 && uciMethods.get("aredn", "@theme[0]", "portable") === "1") {
|
||||
uhttpd.send(`Status: 302 Found\r\nContent-Type: text/css\r\nCache-Control: no-store\r\nLocation: /a/css/theme.${themecss}.css\r\n\r\n`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const rpath = `${config.application}/resource/${env.PATH_INFO || "unknown"}`;
|
||||
const gzrpath = `${rpath}.gz`;
|
||||
|
||||
if (fs.access(gzrpath)) {
|
||||
uhttpd.send("Status: 200 OK\r\nContent-Encoding: gzip\r\n");
|
||||
if (substr(rpath, -3) === ".js") {
|
||||
|
|
Loading…
Reference in New Issue