Compare commits

...

2 Commits

Author SHA1 Message Date
175a86b490 Merge branch 'proxy' of gitea.moe:lamp/random-miku-server into proxy 2023-02-05 03:29:25 +00:00
8f1c789c8e remove backup origin 2023-02-05 03:28:29 +00:00
2 changed files with 417 additions and 258 deletions

View File

@ -56,12 +56,12 @@ async function serveId(id, req, res, next) {
if (!url) return res.status(400).type("text").send(`size must be one of the following: ${Object.keys(pages[0].urls).join(', ')}`); if (!url) return res.status(400).type("text").send(`size must be one of the following: ${Object.keys(pages[0].urls).join(', ')}`);
var pxreq = await fetch(url, { headers: {"Referer": "https://www.pixiv.net"} }); var pxreq = await fetch(url, { headers: {"Referer": "https://www.pixiv.net"} });
if (pxreq.status != 200 && size == "original") { //if (pxreq.status != 200 && size == "original") {
res.header("X-Using-Backup", '1'); // res.header("X-Using-Backup", '1');
pxreq = await fetch(`https://39.hmbp.gq/https://www.pixiv.net/en/artworks/${id}?noredirect`); // pxreq = await fetch(`https://39.hmbp.gq/https://www.pixiv.net/en/artworks/${id}?noredirect`);
} //}
res.status(203); res.status(pxreq.status);
res.type(pxreq.headers.get("Content-Type")); res.type(pxreq.headers.get("Content-Type"));
res.header("Content-Disposition", `filename=${url.split('/').pop()}`); res.header("Content-Disposition", `filename=${url.split('/').pop()}`);
res.header("X-Pixiv-Id", id); res.header("X-Pixiv-Id", id);

665
package-lock.json generated

File diff suppressed because it is too large Load Diff