mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-06 00:04:39 +00:00
add cathes to middleware
This commit is contained in:
parent
38faa451c3
commit
28c203114b
1 changed files with 15 additions and 0 deletions
|
@ -60,6 +60,11 @@ export default async function middleware(
|
||||||
"User-Agent":
|
"User-Agent":
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
||||||
},
|
},
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
return new Response(err.message, {
|
||||||
|
status: 500,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
const pageData = await page.text();
|
const pageData = await page.text();
|
||||||
|
|
||||||
|
@ -94,6 +99,11 @@ export default async function middleware(
|
||||||
"User-Agent":
|
"User-Agent":
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
||||||
},
|
},
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
return new Response(err.message, {
|
||||||
|
status: 500,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Response(JSON.stringify({ url: `https:${response.headers.get("Location")}`, poster: `https://st.sibnet.ru${posterUrl[0]}` }), {
|
return new Response(JSON.stringify({ url: `https:${response.headers.get("Location")}`, poster: `https://st.sibnet.ru${posterUrl[0]}` }), {
|
||||||
|
@ -177,6 +187,11 @@ export default async function middleware(
|
||||||
const response = await fetch(`https://${path}`, {
|
const response = await fetch(`https://${path}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
return new Response(err.message, {
|
||||||
|
status: 500,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return new Response(JSON.stringify(data), {
|
return new Response(JSON.stringify(data), {
|
||||||
|
|
Loading…
Add table
Reference in a new issue