Refactor debug logging in download API for improved readability and consistency
This commit is contained in:
@@ -33,7 +33,11 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
const body = await request.json();
|
||||
const { url, cookies } = body;
|
||||
|
||||
console.log(`Request erhalten - URL: ${url}, Cookies vorhanden: ${!!cookies}, Cookie-Länge: ${cookies ? cookies.length : 0}`);
|
||||
console.log(
|
||||
`Request erhalten - URL: ${url}, Cookies vorhanden: ${!!cookies}, Cookie-Länge: ${
|
||||
cookies ? cookies.length : 0
|
||||
}`
|
||||
);
|
||||
|
||||
if (!url || typeof url !== "string") {
|
||||
return new Response(
|
||||
@@ -65,7 +69,9 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
// Prüfe ob wichtige Cookies vorhanden sind
|
||||
const hasLoginInfo = fileContent.includes("LOGIN_INFO");
|
||||
const hasSID = fileContent.includes("SID");
|
||||
console.log(`Cookie-Prüfung - LOGIN_INFO: ${hasLoginInfo}, SID: ${hasSID}`);
|
||||
console.log(
|
||||
`Cookie-Prüfung - LOGIN_INFO: ${hasLoginInfo}, SID: ${hasSID}`
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
@@ -376,7 +382,10 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
const fileToDelete = tempCookiesFile;
|
||||
setTimeout(async () => {
|
||||
await unlink(fileToDelete).catch((err) => {
|
||||
console.error("Fehler beim Löschen der temporären Cookie-Datei:", err);
|
||||
console.error(
|
||||
"Fehler beim Löschen der temporären Cookie-Datei:",
|
||||
err
|
||||
);
|
||||
});
|
||||
}, 5000); // 5 Sekunden Verzögerung
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user