From 53bebc01199efca07b1bc43417b85dd8d862fb80 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Sat, 14 Feb 2026 15:41:22 +0000 Subject: [PATCH] fix: BUG-006 copy feedback, BUG-008 white border CSS reset, BUG-010 CORS allow all origins --- public/app.js | 5 +++-- src/index.ts | 7 ++----- src/services/browser.ts | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/public/app.js b/public/app.js index ada81b1..b38505d 100644 --- a/public/app.js +++ b/public/app.js @@ -66,8 +66,9 @@ async function submitSignup() { function copyKey() { var key = document.getElementById('apiKeyDisplay').textContent; navigator.clipboard.writeText(key).then(function() { - var btn = document.getElementById('apiKeyDisplay'); var origText = btn.textContent; btn.textContent = 'Copied!'; document.querySelector('.copy-hint').textContent = '✓ Copied!'; - setTimeout(function() { btn.textContent = origText; document.querySelector('.copy-hint').textContent = 'Click to copy'; }, 2000); + var hint = document.querySelector('.copy-hint'); + hint.textContent = '✓ Copied!'; + setTimeout(function() { hint.textContent = 'Click to copy'; }, 2000); }); } diff --git a/src/index.ts b/src/index.ts index 67991c2..b519862 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,11 +24,8 @@ app.use(helmet({ crossOriginResourcePolicy: { policy: "cross-origin" } })); // CORS — allow browser requests from the landing page app.use((req, res, next) => { - const origin = req.headers.origin; - const allowed = ["https://docfast.dev", "http://localhost:3100"]; - if (origin && allowed.includes(origin)) { - res.setHeader("Access-Control-Allow-Origin", origin); - } + // Allow all origins — public API + res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS"); res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, X-API-Key"); res.setHeader("Access-Control-Max-Age", "86400"); diff --git a/src/services/browser.ts b/src/services/browser.ts index 0f2efb4..c33b2c1 100644 --- a/src/services/browser.ts +++ b/src/services/browser.ts @@ -33,6 +33,7 @@ export async function renderPdf( const page: Page = await browser.newPage(); try { await page.setContent(html, { waitUntil: "networkidle0", timeout: 15_000 }); + await page.addStyleTag({ content: "* { margin: 0; padding: 0; } body { margin: 0; }" }); const pdf = await page.pdf({ format: (options.format as any) || "A4",