Make Cobble a local install: setup flow, bots-first admin, settings

Local, password-only auth:
- No public pages; everything outside /admin and /auth redirects in
- First run (no users) sends every page to /auth/signup, which creates
  the super admin (user #1) once and then locks
- Login is email/username + password; removed the emailed-code flow,
  /auth/sso and email password reset
- Google login kept for existing accounts only, never creates them
- seed-super-admin now requires SEED_SUPER_ADMIN_PASSWORD

Bots-first admin:
- /admin and closed sections (people, logs, backups) redirect to
  /admin/bots; only bots and settings are live (AdminSections)
- Removed the old admin layout; every /admin page uses the bots rail
- Coordinator bot created at signup/seed and by /admin/bots
  (ensureCoordinatorBot), which redirects to its chat
- bots.system_prompt (markdown) with a default coordinator prompt
- seed-bots reuses the existing coordinator

Settings:
- Sub pages general (default), profile, change-password, listed in the
  rail with a back link; unknown settings paths redirect to general
- Redesigned settings UI: pane header, grouped rows, sticky save bar
- General: System/Light/Dark theme, saved per device

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-18 17:49:25 +01:00
co-authored by Claude Opus 5.5
parent 3286b80029
commit 694c83346f
159 changed files with 1891 additions and 2964 deletions
+3 -10
View File
@@ -4,16 +4,12 @@ import Row from "@moduletrace/twui/layout/Row";
import Span from "@moduletrace/twui/layout/Span";
import type useFormInit from "@/src/hooks/use-form-init";
import { twMerge } from "tailwind-merge";
import useGoogleAuth, {
type GoogleAuthMode,
} from "@/src/hooks/use-google-auth";
import useGoogleAuth from "@/src/hooks/use-google-auth";
type Props = Pick<
ReturnType<typeof useFormInit>,
"loading" | "setLoading" | "setStatus"
> & {
mode: GoogleAuthMode;
};
>;
/**
* Themed button with Google's own (transparent) button laid over it. Once
@@ -21,21 +17,18 @@ type Props = Pick<
* themed button below is hidden from assistive tech.
*/
export default function GoogleAuthButton({
mode,
loading,
setLoading,
setStatus,
}: Props) {
const { handleButtonClick, googleButtonRef, googleReady } = useGoogleAuth({
mode,
loading,
setLoading,
setStatus,
});
const overlayActive = googleReady && !loading;
const label =
mode == "signup" ? "Sign up with Google" : "Log in with Google";
const label = "Log in with Google";
return (
<Row className="w-full relative justify-center rounded-default focus-within:ring-2 focus-within:ring-primary/70">
@@ -1,26 +0,0 @@
import Input from "@moduletrace/twui/form/Input";
type Props = {
onCodeChange: (code: string) => void;
};
export default function LoginCodeInput({ onCodeChange }: Props) {
return (
<Input
id="code"
name="code"
type="text"
label="Code"
placeholder="123456"
inputMode="numeric"
autoComplete="one-time-code"
maxLength={6}
autoFocus
onChange={(e) => {
onCodeChange(e.target.value);
}}
showLabel
required
/>
);
}
@@ -1,34 +0,0 @@
import Button from "@moduletrace/twui/layout/Button";
import Row from "@moduletrace/twui/layout/Row";
import Span from "@moduletrace/twui/layout/Span";
import type useFormInit from "@/src/hooks/use-form-init";
import resendLoginCode from "@/src/functions/frontend/resend-login-code";
type Props = Pick<
ReturnType<typeof useFormInit>,
"loading" | "setLoading" | "setStatus"
>;
export default function ResendCodeButton({
loading,
setLoading,
setStatus,
}: Props) {
return (
<Row className="w-full justify-center gap-1.5 text-sm">
<Span variant="faded">Didn't get a code?</Span>
<Button
title="Resend code"
type="button"
variant="ghost"
size="small"
loading={loading}
onClick={() => {
resendLoginCode({ setLoading, setStatus });
}}
>
Resend code
</Button>
</Row>
);
}
+3 -1
View File
@@ -1,3 +1,5 @@
import { AppData } from "@/src/data/app-data";
/**
* Applies the saved color scheme to `<html>` before first paint, so pages
* never flash light before twui's `ColorSchemeSelector` mounts. Mirrors the
@@ -5,7 +7,7 @@
*/
const ThemeInitScriptSource = `(function () {
try {
var theme = localStorage.getItem("theme");
var theme = localStorage.getItem("${AppData["ThemeStorageKey"]}");
if (theme !== "dark" && theme !== "light") {
theme = window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"