diff --git a/src/lib/clean-pdf/__tests__/zotero-script.test.ts b/src/lib/clean-pdf/__tests__/zotero-script.test.ts index 22ca45f..8910d00 100644 --- a/src/lib/clean-pdf/__tests__/zotero-script.test.ts +++ b/src/lib/clean-pdf/__tests__/zotero-script.test.ts @@ -9,4 +9,9 @@ describe("buildZoteroScript", () => { expect(s).toContain("/api/pdf?url="); expect(s).not.toContain("YOUR_KEY"); }); + + it("генерирует синтаксически валидный JS", () => { + const s = buildZoteroScript({ apiKey: "sbpdf_test123", baseUrl: "https://school.second-brain.ru" }); + expect(() => new Function(s)).not.toThrow(); + }); }); diff --git a/src/lib/clean-pdf/zotero-script.ts b/src/lib/clean-pdf/zotero-script.ts index bac113b..f8c0464 100644 --- a/src/lib/clean-pdf/zotero-script.ts +++ b/src/lib/clean-pdf/zotero-script.ts @@ -1,7 +1,7 @@ // Адаптация скрипта Clean PDF (pdf.brainysnipe.ru/zotero-script.js) под школу. export function buildZoteroScript({ apiKey, baseUrl }: { apiKey: string; baseUrl: string }): string { return `// ── Настройки ────────────────────────────────────────────────────────────── -const API_KEY = '${apiKey}'; // персональный ключ из school.second-brain.ru/tools/clean-pdf +const API_KEY = '${apiKey}'; // персональный ключ из ${baseUrl}/tools/clean-pdf const SERVICE_URL = '${baseUrl}'; const FORMAT = 'A4'; // 'A4' или 'Letter' const THEME = 'light'; // 'light' или 'dark'