Harden CMS security, fix SEO/a11y gaps, and fill in missing article images
CI / build (push) Has been cancelled

Server: refuse to start in production with the default admin password,
drop SVG from the upload allow-list (stored-XSS risk), add baseline
security headers, make the login rate limiter proxy-aware via TRUST_PROXY,
and auto-load .env.local/.env in dev.

Admin: sanitise post bodies on content import/snapshot restore (previously
bypassed sanitiseBody), confirm before discarding a draft, drop back to the
login screen on a mid-session 401 instead of a stuck error, add hero-image
alt text and a title/excerpt search to the articles panel.

Site: replace the soft-404-to-homepage fallback with a real noindex 404
page, add a focus trap/Escape handling/aria-modal to the enquiry modal,
aria-expanded on the mobile nav toggle, ItemList/breadcrumb structured data
for the newsroom and articles, and wire sitemap generation into the build
so it can't go stale. Extract the duplicated NewsGrid/ArticlePage card
markup into a shared PostCard component.

Content: 13 of 18 seed articles shipped with no hero image (one pointed at
a dead WordPress URL); the live blackdice.ai site turned out to still be
the old blackdice-studio.html export, so recovering the originals wasn't
feasible. Filled the gap with freely-licensed Unsplash placeholders,
credited in the author field, until real photography is ready.

Also adds a Gitea Actions CI workflow (typecheck + build).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 13:54:38 +05:00
co-authored by Claude Sonnet 5
parent 410463e0ed
commit f02461b456
35 changed files with 477 additions and 146 deletions
+47 -1
View File
@@ -201,7 +201,10 @@ function goHome() {
function toggleMob() {
var mob = document.getElementById("mob-nav");
if (!mob) return;
mob.style.display = mob.style.display === "none" ? "block" : "none";
var opening = mob.style.display === "none";
mob.style.display = opening ? "block" : "none";
var ham = document.querySelector(".bd-ham");
if (ham) ham.setAttribute("aria-expanded", opening ? "true" : "false");
}
// ── Scroll ─────────────────────────────────────────────────────────────────
@@ -225,6 +228,40 @@ function scrollDown() {
}
// ── Demo modal ─────────────────────────────────────────────────────────────
// A modal needs to trap focus and close on Escape to be usable by keyboard
// and screen-reader visitors — otherwise Tab can walk out into the hidden
// page behind it, with no keyboard way back in or out.
var __bdModalLastFocus = null;
function __bdModalFocusables() {
var box = document.querySelector("#modal-ov .modal-box");
if (!box) return [];
return Array.prototype.filter.call(
box.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),
function (el) { return !el.disabled && el.offsetParent !== null; },
);
}
function __bdModalKeydown(e) {
if (e.key === "Escape" || e.key === "Esc") {
e.preventDefault();
closeDemo();
return;
}
if (e.key !== "Tab") return;
var focusables = __bdModalFocusables();
if (!focusables.length) return;
var first = focusables[0];
var last = focusables[focusables.length - 1];
if (e.shiftKey && document.activeElement === first) {
e.preventDefault();
last.focus();
} else if (!e.shiftKey && document.activeElement === last) {
e.preventDefault();
first.focus();
}
}
function showDemo() {
var ov = document.getElementById("modal-ov");
@@ -235,11 +272,19 @@ function showDemo() {
if (form) form.style.display = "block";
if (sent) sent.style.display = "none";
if (err) err.style.display = "none";
__bdModalLastFocus = document.activeElement;
document.addEventListener("keydown", __bdModalKeydown, true);
var focusables = __bdModalFocusables();
if (focusables.length) focusables[0].focus();
}
function closeDemo() {
var ov = document.getElementById("modal-ov");
if (ov) ov.style.display = "none";
document.removeEventListener("keydown", __bdModalKeydown, true);
if (__bdModalLastFocus && typeof __bdModalLastFocus.focus === "function") __bdModalLastFocus.focus();
__bdModalLastFocus = null;
}
function closeBg(e) {
@@ -457,4 +502,5 @@ export function initSite(startPage) {
export function teardownSite() {
window.removeEventListener('scroll', onScroll);
if (__bdFeedTimer) { clearInterval(__bdFeedTimer); __bdFeedTimer = null; }
document.removeEventListener('keydown', __bdModalKeydown, true);
}