feat: Settings → Diagnostics, a consented log level and the tab's own log
A user can raise their diagnostics level to Részletes (DEBUG) or Teljes (TRACE) for 24 hours from a new Settings tab, after a consent box that says what is recorded, that the server keeps it and for how long (the instance's own retention), and that it lapses. Alap is the base and needs no consent. - users.diagnostics_level/_until (migration 0087), written only by PUT /api/me/diagnostics, which computes the expiry itself; the demo account cannot raise it. /api/me reports the level in force. - The server logs an elevated user's requests at that level and stores every line of them (logs.LevelGate on the stdout handler and the sink; the root is lowered only while an elevation is active). Teljes adds the redacted query string to the request line. - POST /api/diagnostics/events stores the browser's log as source=web rows: account from the session, body capped while streaming, events/attrs capped, re-redacted, events under the consented level dropped, timestamps clamped, 30 batches a minute, 409 once the level lapsed. - lib/diagnostics.ts applies the level to the tab and streams only what happens after consent, in batches, never its own request lines, with a keepalive flush on pagehide; stops on lapse (its own timer), on withdrawal and on 409. - Detail hooks at DEBUG: which control was clicked (test id, icon, app copy in English — never user text, input values or a link's query), visibility/bfcache/resize, filter changes (lib/filterLog.ts; typed search only at TRACE), player events (lib/mediaLog.ts; media errors are warnings at every level). Offline/online at the base level. - "Saját napló" viewer: live, newest first, level groups with counts, search, row details, copy the filtered events as JSON lines, clear. - Privacy policy and Terms exist in Hungarian and English (a contract test holds both languages to the same sections); the policy now describes the server logs and diagnostic logging, self-service deletion and password sign-in. Fixed on the way: - A sync auth dependency ran logs.set_user on a copied context, so the account never reached a handler's own log lines (measured); a per-request mutable scope carries it now. - The Settings tab rail left a phone no room (clipped labels, buttons over text): below `sm` it is a scrolling row above the content. - PUT /api/me/preferences took a bare dict body; it is a Pydantic model now.
This commit is contained in:
@@ -4,8 +4,11 @@ import CountBadge from "./CountBadge";
|
||||
|
||||
// Reusable pill tab-rail for in-page sub-navigation (Configuration, Users & roles, the Settings
|
||||
// sections, the Stats overview/system split…). Horizontal by default; `orientation="vertical"` gives
|
||||
// the Settings-style side rail (full-width, left-aligned, icon + label). The active tab is persisted
|
||||
// to localStorage so a reload keeps the user where they were.
|
||||
// the Settings-style side rail (full-width, left-aligned, icon + label) — from the `sm` breakpoint up.
|
||||
// Below it a side rail leaves a phone too little width for the content beside it (measured at 390 px:
|
||||
// the rail clipped its own labels and Settings → Account pushed its buttons over their text), so there
|
||||
// it is a horizontal row that scrolls. The active tab is persisted to localStorage so a reload keeps
|
||||
// the user where they were.
|
||||
|
||||
export interface TabDef {
|
||||
id: string;
|
||||
@@ -36,7 +39,9 @@ export default function Tabs({
|
||||
className?: string;
|
||||
}) {
|
||||
const vertical = orientation === "vertical";
|
||||
const wrapCls = className ?? (vertical ? "flex flex-col gap-1" : "flex flex-wrap gap-1 mb-4");
|
||||
const wrapCls =
|
||||
className ??
|
||||
(vertical ? "flex gap-1 overflow-x-auto sm:flex-col" : "flex flex-wrap gap-1 mb-4");
|
||||
return (
|
||||
<div className={wrapCls}>
|
||||
{tabs.map((tb) => {
|
||||
@@ -50,7 +55,7 @@ export default function Tabs({
|
||||
aria-pressed={on}
|
||||
className={`pill items-center rounded-lg px-3 text-sm ${
|
||||
vertical
|
||||
? "flex w-full justify-start gap-2 py-2 text-left"
|
||||
? "inline-flex shrink-0 gap-1.5 py-1.5 sm:flex sm:w-full sm:justify-start sm:gap-2 sm:py-2 sm:text-left"
|
||||
: "inline-flex gap-1.5 py-1.5"
|
||||
} ${on ? "font-medium shadow-md shadow-accent/20" : "hover:bg-card/60"}`}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user