mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 11:07:49 +01:00
add cacher for proxy files
This commit is contained in:
parent
c7bf857d38
commit
ce9f7bcaf6
1 changed files with 4 additions and 2 deletions
|
@ -22,7 +22,7 @@ const URL_WHITELIST = [
|
||||||
"is3-ssl.mzstatic.com",
|
"is3-ssl.mzstatic.com",
|
||||||
"twemoji.maxcdn.com",
|
"twemoji.maxcdn.com",
|
||||||
"unpkg.com",
|
"unpkg.com",
|
||||||
"youtube.com"
|
"youtube.com",
|
||||||
];
|
];
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
@ -37,6 +37,9 @@ app.use(function (req, res, next) {
|
||||||
|
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
res.header("Access-Control-Allow-Origin", "*");
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
|
res.setHeader("Cache-Control", "public, max-age=870"); // cache header
|
||||||
|
res.setHeader("poketube-cacher", "PROXY_FILES");
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,7 +71,6 @@ const proxy = async (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
f.body.pipe(res);
|
f.body.pipe(res);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`==> Error: ${e}`);
|
console.log(`==> Error: ${e}`);
|
||||||
res.status(500).send("Internal server error");
|
res.status(500).send("Internal server error");
|
||||||
|
|
Loading…
Reference in a new issue