mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-15 19:10:47 +02:00
Merge remote-tracking branch 'origin/main' into SaaS
# Conflicts: # frontend/editor/src/core/components/shared/AppConfigModal.tsx
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, test, beforeEach } from "vitest";
|
||||
import "fake-indexeddb/auto";
|
||||
import { expectConsole } from "@app/tests/failOnConsole";
|
||||
|
||||
import {
|
||||
DATABASE_CONFIGS,
|
||||
@@ -363,6 +364,9 @@ describe("IndexedDB migration (FILES store)", () => {
|
||||
});
|
||||
|
||||
test("SaaS v6 database is force-deleted (data lost, schema reset to v9)", async () => {
|
||||
// The force-delete warn IS the contract under test; production fires it
|
||||
// to surface why data was wiped.
|
||||
expectConsole.warn(/Deleting corrupt SaaS v6/);
|
||||
await seedSaasDatabase(6, ["v6-corrupt-file"]);
|
||||
|
||||
await indexedDBManager.openDatabase(DATABASE_CONFIGS.FILES);
|
||||
@@ -381,6 +385,9 @@ describe("IndexedDB migration (FILES store)", () => {
|
||||
});
|
||||
|
||||
test("SaaS v7 database is force-deleted (data lost, schema reset to v9)", async () => {
|
||||
// The force-delete warn IS the contract under test; production fires it
|
||||
// to surface why data was wiped.
|
||||
expectConsole.warn(/Deleting corrupt SaaS v7/);
|
||||
await seedSaasDatabase(7, ["v7-corrupt-file"]);
|
||||
|
||||
await indexedDBManager.openDatabase(DATABASE_CONFIGS.FILES);
|
||||
|
||||
@@ -2,22 +2,19 @@ import { BASE_PATH } from "@app/constants/app";
|
||||
import pdfiumWasmAssetUrl from "@embedpdf/pdfium/pdfium.wasm?url";
|
||||
|
||||
const getWasmUrl = (): string => {
|
||||
if (
|
||||
pdfiumWasmAssetUrl.startsWith("http://") ||
|
||||
pdfiumWasmAssetUrl.startsWith("https://") ||
|
||||
pdfiumWasmAssetUrl.startsWith("//")
|
||||
) {
|
||||
return pdfiumWasmAssetUrl;
|
||||
}
|
||||
|
||||
const origin = typeof window !== "undefined" ? window.location.origin : "";
|
||||
// In dev, Vite serves the statically-copied asset from the dev server root.
|
||||
if (import.meta.env.DEV) {
|
||||
const origin = typeof window !== "undefined" ? window.location.origin : "";
|
||||
return `${origin}${BASE_PATH}/pdfium/pdfium.wasm`;
|
||||
}
|
||||
const cleanAssetUrl = pdfiumWasmAssetUrl
|
||||
.replace(/^\.\//, "")
|
||||
.replace(/^\//, "");
|
||||
return `${origin}${BASE_PATH}/${cleanAssetUrl}`;
|
||||
|
||||
// Vite has already produced a base-aware asset URL (absolute under a relative
|
||||
// base, root-relative under an absolute base). Resolve it against the document
|
||||
// to get a fetchable absolute URL that is also safe to pass to Web Workers.
|
||||
if (typeof window !== "undefined") {
|
||||
return new URL(pdfiumWasmAssetUrl, window.location.href).href;
|
||||
}
|
||||
return pdfiumWasmAssetUrl;
|
||||
};
|
||||
|
||||
export const pdfiumWasmUrl = getWasmUrl();
|
||||
|
||||
Reference in New Issue
Block a user