mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 17:24:48 +00:00
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:
parent
e3111dec39
commit
159ae20be1
6 changed files with 107 additions and 9 deletions
47
apps/logicsrc-web/contract/doc-links.contract.test.ts
Normal file
47
apps/logicsrc-web/contract/doc-links.contract.test.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { existsSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { marked } from "marked";
|
||||
|
||||
import { DOC_SLUGS, readDoc, resolveDocLinks } from "@/lib/docs";
|
||||
import { allSpecs } from "@/lib/specs";
|
||||
|
||||
// A crawler found /docs/opencreds linking /docs/opencreds/spec.md and
|
||||
// /docs/credential-sharing.md (both 404) and the sidebar linking /openi18n and
|
||||
// /openl10n, which have no landing page.
|
||||
describe("doc links", () => {
|
||||
it("maps a served doc to /docs/<slug> and anything else to the repository", () => {
|
||||
const html = resolveDocLinks(
|
||||
'<a href="./credential-sharing.md">a</a><a href="./opencreds/spec.md#x">b</a>' +
|
||||
'<a href="../prd/0001-x.md">c</a><a href="https://example.com/x.md">d</a><a href="#top">e</a>'
|
||||
);
|
||||
expect(html).toContain('href="/docs/credential-sharing"');
|
||||
expect(html).toContain('href="https://github.com/profullstack/logicsrc/blob/master/docs/opencreds/spec.md#x"');
|
||||
expect(html).toContain('href="https://github.com/profullstack/logicsrc/blob/master/prd/0001-x.md"');
|
||||
expect(html).toContain('href="https://example.com/x.md"');
|
||||
expect(html).toContain('href="#top"');
|
||||
});
|
||||
|
||||
it("leaves no rendered doc with a relative .md link, and every repository target exists", async () => {
|
||||
const repo = resolve(process.cwd(), "../..");
|
||||
for (const slug of DOC_SLUGS) {
|
||||
const md = readDoc(slug);
|
||||
if (!md) continue;
|
||||
const html = resolveDocLinks(await marked.parse(md));
|
||||
for (const [, href] of html.matchAll(/href="([^"]+)"/g)) {
|
||||
expect(/^(?!https?:|\/|#|mailto:).*\.md(#|$)/.test(href), `${slug}: ${href}`).toBe(false);
|
||||
const blob = /^https:\/\/github\.com\/profullstack\/logicsrc\/blob\/master\/([^#]+)/.exec(href);
|
||||
if (blob) expect(existsSync(resolve(repo, blob[1])), `${slug}: ${href}`).toBe(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("gives every spec landing a page", () => {
|
||||
const catchAll = new Set(["openspec", "credential-sharing", "agentbyte"]);
|
||||
for (const spec of allSpecs()) {
|
||||
if (!spec.landing) continue;
|
||||
const seg = spec.landing.replace(/^\//, "");
|
||||
expect(existsSync(resolve(process.cwd(), "src/app", seg)) || catchAll.has(seg), spec.landing).toBe(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue