diff --git a/public/copy-helper.js b/public/copy-helper.js new file mode 100644 index 0000000..069be51 --- /dev/null +++ b/public/copy-helper.js @@ -0,0 +1,38 @@ +// Copy helper for server-rendered pages +// Attaches click handlers to all [data-copy] elements (CSP-compliant) + +document.addEventListener('DOMContentLoaded', function() { + // Handle buttons with data-copy attribute + document.querySelectorAll('button[data-copy]').forEach(function(btn) { + btn.addEventListener('click', function() { + const textToCopy = this.getAttribute('data-copy'); + const originalText = this.textContent; + + navigator.clipboard.writeText(textToCopy).then(function() { + btn.textContent = 'Copied!'; + setTimeout(function() { + btn.textContent = originalText; + }, 1500); + }).catch(function(err) { + console.error('Copy failed:', err); + }); + }); + }); + + // Handle clickable divs with data-copy attribute (for key-box) + document.querySelectorAll('div[data-copy]').forEach(function(div) { + div.style.cursor = 'pointer'; + div.addEventListener('click', function() { + const textToCopy = this.getAttribute('data-copy'); + + navigator.clipboard.writeText(textToCopy).then(function() { + div.style.borderColor = '#5eead4'; + setTimeout(function() { + div.style.borderColor = '#34d399'; + }, 1500); + }).catch(function(err) { + console.error('Copy failed:', err); + }); + }); + }); +}); diff --git a/public/index.html b/public/index.html index 0d7c5a6..94fd4f6 100644 --- a/public/index.html +++ b/public/index.html @@ -57,10 +57,10 @@ }, { "@type": "Question", - "name": "Do you have official SDKs?", + "name": "Do you have SDKs for Node.js and Python?", "acceptedAnswer": { "@type": "Answer", - "text": "Yes, DocFast provides official SDKs for Node.js, Python, Go, PHP, and Laravel. You can also use the REST API directly with curl or any HTTP client." + "text": "Yes, DocFast provides official SDKs for both Node.js and Python. You can also use the REST API directly with curl or any HTTP client in your preferred language." } } ] @@ -450,7 +450,7 @@ html, body {

Everything you need

-

Official SDKs for Node.js, Python, Go, PHP, and Laravel. Or just use curl.

+

Official SDKs for Node.js and Python. Or just use curl.

@@ -627,7 +627,7 @@ html, body {
- +

Read the docs →

diff --git a/src/index.ts b/src/index.ts index 5b0b284..d0c683d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -204,10 +204,12 @@ p{color:#7a8194;margin-bottom:24px;line-height:1.6}

${message}

${apiKey ? `
⚠️ Save your API key securely. You can recover it via email if needed.
-
${apiKey}
+
${apiKey}
` : ``} -
`; + + +`; } // Landing page diff --git a/src/routes/billing.ts b/src/routes/billing.ts index f99e82d..4e9c94a 100644 --- a/src/routes/billing.ts +++ b/src/routes/billing.ts @@ -178,11 +178,13 @@ a { color: #4f9; }

🎉 Welcome to Pro!

Your API key:

-
${escapeHtml(keyInfo.key)}
+
${escapeHtml(keyInfo.key)}

Save this key! It won't be shown again.

5,000 PDFs/month • All endpoints • Priority support

View API docs →

-
`); + + +`); } catch (err: any) { logger.error({ err }, "Success page error"); res.status(500).json({ error: "Failed to retrieve session" }); diff --git a/templates/pages/index.html b/templates/pages/index.html index 94f9269..a2c588b 100644 --- a/templates/pages/index.html +++ b/templates/pages/index.html @@ -614,7 +614,7 @@ html, body {
- +

Read the docs →