mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 12:17:52 +01:00
add cacher for static files
This commit is contained in:
parent
c38a6c5c89
commit
c7bf857d38
1 changed files with 10 additions and 0 deletions
10
server.js
10
server.js
|
@ -97,6 +97,7 @@ this is our config file,you can change stuff here
|
|||
invapi: "https://invidious.sethforprivacy.com/api/v1",
|
||||
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
|
||||
invchannel:"https://invidious.privacydev.net/api/v1",
|
||||
cacher_max_age:"1800",
|
||||
enablealwayshttps: true, //enables always https on the server
|
||||
t_url: "https://t.poketube.fun/", // def matomo url
|
||||
};
|
||||
|
@ -124,6 +125,15 @@ this is our config file,you can change stuff here
|
|||
next();
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (req.url.match(/^\/(css|js|img|font)\/.+/)) {
|
||||
res.setHeader('Cache-Control', 'public, max-age=' + config.cacher_max_age); // cache header
|
||||
res.setHeader("poketube-cacher", "STATIC_FILES");
|
||||
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
sinit(app, config, renderTemplate);
|
||||
|
||||
init(app);
|
||||
|
|
Loading…
Reference in a new issue