feat: no console — the chat is the only screen for contracts (Atrium #53)
Decision 1 of 18.11: Arbiter, Lexicon and Scribe are one module "Umowy" under Atrium's chat; the logic stays here and the chat calls this API. The static console (frontend/), its mount, SPA fallback and console-only edge classes go; "/" answers a small JSON note. Every API route and /healthz stay. CI, the Dockerfile, compose, deploy_check and the docs follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -68,10 +68,6 @@ jobs:
|
||||
- name: Tests
|
||||
working-directory: backend
|
||||
run: pytest -q --cov=app --cov-report=term-missing
|
||||
- name: Console syntax
|
||||
# A duplicate `const` inside one function silently stops the whole file parsing, so every
|
||||
# function after it disappears — and the symptom is a blank screen with no console error.
|
||||
run: node --check frontend/app.js
|
||||
- name: License gate (Python)
|
||||
working-directory: backend
|
||||
run: python scripts/license_gate.py
|
||||
@@ -241,7 +237,7 @@ jobs:
|
||||
|
||||
# ── the deployment itself ─────────────────────────────────────────────────────
|
||||
# The backend job runs the app from source on the runner. Nothing there executes
|
||||
# docker-compose.yml, the Dockerfile, the console served from the image or db/init — and the private dredd-core install
|
||||
# docker-compose.yml, the Dockerfile or db/init — and the private dredd-core install
|
||||
# inside the image is exactly what broke unnoticed before. This job runs the real stack, the way a
|
||||
# deployer does. (Modelled on Sygna's compose-smoke job, which proved the approach.)
|
||||
compose-smoke:
|
||||
@@ -284,10 +280,10 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fsS http://localhost/healthz
|
||||
headers=$(curl -fsSI http://localhost/)
|
||||
echo "$headers" | grep -qi "content-security-policy" || { echo "::error::no CSP on the console"; exit 1; }
|
||||
echo "$headers" | grep -qi "x-frame-options" || { echo "::error::no frame policy on the console"; exit 1; }
|
||||
curl -fsS http://localhost/ | grep -q "<title>Lexicon" || { echo "::error::console did not render"; exit 1; }
|
||||
headers=$(curl -fsS -o /dev/null -D - http://localhost/)
|
||||
echo "$headers" | grep -qi "content-security-policy" || { echo "::error::no CSP on /"; exit 1; }
|
||||
echo "$headers" | grep -qi "x-frame-options" || { echo "::error::no frame policy on /"; exit 1; }
|
||||
curl -fsS http://localhost/ | grep -q "\"console\":null" || { echo "::error::/ is not the no-console note"; exit 1; }
|
||||
token=$(curl -fsS -X POST http://localhost/api/v1/auth/login \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"email":"admin@example.com","password":"ci-admin-password-1"}' | jq -r .token)
|
||||
|
||||
@@ -12,7 +12,7 @@ Atrium since Atrium#53 (stage 2); `clause_standard` stays as a table, unused. Bu
|
||||
identity, sessions, auth, the access-control resolver, the org tree, audit and the security
|
||||
primitives are an installed dependency, not source in this repo. Stack: **FastAPI + SQLAlchemy 2
|
||||
+ Alembic + PostgreSQL 16 / 17**, Argon2id auth + server-side cookie sessions, a
|
||||
**no-build static console** (vanilla JS), Docker Compose, with the backend as its own edge (`app/edge.py`, no reverse proxy). License **Apache-2.0**; every dependency is
|
||||
**no console of its own** — decision of 18.11 (Atrium issue #53): contracts are worked on only in Atrium's chat, where Arbiter, Lexicon and Scribe are one entry „Umowy”; the logic stays here and the chat calls this API. `/` answers a small JSON note, `/healthz` and `/api/v1` are unchanged, Docker Compose, with the backend as its own edge (`app/edge.py`, no reverse proxy). License **Apache-2.0**; every dependency is
|
||||
permissive (no copyleft).
|
||||
|
||||
The core is pinned by tag in `backend/requirements.txt`:
|
||||
@@ -99,7 +99,6 @@ backend/alembic/ env + 0001_initial (pgcrypto, create_enum_types, create_all)
|
||||
whose 0001 ran before that still has the old table, and 0001 never runs again —
|
||||
rename it, add `role`, or build it from the metadata, decided by the catalog)
|
||||
backend/scripts/ license_gate · deploy_check
|
||||
frontend/ index.html · app.css · app.js (no build step)
|
||||
Tabler icon path data vendored into app.js's ICN map (CREDITS.md)
|
||||
db/init/ 01-roles.sh (creates the app + migrator roles — local stack only)
|
||||
db/managed/ provision.sql (rendered by dredd-core; CI checks it) · README.md (managed-database runbook)
|
||||
@@ -121,7 +120,6 @@ python -m dredd_core.managed provision --sql-only --schema lexicon --app-role le
|
||||
--migrator-role lexicon_migrator --check-file ../db/managed/provision.sql # rendering current?
|
||||
python scripts/license_gate.py # CI license gate locally
|
||||
python scripts/deploy_check.py # compose/Dockerfile/.env coherence
|
||||
node --check frontend/app.js # ALWAYS after editing the console
|
||||
```
|
||||
|
||||
## Invariants — preserve these
|
||||
@@ -272,14 +270,13 @@ node --check frontend/app.js # ALWAYS after editing the console
|
||||
clearable fields if a user must be able to empty something.
|
||||
- **Errors are RFC 9457 Problem Details**; raise `dredd_core.errors` types from services, render
|
||||
them in one handler. Stack traces hidden when `APP_ENV=production`.
|
||||
- **Console security:** `esc()` every dynamic value; bearer token in memory only, cookie session
|
||||
primary; nothing loads from a CDN (the CSP has no third-party origins).
|
||||
- **Brand = Open Color `green` `#2f9e44`**, confined to identity — the app mark, icon
|
||||
tiles, the avatar, the focus ring. Buttons, nav and toolbar glyphs stay monochrome; brand
|
||||
everything and nothing stands out. Semantic ok/warn/err is a separate axis.
|
||||
- **Core stays permissive.** Apache-2.0; CI denies GPL/AGPL/SSPL. Copyleft or heavyweight
|
||||
components are optional sidecars, never core.
|
||||
- **No build step for the console.**
|
||||
- **No console.** Don't add screens back here: a screen for this module's work belongs in
|
||||
Atrium's chat (a tool calling this API).
|
||||
|
||||
## Gotchas
|
||||
|
||||
@@ -295,11 +292,6 @@ node --check frontend/app.js # ALWAYS after editing the console
|
||||
- On Windows, write `.env` **without a BOM** (PowerShell's `Out-File -Encoding utf8` adds one,
|
||||
and pydantic-settings folds it into the first key name) — use
|
||||
`[System.IO.File]::WriteAllText(...)`.
|
||||
- **Syntax-check the console after editing it**: `node --check frontend/app.js`. A duplicate
|
||||
`const` inside one function silently stops the whole file parsing, so every function defined
|
||||
after it disappears — and the symptom is a screen that renders nothing, with no console error.
|
||||
- Never transition `visibility` over a duration or with a delay; the off-canvas drawer gets stuck
|
||||
when frames are throttled. `transform` transitions; `visibility` flips instantly.
|
||||
- Name model modules so they cannot shadow a stdlib module (`timelog.py`, not `time.py`).
|
||||
|
||||
## Status
|
||||
|
||||
+3
-7
@@ -23,14 +23,10 @@ gate (`backend/scripts/license_gate.py`) fails the build on GPL, AGPL or SSPL.
|
||||
| [cryptography](https://cryptography.io) | Apache-2.0 / BSD-3-Clause | sealing model-provider keys |
|
||||
| [PostgreSQL](https://www.postgresql.org) | PostgreSQL License | the database |
|
||||
|
||||
## Console
|
||||
## Console (removed)
|
||||
|
||||
| Project | License | Why |
|
||||
|---|---|---|
|
||||
| [Open Color](https://yeun.github.io/open-color/) | MIT | the colour palette, light and dark |
|
||||
| [Tabler Icons](https://tabler.io/icons) | MIT | outline icon set — path data is **vendored** into `frontend/app.js`'s `ICN` map, never loaded from a CDN, because the console's CSP allows no third-party origins |
|
||||
|
||||
No framework, no bundler, no CDN: the console is `index.html` + `app.css` + `app.js`.
|
||||
The console was removed on the decision of 18.11 (Atrium issue #53). It used Open Color (MIT)
|
||||
and vendored Tabler Icons path data (MIT); neither ships any more.
|
||||
|
||||
## Design credit
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@ installs as a dependency rather than copies.
|
||||
|
||||
**FastAPI + SQLAlchemy 2 + Alembic + PostgreSQL 16 / 17**, Argon2id password hashing, server-side
|
||||
cookie sessions, an append-only audit log enforced by database grants, RFC 9457 Problem Details
|
||||
errors, opt-in OpenTelemetry, and a **no-build vanilla-JS console** (Open Color palette, Tabler
|
||||
icons, light/dark theme, two languages). Shipped with Docker Compose; the backend is its own edge (no reverse proxy). Apache-2.0, and CI
|
||||
errors, opt-in OpenTelemetry, and **no console of its own** — decision of 18.11 (Atrium issue #53): contracts are worked on only in Atrium's chat, where Arbiter, Lexicon and Scribe are one entry „Umowy”; the logic stays here and the chat calls this API. `/` answers a small JSON note, `/healthz` and `/api/v1` are unchanged. Shipped with Docker Compose; the backend is its own edge (no reverse proxy). Apache-2.0, and CI
|
||||
refuses any GPL/AGPL/SSPL dependency.
|
||||
|
||||
## dredd-core
|
||||
@@ -122,7 +121,6 @@ pytest # DB-free unit tests
|
||||
alembic upgrade head --sql # inspect the DDL without a database
|
||||
python scripts/license_gate.py # no GPL/AGPL/SSPL
|
||||
python scripts/deploy_check.py # stack-definition coherence
|
||||
node --check ../frontend/app.js # the console has no build step, so this is the check
|
||||
```
|
||||
|
||||
The API is served under `/api/v1`, with OpenAPI docs at `/api/v1/docs`.
|
||||
@@ -166,7 +164,7 @@ The runtime role's name is configuration (`DB_APP_ROLE`, `app` by default): the
|
||||
when it runs as a superuser or the platform admin, or when a grant did not take. Migrations run as the
|
||||
migrator and nothing else.
|
||||
|
||||
Only the backend is published to the host (:80) — it serves the console and sets every security
|
||||
Only the backend is published to the host (:80) — it serves the API and sets every security
|
||||
header itself (`backend/app/edge.py`); Postgres is `expose`-only. There is no reverse proxy.
|
||||
|
||||
Access control lives in exactly one module, `backend/app/services/authz.py` — a re-export of
|
||||
@@ -182,7 +180,6 @@ returns **404, not 403**: a 403 confirms that the record the caller may not see
|
||||
| `backend/app/routers/` | HTTP shape, validation, authz calls — no SQL |
|
||||
| `backend/alembic/` | `0001`: enum types → `create_all`; `0002`: runtime grants for `DB_APP_ROLE` |
|
||||
| `backend/scripts/` | license gate, deploy pre-flight |
|
||||
| `frontend/` | the console: `index.html` + `app.css` + `app.js`, no bundler |
|
||||
| `db/init/` | least-privilege role creation for the local stack, run once by Postgres |
|
||||
| `db/managed/` | the shared managed database: rendered `provision.sql` + this app's runbook |
|
||||
| `docker-compose.managed-db.yml` | override for a managed database: no local postgres, CA mounted, no migrator in the backend |
|
||||
|
||||
@@ -39,12 +39,6 @@ COPY --from=build /install /usr/local
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# The static console, which this backend serves itself (app/main.py mounts it at "/"; there is no
|
||||
# reverse proxy). It lives in the repo's frontend/, outside this build context, so it arrives as a
|
||||
# NAMED build context: compose passes `additional_contexts: { frontend: ./frontend }`, and a bare
|
||||
# build from backend/ needs `docker build --build-context frontend=../frontend .`.
|
||||
COPY --from=frontend . /frontend
|
||||
ENV LEXICON_FRONTEND_DIR=/frontend
|
||||
|
||||
RUN useradd -m app && mkdir -p /data && chown -R app /data /app
|
||||
ENV DATA_DIR=/data
|
||||
|
||||
+2
-54
@@ -1,4 +1,4 @@
|
||||
"""This backend's own edge: security headers, the body cap, the console.
|
||||
"""This backend's own edge: security headers and the body cap (no console: Atrium issue #53).
|
||||
|
||||
There is no reverse proxy. Standalone, docker-compose.yml publishes uvicorn directly; on the Dredd
|
||||
platform Atrium's backend is the front door (its `app/frontdoor.py`) and forwards `/lexicon/*`
|
||||
@@ -12,15 +12,10 @@ the console's CSP and Cache-Control, and handing unknown API paths to the consol
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from fastapi import HTTPException as FastAPIHTTPException
|
||||
from starlette._utils import get_route_path
|
||||
from starlette.datastructures import MutableHeaders
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import JSONResponse, Response
|
||||
from starlette.routing import BaseRoute, Match
|
||||
from starlette.staticfiles import StaticFiles
|
||||
from starlette.responses import JSONResponse
|
||||
from starlette.types import ASGIApp, Message, Receive, Scope, Send
|
||||
|
||||
# Paths the backend owns; everything else is the static console. Nothing under these is ever
|
||||
@@ -162,50 +157,3 @@ class BodySizeLimit:
|
||||
await self._refusal(scope)(scope, receive, send)
|
||||
|
||||
|
||||
class SpaStaticFiles(StaticFiles):
|
||||
"""The SPA fallback: a GET/HEAD for a file that does not exist gets the console's index.html
|
||||
(200), so a deep link survives a reload. Other methods keep StaticFiles' 405."""
|
||||
|
||||
async def get_response(self, path: str, scope: Scope) -> Response:
|
||||
try:
|
||||
return await super().get_response(path, scope)
|
||||
except HTTPException as exc:
|
||||
if exc.status_code != 404:
|
||||
raise
|
||||
return await super().get_response("index.html", scope)
|
||||
|
||||
|
||||
class ConsoleUnlessApi:
|
||||
"""Serve the static console, except under the API's own paths — those are answered here.
|
||||
|
||||
The console is mounted at "/" last, so every bound path+method wins. But a `Mount` FULL-matches
|
||||
every path beneath it, which beats a route's PARTIAL match (path right, method wrong — the
|
||||
signal Starlette turns into 405). Without this shim `GET` on a POST-only API path would get the
|
||||
console's index.html (the SPA fallback), and `POST /api/v1/nope` a static-file 405. So under
|
||||
`/api` and `/healthz` this answers itself: 405 + `Allow` when some route claims the path under
|
||||
another method (asked via Starlette's own `route.matches`, no second copy of the path regexes),
|
||||
and a 404 problem response when none does.
|
||||
"""
|
||||
|
||||
def __init__(self, console: ASGIApp, routes: Sequence[BaseRoute]) -> None:
|
||||
self._console = console
|
||||
# The LIVE app.routes list, read per request: this is built while the app still is.
|
||||
self._routes = routes
|
||||
|
||||
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
||||
if scope["type"] != "http" or not owns_path(get_route_path(scope)):
|
||||
await self._console(scope, receive, send)
|
||||
return
|
||||
allowed: set[str] = set()
|
||||
for route in self._routes:
|
||||
methods = getattr(route, "methods", None)
|
||||
if methods and route.matches(scope)[0] is Match.PARTIAL:
|
||||
allowed |= set(methods)
|
||||
if allowed:
|
||||
response = _problem(scope, 405, "method_not_allowed", "Method Not Allowed",
|
||||
"That method is not allowed on this path.",
|
||||
headers={"Allow": ", ".join(sorted(allowed))})
|
||||
else:
|
||||
response = _problem(scope, 404, "not_found", "Resource not found",
|
||||
"No API route matches this path.")
|
||||
await response(scope, receive, send)
|
||||
|
||||
+7
-13
@@ -3,10 +3,8 @@ from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
from collections.abc import AsyncIterator
|
||||
from pathlib import Path
|
||||
|
||||
from dredd_core.identity_schema import IdentitySchemaError, assert_identity_schema
|
||||
from fastapi import Depends, FastAPI
|
||||
@@ -18,7 +16,7 @@ from . import __version__
|
||||
from .config import get_settings
|
||||
from .db import SessionLocal, engine
|
||||
from .deps import refuse_cross_site_write
|
||||
from .edge import BodySizeLimit, ConsoleUnlessApi, SecurityHeaders, SpaStaticFiles
|
||||
from .edge import BodySizeLimit, SecurityHeaders
|
||||
from .errors import ProblemDetailErrorMiddleware, install_error_handlers
|
||||
from .logging_config import configure_logging
|
||||
from .models import SHARED_TABLES
|
||||
@@ -156,13 +154,9 @@ app.add_middleware(GZipMiddleware, minimum_size=1000)
|
||||
# the responses every other layer produces — 404, 405, 413 and the 500 problem response included.
|
||||
app.add_middleware(SecurityHeaders, frame_ancestors=settings.frame_ancestors)
|
||||
|
||||
# The static console — this backend serves it itself; there is no reverse proxy. Mounted at "/"
|
||||
# LAST so every API route wins, behind ConsoleUnlessApi so /api/* and /healthz never fall through
|
||||
# to it (see its docstring), with the index.html SPA fallback. LEXICON_FRONTEND_DIR
|
||||
# overrides the location; the default is the repo's ../frontend, which is also where
|
||||
# backend/Dockerfile copies it (/frontend in the image).
|
||||
_FRONTEND = Path(os.environ.get("LEXICON_FRONTEND_DIR")
|
||||
or Path(__file__).resolve().parents[2] / "frontend")
|
||||
if _FRONTEND.is_dir():
|
||||
app.mount("/", ConsoleUnlessApi(SpaStaticFiles(directory=str(_FRONTEND), html=True),
|
||||
app.routes), name="console")
|
||||
# No console (decision of 18.11, Atrium issue #53): contracts are worked on in Atrium's chat, which
|
||||
# calls this module's API. "/" says so in one small JSON answer; the API and /healthz are unchanged.
|
||||
@app.get("/", include_in_schema=False)
|
||||
def root() -> dict:
|
||||
return {"service": "lexicon", "console": None,
|
||||
"detail": "Lexicon is a service module without a console; use the API under /api/v1."}
|
||||
|
||||
@@ -93,9 +93,8 @@ check('"80:8000"' in compose and "expose:" in compose,
|
||||
check("caddy" not in compose.lower() and not (ROOT / "Caddyfile").exists(),
|
||||
"a reverse-proxy service or Caddyfile is back — the backend is its own edge (app/edge.py)",
|
||||
"no reverse proxy: the backend is the edge")
|
||||
check(compose.count("frontend: ./frontend") >= 2,
|
||||
"compose does not pass the console to every build as the `frontend` build context",
|
||||
"every build gets the console as the `frontend` build context")
|
||||
check("frontend" not in compose, "compose still passes a console build context",
|
||||
"no console build context (the module has no console)")
|
||||
check("/docker-entrypoint-initdb.d" in compose,
|
||||
"db/init is not mounted, so the least-privilege roles are never created",
|
||||
"db/init mounted — app + migrator roles created on first start")
|
||||
@@ -140,9 +139,8 @@ check(bool(re.search(r'API_PREFIX = "([^"]+)"', main_py)), "cannot find API_PREF
|
||||
check("app.add_middleware(SecurityHeaders" in main_py,
|
||||
"main.py does not add the edge's SecurityHeaders middleware",
|
||||
"SecurityHeaders stamps every response")
|
||||
check("ConsoleUnlessApi(SpaStaticFiles(" in main_py,
|
||||
"the console is not mounted behind ConsoleUnlessApi with the SPA fallback",
|
||||
"console mounted behind ConsoleUnlessApi, with the SPA fallback (deep links survive a reload)")
|
||||
check("StaticFiles" not in main_py and "app.mount(" not in main_py, "main.py mounts a console",
|
||||
"no console mounted (\"/\" answers a small JSON note)")
|
||||
for header in ("X-Content-Type-Options", "X-Frame-Options", "Content-Security-Policy"):
|
||||
check(header in edge_py, f"app/edge.py does not set {header}")
|
||||
check("--no-server-header" in dockerfile, "uvicorn announces itself (no --no-server-header)",
|
||||
|
||||
+16
-25
@@ -1,6 +1,6 @@
|
||||
"""DB-free tests for the backend's own edge (`app/edge.py`).
|
||||
|
||||
There is no reverse proxy: this process serves the console and sets every security header itself.
|
||||
There is no reverse proxy: this process sets every security header itself.
|
||||
`app.main` needs a database to import, so these build a small app from the same pieces, wired in the
|
||||
same order as main.py.
|
||||
"""
|
||||
@@ -12,17 +12,13 @@ from fastapi.testclient import TestClient
|
||||
|
||||
from app.edge import (
|
||||
CONSOLE_CSP,
|
||||
content_security_policy,
|
||||
BodySizeLimit,
|
||||
ConsoleUnlessApi,
|
||||
SecurityHeaders,
|
||||
SpaStaticFiles,
|
||||
content_security_policy,
|
||||
)
|
||||
|
||||
|
||||
def _client(tmp_path) -> TestClient:
|
||||
(tmp_path / "index.html").write_text("<!doctype html><title>console</title>", encoding="utf-8")
|
||||
(tmp_path / "app.js").write_text("console.log(1)", encoding="utf-8")
|
||||
app = FastAPI()
|
||||
app.add_middleware(BodySizeLimit, max_bytes=1024)
|
||||
|
||||
@@ -34,27 +30,24 @@ def _client(tmp_path) -> TestClient:
|
||||
def healthz() -> dict:
|
||||
return {"status": "ok"}
|
||||
|
||||
@app.get("/")
|
||||
def root() -> dict:
|
||||
return {"service": "x", "console": None}
|
||||
|
||||
app.add_middleware(SecurityHeaders)
|
||||
app.mount("/", ConsoleUnlessApi(SpaStaticFiles(directory=str(tmp_path), html=True),
|
||||
app.routes), name="console")
|
||||
return TestClient(app)
|
||||
|
||||
|
||||
def test_console_gets_its_csp_and_no_cache(tmp_path):
|
||||
def test_root_is_a_small_note_with_the_page_policy(tmp_path):
|
||||
# No console any more (Atrium issue #53): "/" answers JSON, still under the strict page policy.
|
||||
r = _client(tmp_path).get("/")
|
||||
assert r.status_code == 200
|
||||
assert r.status_code == 200 and r.json()["console"] is None
|
||||
assert r.headers["content-security-policy"] == CONSOLE_CSP
|
||||
assert r.headers["cache-control"] == "no-cache"
|
||||
assert r.headers["x-content-type-options"] == "nosniff"
|
||||
assert r.headers["x-frame-options"] == "DENY"
|
||||
assert r.headers["referrer-policy"] == "same-origin"
|
||||
|
||||
|
||||
def test_a_deep_link_falls_back_to_index(tmp_path):
|
||||
r = _client(tmp_path).get("/some/deep/link")
|
||||
assert r.status_code == 200 and "<title>console</title>" in r.text
|
||||
|
||||
|
||||
def test_the_api_gets_the_headers_but_not_the_console_policy(tmp_path):
|
||||
r = _client(tmp_path).get("/healthz")
|
||||
assert r.status_code == 200
|
||||
@@ -62,13 +55,9 @@ def test_the_api_gets_the_headers_but_not_the_console_policy(tmp_path):
|
||||
assert "content-security-policy" not in r.headers
|
||||
|
||||
|
||||
def test_the_console_never_answers_for_the_api(tmp_path):
|
||||
client = _client(tmp_path)
|
||||
wrong_method = client.get("/api/v1/things")
|
||||
def test_a_wrong_method_on_the_api_is_405(tmp_path):
|
||||
wrong_method = _client(tmp_path).get("/api/v1/things")
|
||||
assert wrong_method.status_code == 405 and wrong_method.headers["allow"] == "POST"
|
||||
unknown = client.get("/api/v1/nope")
|
||||
assert unknown.status_code == 404
|
||||
assert unknown.headers["content-type"] == "application/problem+json"
|
||||
|
||||
|
||||
def test_an_oversized_body_is_refused(tmp_path):
|
||||
@@ -78,12 +67,14 @@ def test_an_oversized_body_is_refused(tmp_path):
|
||||
|
||||
def _framed(tmp_path, value: str):
|
||||
from app.config import Settings
|
||||
(tmp_path / "index.html").write_text("<!doctype html>", encoding="utf-8")
|
||||
app = FastAPI()
|
||||
app.add_middleware(SecurityHeaders, frame_ancestors=Settings(
|
||||
_env_file=None, frame_ancestors=value).frame_ancestors)
|
||||
app.mount("/", ConsoleUnlessApi(SpaStaticFiles(directory=str(tmp_path), html=True),
|
||||
app.routes), name="console")
|
||||
|
||||
@app.get("/")
|
||||
def root() -> dict:
|
||||
return {}
|
||||
|
||||
return TestClient(app).get("/").headers
|
||||
|
||||
|
||||
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
# Lexicon stack: postgres → migrate (+seed) → backend. No reverse proxy: the backend is its own
|
||||
# edge (app/edge.py) and serves the console. Only the backend is published; postgres is expose-only.
|
||||
# edge (app/edge.py) and has no console (Atrium's chat calls its API). Only the backend is published; postgres is expose-only.
|
||||
#
|
||||
# Runs alongside a sibling's stack — different volumes, different DB name. Each app in the family
|
||||
# keeps its OWN database; what they share is the `dredd-core` package, not a cluster.
|
||||
@@ -24,7 +24,6 @@ services:
|
||||
migrate:
|
||||
build:
|
||||
context: ./backend
|
||||
additional_contexts: { frontend: ./frontend }
|
||||
secrets: [dredd_core_token]
|
||||
image: lexicon-backend:local
|
||||
env_file: .env
|
||||
@@ -39,7 +38,6 @@ services:
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
additional_contexts: { frontend: ./frontend }
|
||||
secrets: [dredd_core_token]
|
||||
image: lexicon-backend:local
|
||||
env_file: .env
|
||||
|
||||
@@ -1,512 +0,0 @@
|
||||
/* Lexicon console.
|
||||
UI chrome stays monochrome (near-black light / near-white dark) — buttons, emphasis, text.
|
||||
The brand is Open Color **green #2f9e44**, and it is confined to things that read as
|
||||
an identity rather than a control: the app mark, icon tiles, the avatar, the focus ring. Nav
|
||||
and toolbar glyphs stay monochrome, or the whole console turns into a colour field and nothing
|
||||
stands out.
|
||||
Semantic colour (overdue / warning / ok) is a separate axis from the brand and earns its
|
||||
place: something that needs attention has to read at a glance.
|
||||
Dark mode lightens the brand for text-weight use — a shade-8 on a near-black ground is legible
|
||||
as a filled background but too dim as a 2px stroke. */
|
||||
|
||||
:root {
|
||||
--bg: #f6f7f8;
|
||||
--surface: #ffffff;
|
||||
--surface-2: #f0f2f3;
|
||||
--surface-hover: #e9ecee;
|
||||
--border: #dfe3e6;
|
||||
--border-input: #c8ced3;
|
||||
--text: #14181b;
|
||||
--text-secondary: #4c565e;
|
||||
--text-muted: #6d7880;
|
||||
--text-faint: #98a2a9;
|
||||
--accent: #14181b;
|
||||
--accent-text: #ffffff;
|
||||
/* `--brand-bg` carries ICONS (3:1 against the glyph is the bar for graphics).
|
||||
`--brand-ink` is one step darker for the one filled shape that carries TEXT — the avatar's
|
||||
initials — where 4.5:1 applies. Same family, one step, rather than a second colour. */
|
||||
--brand: #2f9e44;
|
||||
--brand-bg: #2f9e44;
|
||||
--brand-ink: #2b8a3e;
|
||||
--brand-fg: #ebfbee;
|
||||
|
||||
--ok: #1f7a4d;
|
||||
--ok-bg: #e7f5ee;
|
||||
--warn: #9a6200;
|
||||
--warn-bg: #fdf3e0;
|
||||
--err: #b02525;
|
||||
--err-bg: #fdeceb;
|
||||
|
||||
--radius: 8px;
|
||||
--radius-sm: 6px;
|
||||
--shadow: 0 1px 2px rgba(20, 24, 27, .06), 0 4px 12px rgba(20, 24, 27, .05);
|
||||
--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
||||
--sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) {
|
||||
--bg: #101315;
|
||||
--surface: #181c1f;
|
||||
--surface-2: #1f2427;
|
||||
--surface-hover: #272d31;
|
||||
--border: #2b3236;
|
||||
--border-input: #3a4247;
|
||||
--text: #eef1f2;
|
||||
--text-secondary: #b3bbc0;
|
||||
--text-muted: #8b959b;
|
||||
--text-faint: #69737a;
|
||||
--accent: #eef1f2;
|
||||
--accent-text: #101315;
|
||||
/* A lighter shade for stroke-weight use; the filled grounds stay put so a tile looks the
|
||||
same in both themes. */
|
||||
--brand: #51cf66;
|
||||
--brand-bg: #2f9e44;
|
||||
--brand-ink: #2b8a3e;
|
||||
--brand-fg: #ebfbee;
|
||||
--ok: #5cc98f;
|
||||
--ok-bg: #16281f;
|
||||
--warn: #e8b45c;
|
||||
--warn-bg: #2a2115;
|
||||
--err: #f08a80;
|
||||
--err-bg: #2c1a18;
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
|
||||
}
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
--bg: #101315;
|
||||
--surface: #181c1f;
|
||||
--surface-2: #1f2427;
|
||||
--surface-hover: #272d31;
|
||||
--border: #2b3236;
|
||||
--border-input: #3a4247;
|
||||
--text: #eef1f2;
|
||||
--text-secondary: #b3bbc0;
|
||||
--text-muted: #8b959b;
|
||||
--text-faint: #69737a;
|
||||
--accent: #eef1f2;
|
||||
--accent-text: #101315;
|
||||
--brand: #51cf66;
|
||||
--brand-bg: #2f9e44;
|
||||
--brand-ink: #2b8a3e;
|
||||
--brand-fg: #ebfbee;
|
||||
--ok: #5cc98f;
|
||||
--ok-bg: #16281f;
|
||||
--warn: #e8b45c;
|
||||
--warn-bg: #2a2115;
|
||||
--err: #f08a80;
|
||||
--err-bg: #2c1a18;
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: var(--sans);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.hidden { display: none !important; }
|
||||
a { color: inherit; cursor: pointer; text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
|
||||
|
||||
/* ── login ─────────────────────────────────────────────────────────────── */
|
||||
#login {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
background: var(--bg);
|
||||
}
|
||||
.login-tools { position: fixed; top: 16px; right: 16px; display: flex; gap: 8px; z-index: 5; }
|
||||
.login-tools .iconbtn { background: var(--surface); border: 1px solid var(--border-input); }
|
||||
.login-card {
|
||||
width: 100%;
|
||||
max-width: 360px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
padding: 32px;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.login-card .logo { width: 40px; height: 40px; display: block; }
|
||||
.login-card h1 { font-size: 22px; margin: 16px 0 2px; letter-spacing: -.01em; }
|
||||
.lsub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
|
||||
.login-card .banner { margin: 14px 0 0; }
|
||||
.login-card .btn { margin-top: 18px; width: 100%; justify-content: center; }
|
||||
|
||||
/* ── shell ─────────────────────────────────────────────────────────────── */
|
||||
#app { display: flex; min-height: 100vh; }
|
||||
.sidebar {
|
||||
width: 232px;
|
||||
flex: none;
|
||||
background: var(--surface);
|
||||
border-right: 1px solid var(--border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
height: 100vh;
|
||||
}
|
||||
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; }
|
||||
.brand .logo { width: 26px; height: 26px; flex: none; }
|
||||
.brand .nm { font-weight: 650; letter-spacing: -.01em; font-size: 16px; }
|
||||
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
|
||||
.sidebar-foot { flex: none; border-top: 1px solid var(--border); padding-bottom: 10px; }
|
||||
.nav-item {
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
padding: 8px 10px; border-radius: var(--radius-sm);
|
||||
color: var(--text-secondary); cursor: pointer; font-size: 13.5px;
|
||||
}
|
||||
.nav-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
|
||||
.nav-item.on { background: var(--surface-2); color: var(--text); font-weight: 550; }
|
||||
.nav-item svg { flex: none; color: var(--text-muted); }
|
||||
.nav-item.on svg { color: var(--text); }
|
||||
.nav-item .cnt {
|
||||
margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums;
|
||||
background: var(--surface-hover); color: var(--text-secondary);
|
||||
border-radius: 999px; padding: 1px 7px;
|
||||
}
|
||||
.nav-item .cnt.hot { background: var(--err-bg); color: var(--err); }
|
||||
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
|
||||
color: var(--text-faint); padding: 14px 10px 4px; }
|
||||
|
||||
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
||||
.topbar {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 10px 18px; border-bottom: 1px solid var(--border);
|
||||
background: var(--surface); position: sticky; top: 0; z-index: 4;
|
||||
}
|
||||
.spacer { flex: 1; }
|
||||
.vdiv { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
|
||||
.crumb { display: flex; align-items: center; gap: 6px; min-width: 0;
|
||||
overflow-x: auto; white-space: nowrap; scrollbar-width: none; color: var(--text-muted); }
|
||||
.crumb::-webkit-scrollbar { display: none; }
|
||||
.crumb b { color: var(--text); font-weight: 600; }
|
||||
.crumb .sep { color: var(--text-faint); }
|
||||
.content { padding: 22px; max-width: 1180px; width: 100%; }
|
||||
|
||||
#navToggle { display: none; }
|
||||
#navScrim { display: none; }
|
||||
.appcard.m-only { display: none; }
|
||||
/* ── global search ─────────────────────────────────────────────────────── */
|
||||
/* Looks like an input, is a button: the field itself is in the overlay, so there is one place
|
||||
the query lives rather than two that can disagree. */
|
||||
.searchbar {
|
||||
display: inline-flex; align-items: center; gap: 8px;
|
||||
min-width: 210px; padding: 5px 8px 5px 10px;
|
||||
border: 1px solid var(--border-input); border-radius: var(--radius-sm);
|
||||
background: var(--bg); color: var(--text-muted);
|
||||
font: inherit; font-size: 13px; cursor: text;
|
||||
}
|
||||
.searchbar:hover { background: var(--surface-hover); }
|
||||
.searchbar .sp { flex: 1; text-align: left; }
|
||||
.searchbar kbd {
|
||||
font: inherit; font-size: 10.5px; color: var(--text-faint);
|
||||
border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px;
|
||||
}
|
||||
|
||||
/* ── controls ──────────────────────────────────────────────────────────── */
|
||||
.btn {
|
||||
display: inline-flex; align-items: center; gap: 7px;
|
||||
padding: 7px 13px; border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--border-input); background: var(--surface);
|
||||
color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer;
|
||||
}
|
||||
.btn:hover { background: var(--surface-hover); }
|
||||
/* A .btn that is an <a> because it navigates rather than acts — the sign-in link on a platform
|
||||
module's login card. Without this it picks up the global `a:hover` underline and is the one
|
||||
button in the console that behaves like a link. Same reset .nav-item and a.appcard already do. */
|
||||
a.btn:hover { text-decoration: none; }
|
||||
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
|
||||
.btn.primary:hover { opacity: .88; }
|
||||
.btn.danger { color: var(--err); border-color: var(--border-input); }
|
||||
.btn.danger:hover { background: var(--err-bg); }
|
||||
.btn:disabled { opacity: .5; cursor: not-allowed; }
|
||||
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
|
||||
|
||||
.iconbtn {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
width: 32px; height: 32px; border-radius: var(--radius-sm);
|
||||
border: 1px solid transparent; background: transparent;
|
||||
color: var(--text-secondary); cursor: pointer; position: relative;
|
||||
}
|
||||
.iconbtn:hover { background: var(--surface-hover); color: var(--text); }
|
||||
.iconbtn.txt { font: 600 11.5px/1 var(--sans); letter-spacing: .04em; }
|
||||
/* Unread badge. Semantic red — it means "something needs you", which is separate from brand. */
|
||||
.iconbtn .cnt {
|
||||
position: absolute; top: 1px; right: 0;
|
||||
min-width: 15px; height: 15px; padding: 0 3px;
|
||||
border-radius: 999px; background: var(--err); color: #fff;
|
||||
font: 600 10px/15px var(--sans); text-align: center;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
/* Launcher — how sibling apps appear side by side once they share a shell. */
|
||||
.applist { display: grid; gap: 8px; }
|
||||
.appcard {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
padding: 12px 14px; border: 1px solid var(--border);
|
||||
border-radius: var(--radius); background: var(--surface); color: inherit;
|
||||
}
|
||||
a.appcard:hover, button.appcard:hover { background: var(--surface-hover); text-decoration: none; }
|
||||
button.appcard { width: 100%; font: inherit; text-align: left; cursor: pointer; }
|
||||
.appcard.on { background: var(--surface-2); }
|
||||
.appcard .ai {
|
||||
width: 36px; height: 36px; flex: none; border-radius: var(--radius-sm);
|
||||
background: var(--brand-bg); color: var(--brand-fg);
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.appcard .an { font-weight: 550; }
|
||||
.appcard > svg:last-child { margin-left: auto; color: var(--text-faint); flex: none; }
|
||||
|
||||
.avatar {
|
||||
padding: 0; font-family: inherit; line-height: 1;
|
||||
width: 30px; height: 30px; flex: none; border-radius: 50%;
|
||||
/* --brand-ink, not --brand-bg: these are initials, and text needs 4.5:1. */
|
||||
background: var(--brand-ink); border: 1px solid transparent;
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
font-size: 11.5px; font-weight: 650; color: var(--brand-fg); cursor: pointer;
|
||||
}
|
||||
|
||||
.field { display: block; font-size: 12.5px; color: var(--text-secondary); }
|
||||
.field > input, .field > select, .field > textarea, .pw-field > input {
|
||||
display: block; width: 100%; margin-top: 5px;
|
||||
padding: 8px 10px; border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--border-input); background: var(--surface);
|
||||
color: var(--text); font: inherit; font-size: 13.5px;
|
||||
}
|
||||
.field > textarea { min-height: 78px; resize: vertical; }
|
||||
.pw-field { position: relative; display: block; }
|
||||
.pw-eye {
|
||||
position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
|
||||
width: 26px; height: 26px; border: 0; background: transparent;
|
||||
color: var(--text-muted); cursor: pointer; display: inline-flex;
|
||||
align-items: center; justify-content: center;
|
||||
}
|
||||
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||||
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
|
||||
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
|
||||
|
||||
/* ── page furniture ────────────────────────────────────────────────────── */
|
||||
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
|
||||
.page-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
|
||||
.page-head .sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
|
||||
/* `flex-wrap` on both, so a row of actions drops below the title instead of pushing the page
|
||||
sideways — a horizontally scrolling body is the one layout bug with no acceptable version. */
|
||||
.page-head .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
|
||||
.card {
|
||||
background: var(--surface); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); padding: 16px;
|
||||
}
|
||||
.card + .card { margin-top: 14px; }
|
||||
.card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 650; }
|
||||
.card h3 .n { color: var(--text-faint); font-weight: 500; margin-left: 6px; }
|
||||
|
||||
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
|
||||
.tile {
|
||||
background: var(--surface); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); padding: 14px 16px;
|
||||
}
|
||||
.tile .k { font-size: 12px; color: var(--text-muted); }
|
||||
.tile .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums;
|
||||
letter-spacing: -.02em; margin-top: 2px; }
|
||||
.tile.hot { border-color: var(--err); }
|
||||
.tile.hot .v { color: var(--err); }
|
||||
.tile.warn { border-color: var(--warn); }
|
||||
.tile.warn .v { color: var(--warn); }
|
||||
|
||||
.tablewrap { overflow-x: auto; }
|
||||
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
|
||||
th {
|
||||
text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
|
||||
color: var(--text-faint); font-weight: 600; padding: 6px 10px;
|
||||
border-bottom: 1px solid var(--border); white-space: nowrap;
|
||||
}
|
||||
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
|
||||
tr:last-child td { border-bottom: 0; }
|
||||
tbody tr.click:hover { background: var(--surface-2); cursor: pointer; }
|
||||
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
|
||||
td.mono { font-family: var(--mono); font-size: 12.5px; }
|
||||
|
||||
.chip {
|
||||
display: inline-flex; align-items: center; gap: 5px;
|
||||
padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
|
||||
background: var(--surface-2); color: var(--text-secondary);
|
||||
border: 1px solid var(--border); white-space: nowrap;
|
||||
}
|
||||
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
|
||||
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
|
||||
.chip.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
|
||||
|
||||
/* A severity stripe reads faster than a number when you are scanning a list for the one row
|
||||
that will ruin your week. */
|
||||
.stripe { border-left: 3px solid transparent; padding-left: 9px; }
|
||||
.stripe.s3 { border-left-color: var(--err); }
|
||||
.stripe.s2 { border-left-color: var(--warn); }
|
||||
.stripe.s1 { border-left-color: var(--border-input); }
|
||||
|
||||
.banner {
|
||||
padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px;
|
||||
border: 1px solid var(--border); background: var(--surface-2);
|
||||
}
|
||||
.banner.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
|
||||
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
|
||||
.banner.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
|
||||
.banner + .banner, .card > .banner:first-child { margin-bottom: 12px; }
|
||||
|
||||
.empty {
|
||||
padding: 40px 20px; text-align: center; color: var(--text-muted);
|
||||
border: 1px dashed var(--border); border-radius: var(--radius); font-size: 13.5px;
|
||||
}
|
||||
.faint { color: var(--text-muted); }
|
||||
.tiny { font-size: 12px; }
|
||||
.wrap { overflow-wrap: anywhere; }
|
||||
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
|
||||
.toolbar input, .toolbar select {
|
||||
padding: 7px 10px; border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--border-input); background: var(--surface);
|
||||
color: var(--text); font: inherit; font-size: 13.5px;
|
||||
}
|
||||
.toolbar input[type="search"] { min-width: 220px; }
|
||||
|
||||
/* ── modal ─────────────────────────────────────────────────────────────── */
|
||||
#modalRoot:empty { display: none; }
|
||||
.scrim {
|
||||
position: fixed; inset: 0; background: rgba(0, 0, 0, .4);
|
||||
display: flex; align-items: flex-start; justify-content: center;
|
||||
padding: 40px 16px; z-index: 40; overflow-y: auto;
|
||||
}
|
||||
.modal, .search-modal {
|
||||
background: var(--surface); border: 1px solid var(--border);
|
||||
border-radius: 10px; box-shadow: var(--shadow); width: 100%;
|
||||
}
|
||||
.modal { max-width: 560px; padding: 20px; }
|
||||
.modal.wide { max-width: 760px; }
|
||||
.modal h3 { margin: 0 0 4px; font-size: 16px; }
|
||||
.modal .msub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 16px; }
|
||||
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
|
||||
.modal .field + .field, .modal .grid2 + .field, .modal .field + .grid2 { margin-top: 12px; }
|
||||
|
||||
/* ── command palette ───────────────────────────────────────────────────── */
|
||||
/* After the modal on purpose: it sits on the dialog's `.scrim` and overrides its padding at equal
|
||||
specificity by coming later. It shares the dialog's box (see `.modal, .search-modal`) but not its
|
||||
padding, so its dividers run edge to edge. It sits higher than a dialog — reached from anywhere,
|
||||
including from on top of one — and lands where the eye already is rather than centred. */
|
||||
.search-scrim { padding-top: 12vh; }
|
||||
.search-modal { max-width: 620px; overflow: hidden; }
|
||||
.search-modal .sin {
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-muted);
|
||||
}
|
||||
.search-modal .sin input {
|
||||
flex: 1; border: 0; background: none; color: var(--text);
|
||||
font: inherit; font-size: 15px; outline: none; padding: 0;
|
||||
}
|
||||
.search-results { max-height: 58vh; overflow-y: auto; overflow-x: hidden; }
|
||||
.search-results .sgroup {
|
||||
padding: 8px 14px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
|
||||
text-transform: uppercase; color: var(--text-faint);
|
||||
}
|
||||
.search-results .sitem {
|
||||
display: flex; align-items: center; gap: 10px; width: 100%;
|
||||
padding: 8px 14px; border: 0; background: none; color: var(--text);
|
||||
font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
|
||||
}
|
||||
.search-results .sitem:hover, .search-results .sitem.on { background: var(--surface-hover); }
|
||||
.search-results .sitem .ic { color: var(--text-muted); flex: none; display: flex; }
|
||||
.search-results .sitem .sb { min-width: 0; flex: 1; }
|
||||
/* Block, or the ellipsis never applies: overflow clipping needs a box, and these are spans. */
|
||||
.search-results .sitem .st, .search-results .sitem .ss { display: block; }
|
||||
.search-results .sitem .st { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.search-results .sitem .ss {
|
||||
font-size: 12px; color: var(--text-muted);
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
}
|
||||
.search-modal .shint {
|
||||
padding: 8px 14px; border-top: 1px solid var(--border);
|
||||
font-size: 11.5px; color: var(--text-faint);
|
||||
}
|
||||
.search-empty { padding: 22px 14px; text-align: center; color: var(--text-muted); font-size: 13px; }
|
||||
|
||||
/* ── toast ─────────────────────────────────────────────────────────────── */
|
||||
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; }
|
||||
.toast {
|
||||
background: var(--accent); color: var(--accent-text);
|
||||
padding: 9px 15px; border-radius: var(--radius-sm);
|
||||
font-size: 13px; box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
* { transition: none !important; animation: none !important; }
|
||||
}
|
||||
|
||||
/* ── narrow screens ─────────────────────────────────────────────────────── */
|
||||
/* Breakpoints are last in the file on purpose, widest first: a media query adds no specificity, so
|
||||
an override only wins if it comes after the rule it overrides. */
|
||||
@media (max-width: 880px) {
|
||||
/* `visibility` as well as `transform`: a closed drawer must not be clickable or reachable by
|
||||
keyboard, and a translated-off panel still is. */
|
||||
.sidebar {
|
||||
position: fixed; z-index: 20;
|
||||
transform: translateX(-100%); visibility: hidden;
|
||||
/* Only `transform` transitions. `visibility` flips instantly in both directions, and is
|
||||
deliberately NOT delayed to animate the slide-out: any transition on visibility — even a
|
||||
0s one with a delay — needs the transition machinery to tick, and when frames are
|
||||
throttled (a background tab, a compositor that is not running) the drawer gets stuck in
|
||||
whichever state it was in. An instant close is worth more than 180ms of slide. */
|
||||
transition: transform .18s;
|
||||
}
|
||||
.sidebar.open { transform: none; visibility: visible; }
|
||||
#navToggle { display: inline-flex; }
|
||||
#navScrim.on { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 19; }
|
||||
.content { padding: 16px; }
|
||||
|
||||
/* Nine controls at 30px each leave the breadcrumb exactly 0 pixels. On a phone the top bar
|
||||
keeps only what you need constantly, and the rest moves into the account sheet. */
|
||||
.topbar .js-tool { display: none; }
|
||||
.appcard.m-only { display: flex; }
|
||||
.search-modal .shint { display: none; } /* no Esc key on a phone */
|
||||
.search-results { max-height: 62vh; }
|
||||
.topbar { padding: 10px 12px; gap: 6px; }
|
||||
.page-head { margin-bottom: 14px; }
|
||||
.page-head .acts { margin-left: 0; width: 100%; }
|
||||
.page-head .acts .btn { flex: 1; justify-content: center; }
|
||||
.toolbar input[type="search"] { min-width: 0; flex: 1; }
|
||||
.scrim { padding: 12px; }
|
||||
.search-scrim { padding-top: 8vh; }
|
||||
.modal { padding: 16px; }
|
||||
.modal .acts { flex-wrap: wrap; }
|
||||
.modal .acts .btn { flex: 1; justify-content: center; }
|
||||
.tile .v { font-size: 20px; }
|
||||
}
|
||||
|
||||
/* ── phones: data tables become stacked cards ──────────────────────────── */
|
||||
@media (max-width: 640px) {
|
||||
table.rt thead { display: none; }
|
||||
table.rt, table.rt tbody, table.rt tr { display: block; width: 100%; }
|
||||
table.rt tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
|
||||
table.rt tr:last-child { border-bottom: 0; }
|
||||
table.rt td {
|
||||
display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
|
||||
padding: 3px 0; border: 0; text-align: right; width: auto;
|
||||
}
|
||||
table.rt td::before {
|
||||
content: attr(data-label); flex: none; text-align: left; padding-top: 2px;
|
||||
font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint);
|
||||
}
|
||||
table.rt td:first-child { justify-content: flex-start; text-align: left; font-weight: 600; padding-bottom: 6px; }
|
||||
table.rt td:first-child::before, table.rt td.acts-cell::before { content: none; }
|
||||
table.rt td.acts-cell { justify-content: flex-end; padding-top: 8px; }
|
||||
table.rt td:not(:first-child) .row { justify-content: flex-end; }
|
||||
}
|
||||
-1156
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="2" y="2" width="20" height="20" rx="5" fill="#2f9e44"/><g stroke="#ebfbee" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" fill="none"><path d="M7 12.5l3.2 3.2L17 9"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 265 B |
@@ -1,96 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Lexicon — System zarządzania</title>
|
||||
<meta name="description" content="A self-hosted management console." />
|
||||
<meta name="robots" content="noindex" />
|
||||
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
|
||||
<script>/* set theme before first paint to avoid a flash */
|
||||
(function(){try{var m=localStorage.getItem('lexicon_theme')||'system';
|
||||
var dark=m==='dark'||(m==='system'&&window.matchMedia&&matchMedia('(prefers-color-scheme:dark)').matches);
|
||||
document.documentElement.dataset.theme=dark?'dark':'light';}catch(e){}})();</script>
|
||||
<link rel="stylesheet" href="app.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Hidden until the console knows which screen this is: ONLY showLogin() reveals it. restore()
|
||||
resolves the session with an awaited GET /auth/me, so a pane that is visible by default paints
|
||||
the sign-in card for a frame on every single load — and on the platform the card it flashes is a
|
||||
password form this app does not even have any more (hubMode() reads state.meta, which loadMeta()
|
||||
only fills after that same await). Nothing is lost by waiting: without the script the form cannot
|
||||
submit anyway. -->
|
||||
<div id="login" class="hidden">
|
||||
<div class="login-tools">
|
||||
<button class="iconbtn txt" id="btnLangLogin" title="Język" data-no-i18n>PL</button>
|
||||
<button class="iconbtn js-theme" id="btnThemeLogin" title="Motyw"></button>
|
||||
</div>
|
||||
<form class="login-card" id="loginForm">
|
||||
<svg class="logo" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect x="2" y="2" width="20" height="20" rx="5" fill="#2f9e44"/><g stroke="#ebfbee" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" fill="none"><path d="M7 12.5l3.2 3.2L17 9"/></g></svg>
|
||||
<h1>Lexicon</h1>
|
||||
<div class="lsub">System zarządzania</div>
|
||||
<label class="field">E-mail <input id="email" type="email" autocomplete="username" /></label>
|
||||
<label class="field" style="margin-top:12px">Hasło
|
||||
<span class="pw-field">
|
||||
<input id="password" type="password" autocomplete="current-password" />
|
||||
<button type="button" class="pw-eye" id="pwToggleLogin" title="Pokaż hasło" aria-label="Pokaż hasło"></button>
|
||||
</span>
|
||||
</label>
|
||||
<div id="loginErr" class="banner err hidden"></div>
|
||||
<button class="btn primary" id="btnLogin" type="submit">Zaloguj się</button>
|
||||
</form>
|
||||
<!-- Shown INSTEAD of the form when this deployment is a module of the platform: there is no
|
||||
password here, because there is no account here. One origin means the session created at the
|
||||
hub already arrives on every request to this module, so "sign in" is a link, not a form. The
|
||||
href is filled in from /meta's sign_in_url — a configured address, deliberately absolute:
|
||||
every OTHER url in this console is document-relative so that it works at the origin root and
|
||||
under a path prefix alike, but the hub is a different module and deriving its address from
|
||||
ours would bake its slug in here. Hidden, and empty of controls, unless the server says so. -->
|
||||
<div class="login-card hidden" id="hubCard">
|
||||
<svg class="logo" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect x="2" y="2" width="20" height="20" rx="5" fill="#2f9e44"/><g stroke="#ebfbee" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" fill="none"><path d="M7 12.5l3.2 3.2L17 9"/></g></svg>
|
||||
<h1>Lexicon</h1>
|
||||
<div class="lsub">System zarządzania</div>
|
||||
<p id="hubCopy" style="margin:18px 0 0;font-size:13px;line-height:1.55;color:var(--text-secondary)">
|
||||
<span>Jedno konto obejmuje tu wszystko.</span>
|
||||
<span>Zaloguj się raz, a to otworzy się bez drugiego hasła.</span>
|
||||
</p>
|
||||
<!-- No inline styling: `.login-card .btn` already makes it full-width and centred, exactly as
|
||||
the form's own submit button. An anchor rather than a button because it navigates. -->
|
||||
<a class="btn primary hidden" id="btnHub">Zaloguj się</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="app" class="hidden">
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<div class="brand">
|
||||
<svg class="logo" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect x="2" y="2" width="20" height="20" rx="5" fill="#2f9e44"/><g stroke="#ebfbee" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" fill="none"><path d="M7 12.5l3.2 3.2L17 9"/></g></svg>
|
||||
<span class="nm">Lexicon</span>
|
||||
</div>
|
||||
<nav class="nav" id="nav"></nav>
|
||||
<div class="nav sidebar-foot"><div class="nav-item" id="navAdmin"></div></div>
|
||||
</aside>
|
||||
<div id="navScrim"></div>
|
||||
<div class="main">
|
||||
<header class="topbar">
|
||||
<button class="iconbtn" id="navToggle" title="Menu"></button>
|
||||
<div class="crumb" id="crumb"></div>
|
||||
<div class="spacer"></div>
|
||||
<button class="searchbar js-tool" id="aSearch" title="Szukaj… (Ctrl+K)">
|
||||
<span class="si"></span><span class="sp">Szukaj…</span><kbd>Ctrl K</kbd>
|
||||
</button>
|
||||
<span class="vdiv js-tool"></span>
|
||||
<button class="iconbtn js-theme js-tool" id="aTheme" title="Motyw"></button>
|
||||
<button class="iconbtn txt js-tool" id="aLang" title="Język" data-no-i18n>PL</button>
|
||||
<button type="button" class="avatar" id="aUser" title="Konto" aria-label="Konto" aria-haspopup="dialog">?</button>
|
||||
</header>
|
||||
<main class="content" id="content"></main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modalRoot"></div>
|
||||
<div id="toast"></div>
|
||||
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user