hoelee-check: v1 skeleton — net-guard, cache, ratelimit, router, pages, three checks
Zero-dependency Node service mounted at www.hoelee.com/check/. net-guard pins the resolved IP, re-validates every redirect hop, and refuses private ranges; the certificate is read off the same socket as the request. Pages: hub, certificate, email auth, redirects/preview, about, report. Argon review applied: optional-hardening wording, DKIM/SHA-1 root rules, neutral not-evaluated, cache-before-scan, single-connection TLS.
This commit is contained in:
commit
b2707f49f7
19 files changed
+4722
No files matched your search
@@ -0,0 +1,108 @@
|
||||
// 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, '"')
|
||||
.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 `<a href="${esc(PREFIX + href)}"${current}>${esc(label)}</a>`;
|
||||
}).join('');
|
||||
|
||||
return `<!doctype html>
|
||||
<html lang="en-MY">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>${esc(title)}</title>
|
||||
<meta name="description" content="${esc(description)}">
|
||||
<meta name="robots" content="${esc(robots)}">
|
||||
<link rel="canonical" href="${esc(canonical || abs('/'))}">
|
||||
<link rel="stylesheet" href="${esc(PREFIX)}/assets/style.css">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="${esc(title)}">
|
||||
<meta property="og:description" content="${esc(description)}">
|
||||
<meta property="og:url" content="${esc(canonical || abs('/'))}">
|
||||
${extraHead}
|
||||
</head>
|
||||
<body>
|
||||
<header class="site"><div class="wrap">
|
||||
<a class="brand" href="${esc(PREFIX)}/">Hoelee Check <span>by Hoelee Enterprise</span></a>
|
||||
<nav>${nav}</nav>
|
||||
</div></header>
|
||||
<main><div class="wrap">
|
||||
${body}
|
||||
</div></main>
|
||||
<footer class="site"><div class="wrap">
|
||||
<p>Built and hosted by <a href="https://www.hoelee.com/">Hoelee Enterprise</a>, Perak, Malaysia.
|
||||
No trackers, no cookies, no account. Every check reads only what the public internet can already see.</p>
|
||||
<p><a href="${esc(PREFIX)}/about/">What this service queries, and what it refuses to do</a></p>
|
||||
</div></footer>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
}
|
||||
|
||||
export function badge(state, label) {
|
||||
const cls = state === 'not-evaluated' ? 'neutral' : state;
|
||||
return `<span class="badge ${esc(cls)}">${esc(label)}</span>`;
|
||||
}
|
||||
|
||||
export function form({ action = '/', value = '', label = 'Domain name', button = 'Run the check' }) {
|
||||
return `<form class="check" method="get" action="${esc(PREFIX + action)}">
|
||||
<label class="sr" for="d" hidden>${esc(label)}</label>
|
||||
<input id="d" name="d" type="text" inputmode="url" autocomplete="off" spellcheck="false"
|
||||
placeholder="yourbusiness.com.my" value="${esc(value)}" required>
|
||||
<button type="submit">${esc(button)}</button>
|
||||
</form>`;
|
||||
}
|
||||
|
||||
export function evidenceTable(rows) {
|
||||
if (!rows || rows.length === 0) return '';
|
||||
const body = rows
|
||||
.map((r) => `<tr><th scope="row">${esc(r.label)}</th><td>${r.html ? r.html : `<span class="mono">${esc(r.value)}</span>`}${r.note ? `<div class="faint">${esc(r.note)}</div>` : ''}</td></tr>`)
|
||||
.join('');
|
||||
return `<table class="evidence">${body}</table>`;
|
||||
}
|
||||
|
||||
export function findingList(findings) {
|
||||
if (!findings || findings.length === 0) return '';
|
||||
return `<ul class="findings">${findings
|
||||
.map((f) => `<li class="${esc(f.level)}">${esc(f.message)}${f.fix ? `<span class="fix">${esc(f.fix)}</span>` : ''}</li>`)
|
||||
.join('')}</ul>`;
|
||||
}
|
||||
|
||||
export function whatsappPreview(preview, host) {
|
||||
const image = preview && preview.image
|
||||
? `<img src="${esc(preview.image)}" alt="" referrerpolicy="no-referrer" loading="lazy">`
|
||||
: 'No preview image found';
|
||||
return `<div class="wa">
|
||||
<div class="wa-label">How your link looks in WhatsApp</div>
|
||||
<div class="wa-img">${image}</div>
|
||||
<div class="wa-title">${esc((preview && preview.title) || host)}</div>
|
||||
<div class="wa-desc">${esc((preview && preview.description) || 'No description found — WhatsApp will show the bare link.')}</div>
|
||||
<div class="wa-url">${esc(host.toUpperCase())}</div>
|
||||
</div>`;
|
||||
}
|
||||
Reference in new issue
Block a user