Compare commits

..

3 Commits

Author SHA1 Message Date
2c166ecdb2 mistake again 2021-08-21 18:32:34 -07:00
ebbaec9e0e filter querystring !@ 2021-08-21 18:32:05 -07:00
53db080d92 wrong name 2021-08-21 18:24:57 -07:00
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ client.on("messageCreate", async message => {
let json = html.match(/<meta name="preload-data" id="meta-preload-data" content='(.*)'>/)[1];
let data = JSON.parse(json);
let url = Object.values(data.illust)[0].urls.original;
await message.channel.send(url.replace("https://i.pximg.net/", `https://${config.web_hostname}/pixiv-cache/`));
await message.channel.send(url.replace("https://i.pximg.net/", `https://${config.web_hostname}/pixiv-proxy/`));
} catch (error) {
console.error("pixiv error,", error.message);
}
@ -34,7 +34,7 @@ client.on("messageCreate", async message => {
app.use("/pixiv-proxy/", (req, res, next) => {
if (req.method != "GET") return next();
let local_file_path = config.data_dir + "pixiv-cache/" + req.url.replace(/\//g, '\\');
let local_file_path = config.data_dir + "pixiv-cache/" + req.url.split('?')[0].replace(/\//g, '\\');
if (fs.existsSync(local_file_path)) res.sendFile(local_file_path);
else {
https.get(`https://i.pximg.net${req.url}`, {