first commit

This commit is contained in:
2025-10-03 23:32:36 +08:00
commit 7b07ab6bf2
399 changed files with 162224 additions and 0 deletions

21
viewer-boot.js Normal file
View File

@@ -0,0 +1,21 @@
import { PDFViewerApplication } from './viewer.mjs';
(async function () {
const params = new URLSearchParams(location.search);
const src = params.get('src');
if (!src) return;
const resp = await browser.runtime.sendMessage({ type: "fetch-pdf", url: src });
if (resp.error) {
document.body.innerText = "Failed to fetch PDF: " + resp.error;
return;
}
const blobUrl = resp.blobUrl;
console.log("Custom viewer: got blob URL", blobUrl);
// Redirect with ?file= so that viewer.js bootstraps it natively
const newUrl = location.origin + location.pathname + "?file=" + encodeURIComponent(blobUrl) + "&original_url=" + src
location.replace(newUrl)
})();