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
|
|
@ -66,8 +66,9 @@ async function submitSignup() {
|
||||||
function copyKey() {
|
function copyKey() {
|
||||||
var key = document.getElementById('apiKeyDisplay').textContent;
|
var key = document.getElementById('apiKeyDisplay').textContent;
|
||||||
navigator.clipboard.writeText(key).then(function() {
|
navigator.clipboard.writeText(key).then(function() {
|
||||||
var btn = document.getElementById('apiKeyDisplay'); var origText = btn.textContent; btn.textContent = 'Copied!'; document.querySelector('.copy-hint').textContent = '✓ Copied!';
|
var hint = document.querySelector('.copy-hint');
|
||||||
setTimeout(function() { btn.textContent = origText; document.querySelector('.copy-hint').textContent = 'Click to copy'; }, 2000);
|
hint.textContent = '✓ Copied!';
|
||||||
|
setTimeout(function() { hint.textContent = 'Click to copy'; }, 2000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,8 @@ app.use(helmet({ crossOriginResourcePolicy: { policy: "cross-origin" } }));
|
||||||
|
|
||||||
// CORS — allow browser requests from the landing page
|
// CORS — allow browser requests from the landing page
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
const origin = req.headers.origin;
|
// Allow all origins — public API
|
||||||
const allowed = ["https://docfast.dev", "http://localhost:3100"];
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
if (origin && allowed.includes(origin)) {
|
|
||||||
res.setHeader("Access-Control-Allow-Origin", origin);
|
|
||||||
}
|
|
||||||
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
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-Allow-Headers", "Content-Type, Authorization, X-API-Key");
|
||||||
res.setHeader("Access-Control-Max-Age", "86400");
|
res.setHeader("Access-Control-Max-Age", "86400");
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ export async function renderPdf(
|
||||||
const page: Page = await browser.newPage();
|
const page: Page = await browser.newPage();
|
||||||
try {
|
try {
|
||||||
await page.setContent(html, { waitUntil: "networkidle0", timeout: 15_000 });
|
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({
|
const pdf = await page.pdf({
|
||||||
format: (options.format as any) || "A4",
|
format: (options.format as any) || "A4",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue