From 279db4b4cb58c710eeb52a217bd769e5ba7e1271 Mon Sep 17 00:00:00 2001 From: Radiquum Date: Sun, 16 Mar 2025 03:26:51 +0500 Subject: [PATCH] debug --- middleware.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/middleware.ts b/middleware.ts index fffdb13..9a30c52 100644 --- a/middleware.ts +++ b/middleware.ts @@ -71,8 +71,8 @@ export default async function middleware( const videoRe = /\/v\/.*?\.mp4/; const video = videoRe.exec(pageData); - if (video.length == 0) { - return new Response(JSON.stringify({ message: "Error Fetching Data" }), { + if (!video || video.length == 0) { + return new Response(JSON.stringify({ message: "Sibnet: Video not found" }), { status: 500, headers: { "Content-Type": "application/json", @@ -83,8 +83,8 @@ export default async function middleware( const posterRe = /\/upload\/cover\/.*?\.jpg/; const posterUrl = posterRe.exec(pageData); - if (posterUrl.length == 0) { - return new Response(JSON.stringify({ message: "Error Fetching Data" }), { + if (!posterUrl || posterUrl.length == 0) { + return new Response(JSON.stringify({ message: "Sibnet: Poster not found" }), { status: 500, headers: { "Content-Type": "application/json", @@ -186,12 +186,12 @@ export default async function middleware( formData.append(key as any, value as any); } - console.log("get JSON:", params); - console.log("send FORM:", formData); - - const response = await fetch(`https://${path}`, { + const response = await fetch(`https://anix-c.wah.su/https://${path}`, { method: "POST", body: formData, + headers: { + origin: "anix.wah.su" + } }).catch((err) => { console.log(err); return new Response(err.message, {