mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 06:17:58 +01:00
add robots.txt and prettier site
This commit is contained in:
parent
f7eff5ccd0
commit
0a8b6b3bad
1 changed files with 19 additions and 11 deletions
30
server.js
30
server.js
|
@ -96,8 +96,8 @@ this is our config file,you can change stuff here
|
||||||
tubeApi: "https://api.poketube.fun/api/",
|
tubeApi: "https://api.poketube.fun/api/",
|
||||||
invapi: "https://invidious.sethforprivacy.com/api/v1",
|
invapi: "https://invidious.sethforprivacy.com/api/v1",
|
||||||
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
|
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
|
||||||
invchannel:"https://invidious.privacydev.net/api/v1",
|
invchannel: "https://invidious.privacydev.net/api/v1",
|
||||||
cacher_max_age:"1800",
|
cacher_max_age: "1800",
|
||||||
enablealwayshttps: true, //enables always https on the server
|
enablealwayshttps: true, //enables always https on the server
|
||||||
t_url: "https://t.poketube.fun/", // def matomo url
|
t_url: "https://t.poketube.fun/", // def matomo url
|
||||||
};
|
};
|
||||||
|
@ -116,24 +116,32 @@ this is our config file,you can change stuff here
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(function (request, response, next) {
|
app.use(function (request, response, next) {
|
||||||
if (config.enablealwayshttps && !request.secure) {
|
if (config.enablealwayshttps && !request.secure) {
|
||||||
return response.redirect(
|
return response.redirect("https://" + request.headers.host + request.url);
|
||||||
"https://" + request.headers.host + request.url
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
if (req.url.match(/^\/(css|js|img|font)\/.+/)) {
|
if (req.url.match(/^\/(css|js|img|font)\/.+/)) {
|
||||||
res.setHeader('Cache-Control', 'public, max-age=' + config.cacher_max_age); // cache header
|
res.setHeader(
|
||||||
res.setHeader("poketube-cacher", "STATIC_FILES");
|
"Cache-Control",
|
||||||
|
"public, max-age=" + config.cacher_max_age
|
||||||
|
); // cache header
|
||||||
|
res.setHeader("poketube-cacher", "STATIC_FILES");
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initlog("[OK] Load headers")
|
||||||
|
|
||||||
|
app.get("/robots.txt", (req, res) => {
|
||||||
|
res.sendFile(__dirname + "/robots.txt");
|
||||||
|
});
|
||||||
|
|
||||||
|
initlog("[OK] Load robots.txt")
|
||||||
|
|
||||||
sinit(app, config, renderTemplate);
|
sinit(app, config, renderTemplate);
|
||||||
|
|
||||||
init(app);
|
init(app);
|
||||||
|
|
Loading…
Reference in a new issue