Skip to content

Commit

Permalink
Remove function that saves intermediate MHTMLs for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jrockwar committed Nov 23, 2024
1 parent 98bc967 commit 443bcf0
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,6 @@ import { getTab } from "./status";
import { upload } from "./upload";
import { safeFilename, sleep } from "./utils";

async function saveMHTMLForDebug(
tabId: number,
data: ArrayBuffer,
prefix: string = 'debug'
): Promise<void> {
console.log('[debug] Saving MHTML for inspection');
const blob = new Blob([data], { type: "message/rfc822" });
const url = URL.createObjectURL(blob);
try {
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
await browser.downloads.download({
url,
filename: `${prefix}_${timestamp}.mhtml`,
saveAs: false,
});
console.log('[debug] MHTML saved successfully');
} finally {
URL.revokeObjectURL(url);
}
}

/**
* create and upload epub
*/
Expand All @@ -47,9 +26,6 @@ async function rePub(tabId: number) {
await tab.progress(50);
console.log('[background] Page captured successfully');

// Save MHTML for debugging
await saveMHTMLForDebug(tabId, mhtml, 'before_render');

console.log('[background] Starting render');
const { epub, title = "missing title" } = await render(mhtml, opts);
await tab.progress(75);
Expand Down

0 comments on commit 443bcf0

Please sign in to comment.