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 body = await request.json();
|
||||||
const { url, cookies } = body;
|
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") {
|
if (!url || typeof url !== "string") {
|
||||||
return new Response(
|
return new Response(
|
||||||
@@ -65,7 +69,9 @@ export const POST: APIRoute = async ({ request }) => {
|
|||||||
// Prüfe ob wichtige Cookies vorhanden sind
|
// Prüfe ob wichtige Cookies vorhanden sind
|
||||||
const hasLoginInfo = fileContent.includes("LOGIN_INFO");
|
const hasLoginInfo = fileContent.includes("LOGIN_INFO");
|
||||||
const hasSID = fileContent.includes("SID");
|
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) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
@@ -376,7 +382,10 @@ export const POST: APIRoute = async ({ request }) => {
|
|||||||
const fileToDelete = tempCookiesFile;
|
const fileToDelete = tempCookiesFile;
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await unlink(fileToDelete).catch((err) => {
|
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
|
}, 5000); // 5 Sekunden Verzögerung
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user