fix: BUG-006 copy feedback, BUG-008 white border CSS reset, BUG-010 CORS allow all origins
This commit is contained in:
parent
d8bc3fd8e6
commit
53bebc0119
3 changed files with 6 additions and 7 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue