caelum0x a017d0bc60 feat(console): Rithub self-serve provisioning + public landing page
Closes backlog item 4: Rithub (apps/gitea, live at git.ereboslab.com) had
zero discovery or signup surface. A signed-in Console session now
provisions a dedicated Gitea user, private org and first repo in one call
(lib/gitea.ts, admin API with sudo= impersonation), via a new public
/rithub landing page and POST /api/v1/rithub/provision route. Signed out,
the CTA goes through the same cross-sell sign-in bridge as items 1/2;
signed in, it closes the loop item 5's OIDC provider opened ("one sign-in,
not a second account").

Verified against a real gitea/gitea:1.23 container: user/org/repo creation,
sudo impersonation, slug-collision retries and the route's idempotency
check all confirmed live. tsc clean, npm test 167/167, npm run test:bundle
3/3 (including a full client build).
2026-10-24 00:45:01 +03:00

49 lines
1.8 KiB
TypeScript

"use client";
import { usePathname } from "next/navigation";
import { SignOutIcon } from "./Icons.tsx";
const LINKS = [
{ href: "/apps", label: "Apps" },
{ href: "/insights", label: "Insights" },
{ href: "/flags", label: "Flags" },
{ href: "/product-analytics", label: "Product analytics" },
{ href: "/usage", label: "Usage" },
{ href: "/billing", label: "Billing" },
];
/**
* `watch` adds the Watch screen once RAILYARD_WATCH_LIVE is on (PY2.2).
* `gitUrl` is always shown as an external "Code" link. It defaults to
* Rithub (apps/gitea), Railyard's self-hosted git forge, live at
* https://git.ereboslab.com since 2026-10-19 -- see Config.gitUrl's doc
* comment in lib/config.ts. It is a plain outbound link for an account that
* already exists (Console is now a real OIDC provider for Rithub -- see
* apps/gitea/README.md "SSO" -- so a visitor without one yet goes through
* `/rithub` instead, which provisions a Gitea org + first repo, backlog
* item 4).
*/
export function Nav({ watch = false, gitUrl }: { watch?: boolean; gitUrl?: string }) {
const path = usePathname();
const links = watch ? [...LINKS.slice(0, 3), { href: "/watch", label: "Watch" }, ...LINKS.slice(3)] : LINKS;
return (
<nav className="nav" aria-label="Main">
<div className="brand">Railyard</div>
{links.map((l) => (
<a key={l.href} href={l.href} aria-current={path?.startsWith(l.href) ? "page" : undefined}>
{l.label}
</a>
))}
{gitUrl && (
<a href={gitUrl} target="_blank" rel="noopener noreferrer">
Code
</a>
)}
<form method="post" action="/auth/signout" style={{ marginTop: "auto" }}>
<button className="icon" type="submit" aria-label="Sign out" title="Sign out">
<SignOutIcon />
</button>
</form>
</nav>
);
}