fix: broken links on logicsrc.com and the WebAuthn bundle 500 on app.logicsrc.com (#242)

* fix(web): broken doc links and missing OpenI18n/OpenL10n landings

ThreatCrush Link Watch found 14 dead links on logicsrc.com:

- /docs/opencreds linked its sub-documents and sibling specs as relative
  Markdown files (./opencreds/spec.md, ./credential-sharing.md), which
  resolved to /docs/*.md URLs the site never serves. Rendered docs now map
  a link to a served doc to /docs/<slug> and anything else to the file in
  the public repository; redirects keep the already-crawled .md URLs working.
- OpenI18n and OpenL10n were registered with a /<slug> landing that has no
  page, so the sidebar and family grids linked /openi18n and /openl10n.
  They now have no landing (link to their docs), and the old paths redirect.

A contract test checks that no rendered doc keeps a relative .md link, that
every repository target exists, and that every spec landing has a page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(pwa): serve the WebAuthn bundle from the hoisted install

/vendor/simplewebauthn-browser.umd.js joined apps/pwa/node_modules onto the
path, but the workspace install hoists @simplewebauthn/browser to the repo
root, so every sign-in and settings page loaded a 500 (ENOENT) and passkeys
could not work. Resolve the package like the libsodium vendor routes do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-10-17 11:59:41 -07:00 • committed by GitHub
parent e3111dec39
commit 159ae20be1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 107 additions and 9 deletions

View file

@ -3,7 +3,7 @@ import { notFound } from "next/navigation";
import type { ReactNode } from "react";
import type { Metadata } from "next";
import { marked } from "marked";
import { DOC_SLUGS, docExcerpt, docSubtitle, docTitle, readDoc } from "@/lib/docs";
import { DOC_SLUGS, docExcerpt, docSubtitle, docTitle, readDoc, resolveDocLinks } from "@/lib/docs";
import { composeTitle, contentMetadata, notFoundMetadata } from "@/lib/page-meta";
import { SiteShell } from "@/components/site-shell";
import { sanitizeRenderedHtml } from "@/lib/html";
@ -46,7 +46,7 @@ export default async function DocPage({
if (!md) notFound();
const rawHtml = await marked.parse(md);
const html = sanitizeRenderedHtml(rawHtml);
const html = resolveDocLinks(sanitizeRenderedHtml(rawHtml));
return (
<SiteShell active="Docs" crumbTitle={docTitle(md, slug)}>

View file

@ -123,3 +123,34 @@ export function listDocs(): DocSummary[] {
}
return out;
}
const REPO_BLOB = "https://github.com/profullstack/logicsrc/blob/master";
/**
* Point a doc's relative Markdown links somewhere that exists.
*
* The docs link each other the way they read on GitHub: `./opencreds/spec.md`,
* `credential-sharing.md`, `../prd/0001-....md`. Rendered at /docs/<slug> those
* resolve to /docs/credential-sharing.md and /docs/opencreds/spec.md, which the
* site never serves, so every one was a 404. A link to a doc the site serves
* becomes /docs/<slug>; anything else (sub-documents, PRDs) goes to the file in
* the public repository, which is where it is published.
*/
export function resolveDocLinks(html: string): string {
return html.replace(/href="([^"]+)"/g, (whole, href: string) => {
if (/^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("/") || href.startsWith("#")) return whole;
const [path, fragment] = href.split("#", 2);
if (!path.endsWith(".md")) return whole;
const parts: string[] = ["docs"];
for (const seg of path.split("/")) {
if (seg === "" || seg === ".") continue;
if (seg === "..") parts.pop();
else parts.push(seg);
}
const hash = fragment ? `#${fragment}` : "";
const repoPath = parts.join("/");
const served = /^docs\/([^/]+)\.md$/.exec(repoPath);
if (served && isDocSlug(served[1])) return `href="/docs/${served[1]}${hash}"`;
return `href="${REPO_BLOB}/${repoPath}${hash}"`;
});
}

View file

@ -109,8 +109,8 @@ export const FAMILIES: Family[] = [
s("openstack", "OpenStack.md", "One Markdown file a project serves about what it is built on: every interface and its layers, the rules, what it must never depend on, inherited by the next project through Extends"),
s("openwebring", "OpenWebring", "A webring that says who made it: one file a ring serves about its members, one a member serves about itself, and made_by on every member"),
s("openwiki", "OpenWiki", "A wiki that is a folder of Markdown files: [[Page]] links, a small front matter, a descriptor and a page index, every page and revision readable as Markdown, and made_by on every revision"),
s("openl10n", "OpenL10n", "The record of what a file says, in any language: one transcript per media per language, kept once, translations beside the original", { parent: "openfile" }),
s("openi18n", "OpenI18n", "One file a service serves about the languages it speaks, which it can turn into which, how to ask for one, and where texts are translated")
s("openl10n", "OpenL10n", "The record of what a file says, in any language: one transcript per media per language, kept once, translations beside the original", { parent: "openfile", landing: undefined }),
s("openi18n", "OpenI18n", "One file a service serves about the languages it speaks, which it can turn into which, how to ask for one, and where texts are translated", { landing: undefined })
]
},
{