feat: INS landing page with lead form

Page sends document.referrer in the lead body; the request Referer
header only ever holds the landing page URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-01 10:37:35 +08:00
1 parent 32c0d835cd
commit d71ba850e8
5 files changed
+343 -5

No files matched your search

+3 -3
View File
@@ -5,8 +5,8 @@ const { DatabaseSync } = require('node:sqlite');
const MAX_BODY = 10 * 1024;
const REQUIRED = ['name', 'email', 'phone', 'company'];
const OPTIONAL = ['industry', 'message', 'utm_source', 'utm_medium', 'utm_campaign'];
const MAX_LEN = { message: 2000 };
const OPTIONAL = ['industry', 'message', 'referrer', 'utm_source', 'utm_medium', 'utm_campaign'];
const MAX_LEN = { message: 2000, referrer: 500 };
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const INDEX = path.join(__dirname, 'public', 'index.html');
const STATIC = { '/logo.png': ['logo.png', 'image/png'] };
@@ -89,7 +89,7 @@ function createServer(dbPath) {
try {
const t = (f) => (lead[f] ? lead[f].trim() : null);
insert.run(t('name'), t('email'), t('phone'), t('company'), t('industry'), t('message'),
(req.headers.referer || '').slice(0, 500) || null, t('utm_source'), t('utm_medium'), t('utm_campaign'));
t('referrer'), t('utm_source'), t('utm_medium'), t('utm_campaign'));
} catch (e) {
console.error('lead insert failed:', e.message);
return send(res, 500, { error: 'Could not save, please try again' });