// Tiny HTML layer. No template engine: every string that reaches the page goes through esc(), // and the only dynamic markup is built from arrays. export const PREFIX = '/check'; export const ORIGIN = 'https://www.hoelee.com'; export function esc(value) { return String(value ?? '') .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } export function abs(path) { if (/^https?:\/\//.test(path)) return path; return `${ORIGIN}${PREFIX}${path.startsWith('/') ? path : `/${path}`}`; } const NAV = [ ['/spf-dkim-dmarc/', 'Email', 'spf-dkim-dmarc'], ['/ssl/', 'Certificate', 'ssl'], ['/headers/', 'Redirects & headers', 'headers'], ['/about/', 'How this works', 'about'] ]; export function layout({ title, description, body, active = '', robots = 'index,follow', canonical, extraHead = '' }) { const nav = NAV.map(([href, label, key]) => { const current = key === active ? ' aria-current="page"' : ''; return `${esc(label)}`; }).join(''); return ` ${esc(title)} ${extraHead}
Hoelee Check by Hoelee Enterprise
${body}
`; } export function badge(state, label) { const cls = state === 'not-evaluated' ? 'neutral' : state; return `${esc(label)}`; } export function form({ action = '/', value = '', label = 'Domain name', button = 'Run the check' }) { return `
`; } export function evidenceTable(rows) { if (!rows || rows.length === 0) return ''; const body = rows .map((r) => `${esc(r.label)}${r.html ? r.html : `${esc(r.value)}`}${r.note ? `
${esc(r.note)}
` : ''}`) .join(''); return `${body}
`; } export function findingList(findings) { if (!findings || findings.length === 0) return ''; return ``; } export function whatsappPreview(preview, host) { const image = preview && preview.image ? `` : 'No preview image found'; return `
How your link looks in WhatsApp
${image}
${esc((preview && preview.title) || host)}
${esc((preview && preview.description) || 'No description found — WhatsApp will show the bare link.')}
${esc(host.toUpperCase())}
`; }