Compare commits

..

11 Commits

Author SHA1 Message Date
mnovak dfbf4cb713 [web] Domi UI: no allowJs needed with v1.0.4; docs say v1.0.4 2026-11-23 00:40:28 +01:00
mnovak c9e82579b3 [ui] Domi UI: vendor @domi/ui v1.0.4 (Strike.svelte typed; unedited) 2026-11-23 00:40:17 +01:00
mnovak 1cc77adb12 [web] Licence: the CPAL §15 network-use note beside the source link in About and the README 2026-11-23 00:35:52 +01:00
mnovak 7d90493446 [docs] Domi UI: v1.0.3 under CPAL, one credit for both, the Nix hash the NixOS runner reported 2026-11-23 00:31:01 +01:00
mnovak e66ebbc1f2 [repo] Merge: main into feature/domi-ui (CPAL-1.0); @domi/ui v1.0.3 vendored (CPAL-1.0) with <DomiCredit /> and the README line 2026-11-23 00:30:56 +01:00
mnovak f59f8e251d [docs] Domi UI: vendored at a tag, how to upgrade, the Nix hash still to paste 2026-11-23 00:06:10 +01:00
mnovak b40e2d3b8e [web] Domi UI: @domi/ui as workspace:* (no Gitea fetch), allowJs instead of the type shim, web.nix sources the vendored package 2026-11-23 00:06:05 +01:00
mnovak 06438aa386 [ui] Domi UI: vendor @domi/ui v1.0.2 (domi-design tools/vendor.mjs, MPL-2.0, unedited) 2026-11-23 00:05:57 +01:00
mnovak 7f006589ab [web] Domi UI: pin @domi/ui v1.0.1 (the leaf hover keeps its label readable) 2026-11-22 23:29:49 +01:00
mnovak e02819d51e [docs] Domi UI: what comes from @domi/ui, the seals, the Nix blocker, Atrium (Ianitor is free) 2026-11-22 23:24:04 +01:00
mnovak afade6d98c [web] Domi UI: the web UI on @domi/ui v1.0.0 (fonts, roles, Button, TextField with seals, Checkbox, Select, Segmented) 2026-11-22 23:24:03 +01:00
34 changed files with 53 additions and 704 deletions
-6
View File
@@ -13,12 +13,6 @@ runner: nixos
env:
CARGO_TERM_COLOR: "never"
CARGO_BUILD_JOBS: "8"
# Each of control's integration tests starts its own edge, Caddy and upstreams. With the tests' old 2 s margin for
# control's confirmation (production: 30 s), a status call on the loaded shared runner took longer and edge
# reverted the trial by itself, as designed (runs rc344zj96yjz1, rqzephjsp7983, rzqmqbvx970f8, rja3pbbd14fk1;
# 2026-12-02). The margin is 15 s now (crates/control/tests/common/mod.rs), and four tests at a time keep the
# runner's load down.
RUST_TEST_THREADS: "4"
steps:
- id: workspace-tests
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c cargo test --workspace --no-fail-fast
-19
View File
@@ -1,19 +0,0 @@
{
"commit": "774bd8c7c3b82a64c25d47010cdbdc06c60fc9e7",
"nixpkgs": "c56a87d8e41ce69bd2af57eb35dcc117a9dfca33",
"outputs": {
"ianitor": {
"narHash": "sha256-hlX5oiJQPTieETbjojaZnPUGcSgPrKqO2vPsr2o2Xok=",
"narSize": 24455232,
"storePath": "/nix/store/mrq37ldbyn0zg04iwwj22pp05hlpx5y8-ianitor-1.0.0"
},
"ianitor-web": {
"narHash": "sha256-cR8Lq5LNQoQ7xWa40jpjmRybUC8tS9XuXAtojDmCg2c=",
"narSize": 598000,
"storePath": "/nix/store/vsrm3326zm440gwp17nqg3g3bixb3cmm-ianitor-web-1.0.0"
}
},
"sourceTree": "352c508b4c89be0fb8dea44dbe0d850dce4e935095ab0b3f370802e07aff6fa2",
"system": "x86_64-linux",
"version": "1.0.0"
}
-19
View File
@@ -1,19 +0,0 @@
Ianitor 1.0.0 is the first version meant to run beside Caddy on a real server.
- **Hardened edge.** A 60-second deadline for request headers (slow clients cannot hold a connection open), DNS
lookups on their own bounded threads, pipelined requests on both listeners, and a Unix socket for running beside
Caddy, on which edge trusts only Caddy's forwarded address.
- **The control plane on its own socket.** The web UI reaches control through a socket that only edge can use; the
sign-in proof is honoured only there.
- **Five test layers.** The same requests against Ianitor and Caddy with the answers compared, h2spec and testssl.sh,
fuzzing of the config, header rules and share tokens, NixOS VM tests, and load and soak runs against Caddy, with
the results kept as data (bench/results). On the NixOS runner Ianitor was ahead in every row; on WSL2 (2026-11-18)
Caddy was faster on plain HTTP/1.1 under heavy load and on new TLS connections.
- **A verifiable build.** The release publishes the Nix build's hashes. Anyone can rebuild the tag and compare.
- **The shared Domi design system.** The web UI's buttons, text fields, checkboxes and choices come from @domi/ui;
Settings, About shows the running version.
- **A new licence.** From this version Ianitor is under CPAL-1.0 and shows the Built on Domi credit. 0.2.0 and
earlier stay MPL-2.0.
Updates stay a deploy. Fabrica's Deploy moves the server to the new commit and switches back if the health check
does not answer.
Generated
+8 -8
View File
@@ -861,8 +861,8 @@ dependencies = [
[[package]]
name = "domi-pki"
version = "1.0.1"
source = "git+https://gitea.marek-novak.cz/mnovak/domi-pki?tag=v1.0.1#801dfbdc75cff8ea545422b9ada2fa4a3b6693f8"
version = "1.0.0"
source = "git+https://gitea.marek-novak.cz/mnovak/domi-pki?tag=v1.0.0#b1ec5b3196fc22355270f381e5a7748c50e3380d"
dependencies = [
"base64 0.22.1",
"rcgen",
@@ -1304,7 +1304,7 @@ dependencies = [
[[package]]
name = "ianitor-control"
version = "1.0.0"
version = "0.2.0"
dependencies = [
"axum",
"base64 0.22.1",
@@ -1331,7 +1331,7 @@ dependencies = [
[[package]]
name = "ianitor-core"
version = "1.0.0"
version = "0.2.0"
dependencies = [
"base64 0.22.1",
"domi-pki",
@@ -1348,7 +1348,7 @@ dependencies = [
[[package]]
name = "ianitor-diff"
version = "1.0.0"
version = "0.2.0"
dependencies = [
"bytes",
"http-body-util",
@@ -1366,7 +1366,7 @@ dependencies = [
[[package]]
name = "ianitor-edge"
version = "1.0.0"
version = "0.2.0"
dependencies = [
"arc-swap",
"async-trait",
@@ -1394,7 +1394,7 @@ dependencies = [
[[package]]
name = "ianitor-fuzz"
version = "1.0.0"
version = "0.2.0"
dependencies = [
"ianitor-core",
"ianitor-edge",
@@ -1403,7 +1403,7 @@ dependencies = [
[[package]]
name = "ianitor-testkit"
version = "1.0.0"
version = "0.2.0"
dependencies = [
"bytes",
"futures-util",
+2 -2
View File
@@ -12,7 +12,7 @@ members = [
exclude = ["tests/fuzz/fuzz"]
[workspace.package]
version = "1.0.0"
version = "0.2.0"
edition = "2024"
rust-version = "1.89"
license = "CPAL-1.0"
@@ -23,7 +23,7 @@ ianitor-core = { path = "crates/core" }
ianitor-edge = { path = "crates/edge" }
ianitor-testkit = { path = "tests/support" }
# The Domi CA, shared with Fabrica (docs/32_coherence.md T3a); pinned by tag.
domi-pki = { git = "https://gitea.marek-novak.cz/mnovak/domi-pki", tag = "v1.0.1" }
domi-pki = { git = "https://gitea.marek-novak.cz/mnovak/domi-pki", tag = "v1.0.0" }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.145"
toml = "1.2.1"
+1 -2
View File
@@ -59,8 +59,7 @@ services.ianitor = {
Then `ianitor-control token create --name laptop --config /etc/ianitor/control.toml` for the API, or the web UI
behind Authelia ([docs/api.md](docs/api.md), "Sign-in"). Beside an existing Caddy, edge can sit behind it on a Unix
socket: [docs/deploy/beside-caddy.md](docs/deploy/beside-caddy.md) (on .217:
[beside-caddy-217.md](docs/deploy/beside-caddy-217.md)). The CA: [docs/pki.md](docs/pki.md).
socket: [docs/deploy/beside-caddy.md](docs/deploy/beside-caddy.md). The CA: [docs/pki.md](docs/pki.md).
## Tests
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "web",
"version": "1.0.0",
"version": "0.2.0",
"private": true,
"license": "CPAL-1.0",
"description": "Ianitor Domi web UI (Svelte 5, runes, TypeScript strict). A pure client of the control API.",
-6
View File
@@ -1,6 +0,0 @@
// SPDX-License-Identifier: CPAL-1.0
// Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
// License 1.0: see LICENSE (its Exhibit A is this file's notice).
/** Ianitor's version, from apps/web/package.json at build time (vite.config.ts `define`). */
declare const __IANITOR_VERSION__: string;
+1 -2
View File
@@ -13,7 +13,6 @@
import type { CreatedToken, ShareLink, TokenRow } from "../lib/types";
let { tab }: { tab: string } = $props();
const version = __IANITOR_VERSION__;
const TABS = [
{ id: "general", label: "General" },
{ id: "api", label: "API" },
@@ -242,7 +241,7 @@
{/if}
{/if}
{:else}
<p>Ianitor Domi {version}</p>
<p>Ianitor Domi 0.1.0</p>
<p>CPAL-1.0 (Common Public Attribution License 1.0). Ianitor 0.2.0 and earlier stay MPL-2.0.</p>
<div class="about-credit"><DomiCredit /></div>
<p>Built, tested and signed by Fabrica Domi</p>
-4
View File
@@ -2,7 +2,6 @@
// Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
// License 1.0: see LICENSE (its Exhibit A is this file's notice).
import { readFileSync } from "node:fs";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vitest/config";
@@ -12,12 +11,9 @@ import { defineConfig } from "vitest/config";
// $IANITOR_DEV_TOKEN, which `ianitor-control --dev` prints.
const control = process.env.IANITOR_CONTROL ?? "http://127.0.0.1:7878";
const token = process.env.IANITOR_DEV_TOKEN;
// The version Settings, About shows: package.json's, which scripts/check-version.mjs keeps equal to Cargo.toml's.
const version: string = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
export default defineConfig({
plugins: [svelte()],
define: { __IANITOR_VERSION__: JSON.stringify(version) },
server: {
host: "127.0.0.1",
port: 5173,
@@ -1,33 +0,0 @@
engine,scenario,connections,duration_s,requests,rps,p50_ms,p90_ms,p99_ms,max_ms,success_rate,non_2xx,rss_kb_after
ianitor,https-h1-keepalive,1,20,55592,2779,0.23,0.52,2.51,59.45,1.0,0,12160
ianitor,https-h2,1,20,37767,1888,0.38,0.93,3.16,30.57,1.0,0,12544
ianitor,https-h1-keepalive,16,20.03,138828,6933,1.68,4.48,10.77,140.32,1.0,0,14828
ianitor,https-h2,16,20.03,155983,7787,1.51,3.86,9.77,38.23,1.0,0,16204
ianitor,https-h1-keepalive,64,20.03,187302,9354,5.97,11.59,19.44,240.08,1.0,0,20388
ianitor,https-h2,64,20.03,202558,10115,5.56,10.59,17.44,43.53,1.0,0,23908
ianitor,https-h1-keepalive,256,20.04,189950,9489,25.48,40.59,58.64,243.89,1.0,0,40552
ianitor,https-h2,256,20.04,199098,9950,24.33,37.98,53.97,98.61,1.0,0,52900
ianitor,https-h1-new-conn,16,20.02,41396,2069,7.11,12.11,19.72,56.94,1.0,0,52900
ianitor,http-redirect,64,20.04,627650,31318,1.31,4.76,10.27,38.26,1.0,627650,57108
caddy,https-h1-keepalive,1,20,44963,2248,0.3,0.61,2.76,47.11,1.0,0,52472
caddy,https-h2,1,20,33450,1672,0.42,0.96,3.37,48.65,1.0,0,52896
caddy,https-h1-keepalive,16,20.04,97182,4849,1.81,6.3,27.14,230.73,1.0,0,60304
caddy,https-h2,16,20.05,108679,5420,2.14,5.69,12.88,54.44,1.0,0,60620
caddy,https-h1-keepalive,64,20.04,151724,7574,5.96,17.62,38.71,118.41,1.0,0,69540
caddy,https-h2,64,20.05,137555,6864,7.56,17.87,31.92,76.7,1.0,0,69328
caddy,https-h1-keepalive,256,20.06,167986,8385,23.95,59.98,113.77,391.74,1.0,0,121336
caddy,https-h2,256,20.09,135177,6739,31.92,69.7,115.94,305.99,1.0,0,116952
caddy,https-h1-new-conn,16,20.03,32184,1607,8.43,17.66,30.92,116.75,1.0,0,82032
caddy,http-redirect,64,20.04,558189,27850,0.55,6.83,19.02,76.63,1.0,558189,88228
caddy_gomaxprocs2,https-h1-keepalive,1,20,50083,2504,0.28,0.54,2.29,43.96,1.0,0,50432
caddy_gomaxprocs2,https-h2,1,20,38506,1925,0.39,0.7,2.72,16.93,1.0,0,50944
caddy_gomaxprocs2,https-h1-keepalive,16,20.05,135842,6776,1.78,4.64,10.16,57.71,1.0,0,53920
caddy_gomaxprocs2,https-h2,16,20.01,94448,4721,2.65,6.44,13.21,41.73,1.0,0,54692
caddy_gomaxprocs2,https-h1-keepalive,64,20.06,127693,6369,8.48,18.72,32.77,116.52,1.0,0,63180
caddy_gomaxprocs2,https-h2,64,20.02,89264,4463,13.09,24.34,37.8,80.83,1.0,0,62156
caddy_gomaxprocs2,https-h1-keepalive,256,20.04,98029,4904,49.05,82,121.88,274,1.0,0,95088
caddy_gomaxprocs2,https-h2,256,20.07,52318,2620,77.85,187.61,372.51,669.97,1.0,0,88524
caddy_gomaxprocs2,https-h1-new-conn,16,20.03,27091,1354,10.3,19.96,34.57,95.53,1.0,0,67256
caddy_gomaxprocs2,http-redirect,64,20.03,409412,20439,1.88,7.58,16.64,54.15,1.0,409412,68240
ianitor,soak-https-h1,32,300.04,2384538,7947,3.28,7.36,15,164.02,1.0,0,56784
caddy,soak-https-h1,32,300.05,2361094,7869,2.85,8.3,20.11,190.58,1.0,0,67676
1 engine scenario connections duration_s requests rps p50_ms p90_ms p99_ms max_ms success_rate non_2xx rss_kb_after
2 ianitor https-h1-keepalive 1 20 55592 2779 0.23 0.52 2.51 59.45 1.0 0 12160
3 ianitor https-h2 1 20 37767 1888 0.38 0.93 3.16 30.57 1.0 0 12544
4 ianitor https-h1-keepalive 16 20.03 138828 6933 1.68 4.48 10.77 140.32 1.0 0 14828
5 ianitor https-h2 16 20.03 155983 7787 1.51 3.86 9.77 38.23 1.0 0 16204
6 ianitor https-h1-keepalive 64 20.03 187302 9354 5.97 11.59 19.44 240.08 1.0 0 20388
7 ianitor https-h2 64 20.03 202558 10115 5.56 10.59 17.44 43.53 1.0 0 23908
8 ianitor https-h1-keepalive 256 20.04 189950 9489 25.48 40.59 58.64 243.89 1.0 0 40552
9 ianitor https-h2 256 20.04 199098 9950 24.33 37.98 53.97 98.61 1.0 0 52900
10 ianitor https-h1-new-conn 16 20.02 41396 2069 7.11 12.11 19.72 56.94 1.0 0 52900
11 ianitor http-redirect 64 20.04 627650 31318 1.31 4.76 10.27 38.26 1.0 627650 57108
12 caddy https-h1-keepalive 1 20 44963 2248 0.3 0.61 2.76 47.11 1.0 0 52472
13 caddy https-h2 1 20 33450 1672 0.42 0.96 3.37 48.65 1.0 0 52896
14 caddy https-h1-keepalive 16 20.04 97182 4849 1.81 6.3 27.14 230.73 1.0 0 60304
15 caddy https-h2 16 20.05 108679 5420 2.14 5.69 12.88 54.44 1.0 0 60620
16 caddy https-h1-keepalive 64 20.04 151724 7574 5.96 17.62 38.71 118.41 1.0 0 69540
17 caddy https-h2 64 20.05 137555 6864 7.56 17.87 31.92 76.7 1.0 0 69328
18 caddy https-h1-keepalive 256 20.06 167986 8385 23.95 59.98 113.77 391.74 1.0 0 121336
19 caddy https-h2 256 20.09 135177 6739 31.92 69.7 115.94 305.99 1.0 0 116952
20 caddy https-h1-new-conn 16 20.03 32184 1607 8.43 17.66 30.92 116.75 1.0 0 82032
21 caddy http-redirect 64 20.04 558189 27850 0.55 6.83 19.02 76.63 1.0 558189 88228
22 caddy_gomaxprocs2 https-h1-keepalive 1 20 50083 2504 0.28 0.54 2.29 43.96 1.0 0 50432
23 caddy_gomaxprocs2 https-h2 1 20 38506 1925 0.39 0.7 2.72 16.93 1.0 0 50944
24 caddy_gomaxprocs2 https-h1-keepalive 16 20.05 135842 6776 1.78 4.64 10.16 57.71 1.0 0 53920
25 caddy_gomaxprocs2 https-h2 16 20.01 94448 4721 2.65 6.44 13.21 41.73 1.0 0 54692
26 caddy_gomaxprocs2 https-h1-keepalive 64 20.06 127693 6369 8.48 18.72 32.77 116.52 1.0 0 63180
27 caddy_gomaxprocs2 https-h2 64 20.02 89264 4463 13.09 24.34 37.8 80.83 1.0 0 62156
28 caddy_gomaxprocs2 https-h1-keepalive 256 20.04 98029 4904 49.05 82 121.88 274 1.0 0 95088
29 caddy_gomaxprocs2 https-h2 256 20.07 52318 2620 77.85 187.61 372.51 669.97 1.0 0 88524
30 caddy_gomaxprocs2 https-h1-new-conn 16 20.03 27091 1354 10.3 19.96 34.57 95.53 1.0 0 67256
31 caddy_gomaxprocs2 http-redirect 64 20.03 409412 20439 1.88 7.58 16.64 54.15 1.0 409412 68240
32 ianitor soak-https-h1 32 300.04 2384538 7947 3.28 7.36 15 164.02 1.0 0 56784
33 caddy soak-https-h1 32 300.05 2361094 7869 2.85 8.3 20.11 190.58 1.0 0 67676
+4 -27
View File
@@ -237,16 +237,9 @@ mod unix {
"{stage}: edge.json untouched"
);
}
// A trial edge was serving reverts by itself at its deadline (watch 2 s + margin 15 s,
// common/mod.rs: room for a loaded runner between the trial's load and the confirmation).
let deadline = std::time::Instant::now() + Duration::from_secs(30);
let st = loop {
let st = env.edge_status().await;
if st["trial"].is_null() || std::time::Instant::now() > deadline {
break st;
}
tokio::time::sleep(Duration::from_millis(250)).await;
};
// A trial edge was serving reverts by itself at its deadline (watch 2 s + margin 2 s).
tokio::time::sleep(Duration::from_secs(5)).await;
let st = env.edge_status().await;
assert!(st["trial"].is_null(), "{stage}: trial still running: {st}");
if !confirmed {
assert_eq!(
@@ -795,23 +788,7 @@ mod unix {
)
.await;
let id = r.json["apply"]["id"].as_str().unwrap().to_owned();
// Edge goes once the trial is loaded and watched (a fixed 1.5 s was before the reload on
// a loaded runner, layers run rja3pbbd14fk1).
let deadline = std::time::Instant::now() + Duration::from_secs(20);
loop {
let s = env
.call("GET", &format!("/api/v1/applies/{id}"), None)
.await;
if s.json["state"] == "watching" {
break;
}
assert!(
std::time::Instant::now() < deadline,
"never watched: {}",
s.text
);
tokio::time::sleep(Duration::from_millis(50)).await;
}
tokio::time::sleep(Duration::from_millis(1500)).await;
env.stop_edge();
let rec = env.wait_apply(&id).await;
assert_eq!(rec["state"], "needs_attention", "{rec}");
+1 -4
View File
@@ -174,10 +174,7 @@ state_dir = "{state}"
credentials_dir = "{creds}"
watch_secs = {watch}
watch_every_secs = 1
# Production: 30 s. Control starts its watch after the trial's journal is written, which took
# over 5 s on the loaded shared runner (layers run rja3pbbd14fk1); edge's deadline counts from
# the trial's load. The tests that wait out a deadline use this value (apply.rs, engine_switch.rs).
trial_margin_secs = 15
trial_margin_secs = 2
health_poll_secs = 1
[routes]
+3 -3
View File
@@ -575,10 +575,10 @@ esac
let st = ce.env.wait_control_exit(Duration::from_secs(30));
eprintln!("QC control exit: {st:?}");
assert!(st.is_some());
// Past the Caddy guard's deadline: watch 2 s + margin 15 s (common/mod.rs) + 5 s.
tokio::time::sleep(Duration::from_secs(27)).await;
// Longer than edge's trial deadline would allow.
tokio::time::sleep(Duration::from_secs(15)).await;
let during = visit(&ce.env, ce.https, "b.test").await;
eprintln!("QC b.test through Caddy 27 s after the crash, control down: {during}");
eprintln!("QC b.test through Caddy 15 s after the crash, control down: {during}");
ce.env.start_control(None);
tokio::time::sleep(Duration::from_secs(3)).await;
let after = visit(&ce.env, ce.https, "b.test").await;
+2 -2
View File
@@ -27,8 +27,8 @@ rustPlatform.buildRustPackage {
cargoLock = {
lockFile = ../../Cargo.lock;
# domi-pki, the shared Domi CA (Cargo.toml pins tag v1.0.1, CPAL-1.0): the NAR hash of its tree at that tag.
outputHashes."domi-pki-1.0.1" = "sha256-C3l3Iqo1pFn/k977Y6TMGdh4aRDU76+W4/kyxv+1mXw=";
# domi-pki, the shared Domi CA (Cargo.toml pins tag v1.0.0): the NAR hash of its tree at that tag.
outputHashes."domi-pki-1.0.0" = "sha256-JdknFJ5cxsI1/MtWmvsItoE6f7znJjUr4C/rwUEz9i4=";
};
# libz-ng-sys (Pingora's compression) builds zlib-ng with CMake.
nativeBuildInputs = [ cmake ];
+1 -2
View File
@@ -51,8 +51,7 @@ let
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.python3}/bin/python3 -m http.server 8000 --bind 127.0.0.1 --directory /etc";
};
# git: the tests read control's routes repository (vm-apply-reverts).
environment.systemPackages = [ pkgs.curl pkgs.jq pkgs.openssl pkgs.git ];
environment.systemPackages = [ pkgs.curl pkgs.jq pkgs.openssl ];
};
# Python helpers shared by the test scripts.
+2 -28
View File
@@ -165,37 +165,11 @@ Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sit
| 1 Core and engine | Done | Merged to main 2026-11-07. Tests run in WSL2; ACME checked only against Pebble. The Let's Encrypt staging check moved to phase 3 (Mark, 2026-11-07). |
| 2 Control plane | Done | Merged to main 2026-11-07 (PR 3): routes repo, journaled apply with trial/watch/revert, undo, restore, share links, API tokens, REST API + OpenAPI, `--dev`. Four QC rounds; every finding fixed or listed in Handover. Real Gitea, systemd credentials and Authelia not exercised. |
| 3 Web UI, PKI, NixOS | Built and merged; Done criteria pending Mark | Merged to main 2026-11-08 (PR 5): web UI (murex palette), Domi CA and device mTLS, UI sign-in behind Authelia, runtime engine switch with changes under Caddy, NixOS flake, module and VM tests. Click smoke test green. Not yet done: VM tests run on a KVM host, Mark's nixos-rebuild on the staging mirror, deploy/test-access.sh there, the LE staging check. |
| 4 Hardening and release | Pipeline green, v1.0.0 tagged; signature and the two weeks pending Mark | Merged to main 2026-11-22 (PR 13): hardening backlog, all five test layers, the `layers` and `verify-nix` pipelines, the release pin, README, support.md, launch drafts, the release kit. 2026-12-02 (PR 18): version 1.0.0, the first Nix pin (both outputs rebuilt identical on the NixOS runner), `layers` green on the shared runner (all five layers, VM tests included; run raty64ymvsmbe), v1.0.0 tagged at 4c157b3 and its release started (release run rekp4ztrvy2jr). Not yet done: Mark's release card and the domi-release signature, the run beside Caddy on .217 ([deploy/beside-caddy-217.md](deploy/beside-caddy-217.md), Aula deploys), the GitHub mirror (later). |
| 4 Hardening and release | Built and merged; Done criteria pending Mark | Merged to main 2026-11-22 (PR 13): hardening backlog (header deadline, own resolver, pipelining, proxy socket for edge beside Caddy, control UI socket), all five test layers runnable (fuzz, h2spec/testssl, bench vs Caddy committed as data), Artifex `layers` and `verify-nix` pipelines, a release pin that cannot name other code, README, support.md, launch drafts; with the release kit and Fabrica onboarding (source archive, Aula page, Playwright e2e, 2026-11-19). Not yet done: the first Nix pin and the VM tests (need a machine with Nix and KVM), a pipeline run, signed v1.0.0, the GitHub mirror (later), the two-week run beside Caddy. |
## 10. Handover
(Rewritten at the end of every session: what changed, what was not verified, which build is deployed, the next step.)
**2026-12-02: v1.0.0: the first Nix pin, the `layers` pipeline green, the tag; .217 prepared (PR 18, then this PR).**
- **Changed:**
- Version 1.0.0; Settings, About shows the running version; `.fabrica/notes/1.0.0.md`.
- `.fabrica/nix/pin.json` from the NixOS runner (`nix-pin.sh --check` prints the pin it would write; docs/release.md 1a).
- The shared runner's first `layers` runs found five things, all fixed:
- control's pki tests need openssl (now in the `ci` shell);
- control's integration tests overload the runner (`RUST_TEST_THREADS=4`);
- the tests' 2 s trial margin was too short there; it is 15 s now (production 30 s), and two tests wait on a state;
- the VM test server had no git;
- bench.sh died silently without `ss` (iproute2 in the `ci` shell; a missing pid is no longer fatal).
- bench/results/2026-12-02-fabrica-runner.csv: on the runner Ianitor is ahead of Caddy in every row; the notes say so,
beside the WSL2 run where Caddy led on HTTP/1.1 under load and new TLS connections.
- docs/deploy/beside-caddy-217.md: the exact lines for .217's nixos-config (input, module, modules/ianitor.nix,
caddy.nix), the secrets, the intermediate, the two host files (flower, esp32ide), the checks and the rollback.
- **Tests:** layers `raty64ymvsmbe`: workspace 267/267 (core 108, edge 71, control 78, diff 4, fuzz 4, testkit 2);
h2spec Ianitor 145/146, 0 failed (Caddy 4 failed); testssl A+ both; fuzz 5x120 s, no crash; the five VM tests; load
and soak. verify-nix `rh5wz4xza5v9x` at the pinned tree: `matches .fabrica/nix/pin.json`. Local: control 78/78 in
WSL, vitest 23, svelte-check clean, release-pin 7.
- **Deployed:** nothing. .217 is unchanged; Aula deploys from beside-caddy-217.md.
- **Not verified:** the module against .217's nixpkgs 24.11 (`nixos-rebuild build` there is the check); the two vhosts'
other lines in caddy.nix; the release's e2e step on the Windows runner (it runs in release run rekp4ztrvy2jr).
- **Needs Mark:** the v1.0.0 release card and the domi-release signature; domi-root.crt (public) for .217; signing the
intermediate CSR offline; confirming flower and esp32ide as the trial hosts; the pki-password into Custos; PR 10
(t4-anywhere); the 90 % rule in CLAUDE.md, typed by him.
- **Next step:** Aula deploys to .217 from beside-caddy-217.md; test-access.sh passes; the two weeks start (write the date here).
**2026-11-23: Ianitor is CPAL-1.0 (Mark's decision for every public Domi repo; F:\Akce\domi-licence).**
- **Changed:** LICENSE is the kit's template with only `{ORIGINAL_CODE}` = Ianitor. Every header (166 files) is an
`SPDX-License-Identifier: CPAL-1.0` notice; Cargo.toml, the fuzz crate, the three package.json, the Nix package
@@ -208,7 +182,7 @@ Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sit
- **Deployed:** nothing. **Not verified:** the phone layout of the credit by eye; the Nix build (`cpal10`).
**2026-11-23: the web UI on @domi/ui, the shared Domi design system (docs/domi-ui.md); PR 14, squash-merged.**
- **Changed:** `@domi/ui` v1.0.4 (then v1.1.0) vendored in packages/domi-ui (domi-design tools/vendor.mjs; CPAL-1.0, unedited) and used as `workspace:*`; `<DomiCredit />` is the credit on every screen; its fonts, roles (`data-domi-room="ianitor"`,
- **Changed:** `@domi/ui` v1.0.4 vendored in packages/domi-ui (domi-design tools/vendor.mjs; CPAL-1.0, unedited) and used as `workspace:*`; `<DomiCredit />` is the credit on every screen; its fonts, roles (`data-domi-room="ianitor"`,
the same hex) and controls replace Ianitor's copies. Buttons are its Button through Ianitor's adapter (desktop sizes
kept); every text field is its TextField with a seal; checkboxes, the secret picker and segmented controls are its
components. Ianitor's 22 role names are renamed to `--domi-*`; its own tokens and components stay in packages/ui.
-263
View File
@@ -1,263 +0,0 @@
# Ianitor beside Caddy on .217: two hosts for two weeks
This is ROADMAP §1.12 on the production server (192.168.100.217), in the shape of [beside-caddy.md](beside-caddy.md):
Caddy keeps 80/443 and its certificates, and for two low-risk hosts it hands each request to Ianitor's edge on a Unix
socket. Every other host stays as it is. **Prepared, not applied.** Every command here runs on .217 by Mark, or by
Aula, which deploys there for him; Ianitor's own sessions never touch .217. The code arrives as a git bundle (.217
has no Gitea credentials).
The facts below are from .217's config as read on 2026-12-02 (flake `/home/apps/nixos-config`, output `.#nixos-vm`,
nixpkgs 24.11, Caddy from nixos-unstable, no sops: secrets are root-only files).
## The two hosts
| Host | Today in Caddy | Why it is low-risk |
| :-- | :-- | :-- |
| `flower.marek-novak.cz` | `reverse_proxy 127.0.0.1:8092` | a static presentation app, no sign-in |
| `esp32ide.marek-novak.cz` | `reverse_proxy 127.0.0.1:8082` | a static web IDE, used only by Mark, no sign-in |
```text
visitor ── Caddy :443 (Let's Encrypt, as today) ── unix//run/ianitor-proxy/edge.sock ── Ianitor edge ── the app
```
Nothing new listens beyond loopback: edge's TCP listeners are 127.0.0.1:18080 and :18443, control is 127.0.0.1:7878
and its UI socket. Before the switch, check these are free: `ss -ltn | grep -E ':(18080|18443|7878)\b'` prints
nothing.
## 1. Bring the code over (Ianitor v1.0.0)
On a machine with Gitea access: `git clone --mirror https://gitea.marek-novak.cz/mnovak/ianitor.git && git -C
ianitor.git bundle create ianitor-v1.0.0.bundle v1.0.0`. On .217, as `apps`:
```sh
git clone --branch v1.0.0 ianitor-v1.0.0.bundle /home/apps/ianitor
git -C /home/apps/ianitor rev-parse 'v1.0.0^{commit}' # must print 4c157b334779b27171f62029671e9e2478e37717
```
That commit's Nix outputs are pinned in its `.fabrica/nix/pin.json` (ianitor `sha256-hlX5oiJQ…`, ianitor-web
`sha256-cR8Lq5LN…`); `nix path-info --json` of the switched system's Ianitor can be compared with it
([../verify.md](../verify.md)).
The build fetches one git dependency, domi-pki, from `https://gitea.marek-novak.cz/mnovak/domi-pki` (public, no
credentials; a fixed-output fetch checked by its hash). Everything else comes from cache.nixos.org and crates.io.
## 2. flake.nix (three lines)
In `inputs`, after `aula.inputs.fundamentum.url`:
```nix
# Ianitor Domi: the Pingora reverse proxy, beside Caddy on flower and esp32ide. A local clone at the tag.
# Update: bring the next tag as a bundle, then nix flake lock --update-input ianitor
ianitor.url = "git+file:///home/apps/ianitor?ref=refs/tags/v1.0.0";
```
In `nixosConfigurations."nixos-vm"`'s `modules`, after `./modules/aula.nix`:
```nix
inputs.ianitor.nixosModules.default
./modules/ianitor.nix
```
Ianitor's packages build from its own pinned nixpkgs (26.05); only the module is evaluated against .217's 24.11.
## 3. modules/ianitor.nix (new; `git add` it, or the flake does not see it)
```nix
{ ... }:
# Ianitor beside Caddy (Ianitor docs/deploy/beside-caddy-217.md): flower and esp32ide go through Ianitor's edge;
# every other host stays on Caddy. Rollback: remove this file's two lines in flake.nix and the two socket lines in
# caddy.nix, then nixos-rebuild switch.
{
services.ianitor = {
enable = true;
edge = {
httpListen = "127.0.0.1:18080";
httpsListen = "127.0.0.1:18443";
openFirewall = false;
# Caddy reaches edge on /run/ianitor-proxy/edge.sock; only Caddy joins the socket's group. `services`
# puts the group into Caddy's unit, so the switch restarts Caddy with it (a reload would keep old groups).
proxySocket = { enable = true; users = [ "caddy" ]; services = [ "caddy" ]; };
};
control.listen = "127.0.0.1:7878";
# Root-only files outside the store (step 4); the module refuses a /nix/store path.
shareLinkKeyFile = "/var/lib/ianitor-secrets/share-link-key";
pki = {
enable = true;
# The Domi root's certificate (public). The root key never comes to the server.
rootCertificate = ./ianitor/domi-root.crt;
passwordFile = "/var/lib/ianitor-secrets/pki-password";
};
};
}
```
`modules/ianitor/domi-root.crt`: the public certificate of the Domi root (`git add` it too).
## 4. The two secrets (once, before the switch)
Generated on the server and never shown:
```sh
sudo install -d -m 0700 -o root -g root /var/lib/ianitor-secrets
for k in share-link-key pki-password; do
sudo sh -c "umask 077; head -c 32 /dev/urandom | base64 -w0 > /var/lib/ianitor-secrets/$k"
done
sudo ls -l /var/lib/ianitor-secrets # two files, -rw------- root root, 44 bytes each
```
Offer `pki-password` to Custos the way the other apps' secrets are (`custos-provision offer …`): without it the
intermediate and device keys cannot be opened after a restore.
## 5. caddy.nix (two lines)
In the `flower.marek-novak.cz` vhost, replace `reverse_proxy 127.0.0.1:8092` with:
```caddy
reverse_proxy unix//run/ianitor-proxy/edge.sock
```
In the `esp32ide.marek-novak.cz` vhost, replace `reverse_proxy 127.0.0.1:8082` with the same line. Leave every other
line of both vhosts (TLS, headers, logs) as it is. Keep the old line as a comment for the rollback.
## 6. Switch
```sh
cd /home/apps/nixos-config
nix flake lock --update-input ianitor
sudo nixos-rebuild build --flake .#nixos-vm # build first
sudo nixos-rebuild switch --flake .#nixos-vm
```
Then check that Caddy runs with the socket's group (else edge answers it EACCES, a 502 on both hosts):
```sh
gid=$(getent group ianitor-proxy | cut -d: -f3)
grep "^Groups:" /proc/$(systemctl show -p MainPID --value caddy)/status | grep -qw "$gid" \
|| sudo systemctl restart caddy
systemctl is-active ianitor-edge ianitor-control caddy # active ×3
```
Until step 7 the two hosts answer 502 from Caddy (edge has no routes yet). To keep that window short, do step 7
straight after the switch; to avoid it, switch the caddy.nix lines in a second rebuild after step 7.
## 7. The intermediate and the two host files
On .217, as root (`sudo -i`); control listens on 127.0.0.1 only, so no tunnel is needed. The API token goes
straight into a root-only header file and is never shown, on a command line (ps) or in the shell history:
```sh
( umask 077
t=$(runuser -u ianitor-control -- ianitor-control token create --name aula-217 --config /etc/ianitor/control.toml)
printf 'Authorization: Bearer %s\n' "$t" > /root/.ianitor-header )
H=@/root/.ianitor-header; API=http://127.0.0.1:7878/api/v1
curl -s -H "$H" "$API/engine" | jq -c '{running, state}' # {"running":"pingora","state":"running"}
# The intermediate's CSR and its extensions, for Mark's offline signing (docs/pki.md):
install -d -m 0700 /root/ianitor-csr
curl -s -H "$H" -X POST "$API/certs/intermediate/renewal" | jq -r .csr_pem > /root/ianitor-csr/req.csr
curl -s -H "$H" "$API/pki-requests/$(curl -s -H "$H" "$API/overview" | jq -r .intermediate.renewal.request_id)/ext" \
> /root/ianitor-csr/req.ext
```
Mark signs it offline with the Domi root, the same openssl line as in [beside-caddy.md](beside-caddy.md):
`openssl x509 -req -in req.csr -CA domi-root.crt -CAkey domi-root.key -days 365 -sha256 -extfile req.ext -out
int.crt`. `int.crt` (public) comes back to .217 as `/tmp/int.crt`:
```sh
runuser -u ianitor-control -- ianitor-control pki install /tmp/int.crt --config /etc/ianitor/control.toml
```
The host files Ianitor commits to its routes repository (`hosts/<hostname>.toml`), as JSON for the API
(`POST $API/hosts` with `{"host": …}`):
```toml
# hosts/flower.marek-novak.cz.toml
hostname = "flower.marek-novak.cz"
upstreams = ["http://127.0.0.1:8092"]
tls = "domi"
auth = "none"
[health_check]
path = "/"
interval_secs = 30
[[response_headers]]
action = "set"
name = "X-Served-By"
value = "ianitor"
```
```toml
# hosts/esp32ide.marek-novak.cz.toml
hostname = "esp32ide.marek-novak.cz"
upstreams = ["http://127.0.0.1:8082"]
tls = "domi"
auth = "none"
[health_check]
path = "/"
interval_secs = 30
[[response_headers]]
action = "set"
name = "X-Served-By"
value = "ianitor"
```
```sh
for h in flower:8092 esp32ide:8082; do
curl -s -H "$H" -H 'Content-Type: application/json' -X POST "$API/hosts" -d "$(jq -cn \
--arg h "${h%%:*}.marek-novak.cz" --arg u "http://127.0.0.1:${h##*:}" \
'{host: {hostname: $h, upstreams: [$u], tls: "domi", auth: "none",
health_check: {path: "/", interval_secs: 30},
response_headers: [{action: "set", name: "X-Served-By", value: "ianitor"}]}}')"
done # each answers 202 with an apply; GET $API/applies/<id> until "kept"
```
(`tls = "domi"` is edge's own loopback listener; visitors keep Caddy's Let's Encrypt certificate.)
## 8. Checks
On .217:
```sh
ss -ltnp | grep -E 'ianitor' # only 127.0.0.1:18080, 127.0.0.1:18443 and 127.0.0.1:7878
for h in flower esp32ide; do
sudo curl -s -o /dev/null -w "$h %{http_code}\n" --unix-socket /run/ianitor-proxy/edge.sock \
-H "Host: $h.marek-novak.cz" http://localhost/
done # 200 (or the app's 3xx) for both
```
From the desktop (192.168.100.140), with the repository at the tag:
```sh
deploy/test-access.sh --server 192.168.100.217 \
--public gitea.marek-novak.cz \
--via-ianitor flower.marek-novak.cz --via-ianitor esp32ide.marek-novak.cz
```
(`--public` needs a host that answers 2xx or 3xx without a sign-in redirect; gitea's front page does. Hosts behind
Authelia do not belong there.)
It must print `all checks passed`: both hosts answer through Ianitor (`X-Served-By: ianitor`), an untouched host
still answers, and control's port does not answer from the LAN. The two weeks start then; write the date in
ROADMAP §9.
**Every day of the two weeks** (an incident is any failed line):
```sh
for h in flower esp32ide; do curl -sI https://$h.marek-novak.cz/ | grep -qi '^x-served-by: ianitor' && echo "$h ok" || echo "$h FAIL"; done
journalctl -u ianitor-edge -u ianitor-control --since yesterday -p warning --no-pager | tail -20
```
## Rollback
Put back the two `reverse_proxy 127.0.0.1:…` lines in caddy.nix and `sudo nixos-rebuild switch --flake .#nixos-vm`:
the two hosts are on Caddy alone again within seconds. To remove Ianitor entirely, also drop its two module lines and
the input. `/var/lib/ianitor` and `/var/lib/ianitor-secrets` stay and are ignored.
## Not verified
- The module evaluated against nixpkgs 24.11 (the VM tests use Ianitor's 26.05). `nixos-rebuild build` is the check.
- The two vhosts' other lines: only their `reverse_proxy` lines were read.
-3
View File
@@ -3,9 +3,6 @@
ROADMAP §1.12 and §6 Phase 3: Ianitor runs beside Caddy on two low-risk hosts before any
cut-over. This is **prepared, not applied**: Mark runs every command below himself.
This file is the staging mirror's plan (Configuration_Server, 2026-11-07). The run on the production server .217
(nixos-config, flower and esp32ide, v1.0.0) is [beside-caddy-217.md](beside-caddy-217.md).
## What was found in Configuration_Server (read-only, 2026-11-07)
- `hyperv-infra/` is the active flake (`nixosConfigurations.hyperv-vm`, the staging mirror on
+4 -8
View File
@@ -2,7 +2,7 @@
The web UI's controls and roles come from **@domi/ui**, the shared Domi design system (Gitea `mnovak/domi-design`,
its `docs/INTEGRATE.md` §6a and `docs/MIGRATION.md`). It is **vendored** at a tag in `packages/domi-ui` (CPAL-1.0,
like Ianitor; `VERSION` names the tag, v1.1.0; `LICENSE`, `NOTICE` and `VERSION` there stay unchanged) and used as a
like Ianitor; `VERSION` names the tag, v1.0.4; `LICENSE`, `NOTICE` and `VERSION` there stay unchanged) and used as a
workspace package by `apps/web` and `packages/ui`:
```json
@@ -75,17 +75,13 @@ plain data for the e2e real-data check, and a unit test keeps them equal to @dom
contains @domi/ui in `packages/domi-ui` (INTEGRATE.md §6a).
History: the first pins were v1.0.0 and v1.0.1 (a git dependency), then v1.0.2 was vendored (MPL-2.0). That copy
stays in this PR's branch history by Mark's choice; PR 14 was squash-merged with v1.0.4 (c9aa55e), so main never held it. v1.1.0 followed (2026-11-23).
v1.1.0 adds TextField `as="editable" | "auto"`, a contenteditable field, because an Android **WebView** sends an
Autofill request to Google whenever a native text field gets focus. Ianitor keeps the default native fields
(`as="input"`): it runs in a browser, not a WebView, and native fields keep the browser's own password and form
handling.
stays in this PR's branch history by Mark's choice; the PR is squash-merged, so main only ever holds v1.0.4
(v1.0.4 is v1.0.3 with a script block in `Strike.svelte`, so no tsconfig workaround is needed).
## Risks
- **The Nix hash** in `deploy/nixos/web.nix` is the one Fabrica's NixOS runner reported for this lockfile (run
`rp8rw56wvg5k2`, 2026-11-23); v1.0.3, v1.0.4 and v1.1.0 left the lockfile byte-identical. A verify-nix run on the branch confirms it.
`rp8rw56wvg5k2`, 2026-11-23); v1.0.3 and v1.0.4 left the lockfile byte-identical. A verify-nix run on the branch confirms it.
- A visual change Mark has not seen beyond the asked-for controls: the field labels are @domi/ui's (13 px, 600),
and Ianitor's group labels (Certificate, Visit log, What is it) follow them so a form reads as one; the
segmented controls are as wide as their choices, not the panel.
-4
View File
@@ -137,10 +137,6 @@ discovery (ROADMAP §1.9). When it is time:
X.Y.Z` must pass. Write `.fabrica/notes/X.Y.Z.md`. Commit.
1a. Pin: run `scripts/nix-pin.sh` on Linux with Nix at that clean commit and commit `.fabrica/nix/pin.json`
([verify.md](verify.md)). The `pin` step refuses a missing pin and one made from other code than the tag's.
Without Nix here: start `verify-nix` on the hub at that commit (`POST /api/runs`, pipeline `verify-nix`, the
branch as ref). Its `pin` step fails for want of a pin and logs the pin it would write as one
`pin.json: {…}` line; save that JSON, formatted by `jq -S .`, as `.fabrica/nix/pin.json` and commit only it.
Then run `verify-nix` again: `pin` must say `matches .fabrica/nix/pin.json`.
2. Tag and push: `git tag vX.Y.Z && git push origin vX.Y.Z`.
3. Start the `release` pipeline at `vX.Y.Z` from Fabrica. No Gitea webhook reaches the hub yet, so use the hub's
`POST /api/runs` with ref `vX.Y.Z`.
-4
View File
@@ -42,15 +42,11 @@
pkg-config
git
jq
# control's pki tests sign an intermediate the way Mark does by hand (docs/pki.md)
openssl
caddy
pebble
h2spec
testssl
oha
# scripts/bench.sh finds each proxy's pid with ss (a NixOS service's PATH has no iproute2)
iproute2
nodejs_22
pnpm_11
# the slow-client probes (tests/support/probes)
-10
View File
@@ -1,15 +1,5 @@
# Changelog
## 1.1.0 (2026-11-23)
- **TextField `as="editable" | "auto"`**: the field drawn with a contenteditable `role="textbox"` instead of a native
`<input>`/`<textarea>`, because on Android the WebView sends an Autofill request to Google whenever a native text
field gets focus (found by Amicitia). Same look, seal, keys and states; plain-text paste; label by
`aria-labelledby`; `inputmode` from the type; a hidden input for `name`. `auto` = editable on Android only.
Passwords always stay native. New `editor` binding; `input` keeps its type. `isAndroid()` exported.
- Docs: the credit goes by repo visibility (Mark): apps whose own repo is public, and public repos carrying a copy,
show it; apps built from a private repo show none, paid or free.
## 1.0.4 (2026-11-23)
- Fix: `Strike.svelte` had no `<script>` block, so a consumer whose tsconfig has `allowJs` off (Ludus) got "Could not
+1 -1
View File
@@ -1,4 +1,4 @@
This folder is @domi/ui v1.1.0, copied unchanged from domi-design by tools/vendor.mjs.
This folder is @domi/ui v1.0.4, copied unchanged from domi-design by tools/vendor.mjs.
Licence: Common Public Attribution License 1.0 (LICENSE). Original Code: @domi/ui. Initial Developer: Marek Novák.
Attribution Information (Exhibit B). Any app built with this code shows, prominently in its user interface when
+1 -1
View File
@@ -1 +1 @@
v1.1.0
v1.0.4
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@domi/ui",
"version": "1.1.0",
"description": "The Domi design system: tokens for every Domi app, struck buttons and fields with an integrated send button, Svelte 5 components. Vendored copy of v1.1.0: do not edit here; change domi-design and vendor the next tag.",
"version": "1.0.4",
"description": "The Domi design system: tokens for every Domi app, struck buttons and fields with an integrated send button, Svelte 5 components. Vendored copy of v1.0.4: do not edit here; change domi-design and vendor the next tag.",
"license": "CPAL-1.0",
"type": "module",
"svelte": "./src/index.ts",
+13 -118
View File
@@ -5,7 +5,6 @@
import { strike } from '../lib/strike';
import { canSend, enterAction, failureText, isSoftKeyboard, type FieldState } from '../lib/keys';
import type { IconName } from '../lib/icons';
import { caretToEnd, inputmodeFor, insertPlainText, isAndroid, readText, writeText } from '../lib/editable';
type Action = 'send' | 'search' | 'next' | 'save';
@@ -56,16 +55,8 @@
force?: string;
sendForce?: string;
class?: string;
/** The input element, for focusing it from outside (null in editable mode: see editor). */
/** The input element, for focusing it from outside. */
input?: HTMLInputElement | HTMLTextAreaElement | null;
/**
* input (default): a native <input>/<textarea>. editable: a contenteditable box with role="textbox": on Android
* the WebView sends an Autofill request to Google whenever a native text field gets focus; an editable box does
* not. auto: editable on Android, native elsewhere. Passwords are always native (masking, password managers).
*/
as?: 'input' | 'editable' | 'auto';
/** The editable box in editable mode, for focusing it from outside. */
editor?: HTMLElement | null;
}
let {
@@ -103,16 +94,12 @@
sendForce,
class: cls = '',
input = $bindable(null),
as = 'input',
editor = $bindable(null),
}: Props = $props();
const uid = $props.id();
const fieldId = $derived(id ?? `domi-field-${uid}`);
const hintId = `domi-hint-${uid}`;
const errorId = `domi-error-${uid}`;
const labelId = `domi-label-${uid}`;
const android = isAndroid();
const words: Record<Action, { label: string; icon: IconName; key: 'send' | 'search' | 'next' | 'done'; busy: string; done: string; fail: string }> = {
send: { label: 'Send', icon: 'send', key: 'send', busy: 'Sending', done: 'Sent', fail: 'Could not send. Try again.' },
@@ -137,10 +124,6 @@
const described = $derived([hint && hintId, message && errorId].filter(Boolean).join(' ') || undefined);
const inputType = $derived(type === 'password' && revealed ? 'text' : type);
const clears = $derived(clearOnSend ?? action === 'send');
const editable = $derived(type !== 'password' && (as === 'editable' || (as === 'auto' && android)));
/** The element that takes the text, whichever kind it is. */
const box = $derived<HTMLElement | null>(editable ? editor : input);
const locked = $derived(disabled || readonly || shown === 'sending');
function hold(): number {
const v = getComputedStyle(document.documentElement).getPropertyValue('--domi-dur-hold');
@@ -150,22 +133,22 @@
function nextField(from: HTMLElement) {
const scope = from.closest('form') ?? document;
const all = [...scope.querySelectorAll<HTMLElement>('.domi-field__input, input, textarea, select')].filter(
(el) => !el.hasAttribute('disabled') && el.getAttribute('aria-disabled') !== 'true' && el.getAttribute('type') !== 'hidden',
(el) => !el.hasAttribute('disabled') && el.getAttribute('type') !== 'hidden',
);
const i = all.indexOf(from);
all[i + 1]?.focus();
}
async function submit() {
if (!sendable || !box) return;
const el = box;
if (!sendable || !input) return;
const el = input;
const text = value;
clearTimeout(timer);
failure = '';
if (!onsend) {
// No handler: behave like the form's own submit (or, for next, move on).
if (action === 'next') nextField(el);
else el.closest('form')?.requestSubmit();
else el.form?.requestSubmit();
return;
}
const result = onsend(text);
@@ -185,7 +168,7 @@
}
}
function done(el: HTMLElement) {
function done(el: HTMLInputElement | HTMLTextAreaElement) {
if (clears) value = '';
if (action === 'next') {
auto = 'idle';
@@ -211,9 +194,6 @@
} else if (r === 'ignore' && e.key === 'Enter' && e.altKey && !multiline) {
// Alt+Enter must not submit the form. An Enter that ends an input method's composition is left alone.
e.preventDefault();
} else if (editable && !multiline && e.key === 'Enter' && !e.isComposing && e.keyCode !== 229) {
// A single-line editable box never takes a line break.
e.preventDefault();
}
}
@@ -226,55 +206,10 @@
grow();
}
// Editable mode: the box's text is the value. Typing, paste and drop bring plain text only.
function edited() {
if (!editor) return;
let t = readText(editor);
let rewrite = false;
if (!multiline && /\n/.test(t)) {
t = t.replace(/\r?\n/g, ' ');
rewrite = true;
}
if (maxlength !== undefined && t.length > maxlength) {
t = t.slice(0, maxlength);
rewrite = true;
}
if (t === '' && editor.childNodes.length > 0) rewrite = true; // a stray <br> would hide the placeholder
if (rewrite) {
writeText(editor, t);
if (t) caretToEnd(editor);
}
value = t;
typed();
}
function pasted(e: ClipboardEvent) {
if (!editor) return;
e.preventDefault();
if (locked) return;
let t = e.clipboardData?.getData('text/plain') ?? '';
if (!multiline) t = t.replace(/\r?\n/g, ' ');
insertPlainText(editor, t);
edited();
}
function dropped(e: DragEvent) {
if (!editor) return;
e.preventDefault();
const t = e.dataTransfer?.getData('text/plain') ?? '';
if (!t || locked) return;
editor.focus();
insertPlainText(editor, multiline ? t : t.replace(/\r?\n/g, ' '));
edited();
}
// A value set from outside (bind:value, a field cleared after sending) is written into the box.
$effect(() => {
const v = value;
if (editable && editor && readText(editor) !== v) writeText(editor, v);
});
// field-sizing: content grows the textarea in Chromium (WebView2, Android WebView); elsewhere, grow it here.
const sizesItself = typeof CSS !== 'undefined' && CSS.supports?.('field-sizing', 'content');
function grow() {
if (!multiline || sizesItself || !(input instanceof HTMLTextAreaElement)) return;
if (!multiline || sizesItself || !input) return;
input.style.height = 'auto';
input.style.height = `${input.scrollHeight}px`;
}
@@ -284,16 +219,11 @@
});
$effect(() => () => clearTimeout(timer));
$effect(() => {
if (autofocus) box?.focus();
if (autofocus) input?.focus();
});
function focusBox() {
if (!box) return;
box.focus();
if (editable) caretToEnd(box);
}
function focusInput(e: MouseEvent) {
if (e.target === e.currentTarget) focusBox();
if (e.target === e.currentTarget) input?.focus();
}
</script>
@@ -303,47 +233,12 @@
data-empty={empty ? '' : undefined}
data-disabled={disabled ? '' : undefined}
>
{#if editable}
<!-- An editable box is not a labelable element: the label names it through aria-labelledby; a click focuses it. -->
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
<span class={['domi-field__label', hideLabel && 'domi-sr']} id={labelId} role="presentation" onclick={focusBox}>
{label}{#if optional}<span class="domi-field__optional">{" (optional)"}</span>{/if}
</span>
{:else}
<label class={['domi-field__label', hideLabel && 'domi-sr']} for={fieldId} id={labelId}>
{label}{#if optional}<span class="domi-field__optional">{" (optional)"}</span>{/if}
</label>
{/if}
<label class={['domi-field__label', hideLabel && 'domi-sr']} for={fieldId}>
{label}{#if optional}<span class="domi-field__optional">{" (optional)"}</span>{/if}
</label>
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
<div class="domi-field__well" role="presentation" data-force={force} onclick={focusInput}>
{#if editable}
<div
bind:this={editor}
class={['domi-field__input', 'domi-field__input--editable', multiline && 'domi-field__input--lines']}
id={fieldId}
role="textbox"
tabindex={disabled ? -1 : 0}
contenteditable={locked ? 'false' : 'plaintext-only'}
aria-labelledby={labelId}
aria-multiline={multiline ? 'true' : 'false'}
aria-describedby={described}
aria-invalid={message ? 'true' : undefined}
aria-required={required ? 'true' : undefined}
aria-readonly={readonly || shown === 'sending' ? 'true' : undefined}
aria-disabled={disabled ? 'true' : undefined}
aria-placeholder={placeholder}
data-placeholder={placeholder}
inputmode={inputmode ?? inputmodeFor(type)}
enterkeyhint={multiline ? (w.key === 'done' ? 'done' : 'enter') : w.key === 'done' ? 'done' : w.key}
spellcheck={spellcheck ?? true}
style:--_rows-max={rows}
onkeydown={keydown}
oninput={edited}
onpaste={pasted}
ondrop={dropped}
></div>
{#if name}<input type="hidden" {name} {value} />{/if}
{:else if multiline}
{#if multiline}
<textarea
bind:this={input}
bind:value
-37
View File
@@ -512,43 +512,6 @@ textarea.domi-field__input {
align-items: flex-end;
}
/*
* Editable mode (as="editable"): a contenteditable box in place of <input>/<textarea>, so an Android WebView sends no
* Autofill request. One line: centred, no wrap, scrolls sideways. Several lines: grows to --_rows-max, then scrolls.
*/
.domi-field__input--editable {
align-self: center;
min-height: var(--domi-leading-md);
overflow-x: auto;
overflow-y: hidden;
white-space: pre;
cursor: text;
scrollbar-width: none;
}
.domi-field__input--editable::-webkit-scrollbar {
display: none;
}
.domi-field__input--lines {
align-self: stretch;
padding-top: 8px;
padding-bottom: 8px;
min-height: calc(var(--domi-leading-md) + 16px);
max-height: calc(var(--domi-leading-md) * var(--_rows-max, 8) + 16px);
overflow-x: hidden;
overflow-y: auto;
white-space: pre-wrap;
overflow-wrap: anywhere;
scrollbar-width: thin;
}
.domi-field__input--editable:empty::before {
content: attr(data-placeholder);
color: var(--domi-muted);
pointer-events: none;
}
.domi-field__input--editable[contenteditable='false'] {
cursor: default;
}
/* The seal: the send button set into the right end of the field. */
.domi-send {
--_s: max(var(--domi-size-send-md), var(--domi-send-target));
-1
View File
@@ -14,7 +14,6 @@ export { default as Icon } from './components/Icon.svelte';
export { default as Strike } from './components/Strike.svelte';
export { default as DomiCredit } from './components/DomiCredit.svelte';
export { DOMI_ATTRIBUTION, DOMI_ATTRIBUTION_TEXT } from './lib/credit';
export { isAndroid } from './lib/editable';
export { strike } from './lib/strike';
export { icons, type IconName } from './lib/icons';
-71
View File
@@ -1,71 +0,0 @@
// SPDX-License-Identifier: CPAL-1.0
/**
* Helpers for TextField's editable mode: a contenteditable box with role="textbox" in place of <input>/<textarea>.
* Why: on Android the WebView asks Google's Autofill service (a network request) as soon as a text <input> or
* <textarea> gets focus, and no attribute stops it (found by Amicitia). A contenteditable box is not an autofill
* target. Plain text only: paste and drop never bring markup.
*/
/** True in an Android WebView or browser, where editable mode avoids the Autofill request. Safe during SSR. */
export function isAndroid(): boolean {
return typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);
}
/** The box's text, with line breaks as \n. An emptied box that only holds a stray line break reads as ''. */
export function readText(el: HTMLElement): string {
const raw = typeof el.innerText === 'string' ? el.innerText : (el.textContent ?? '');
return raw === '\n' ? '' : raw;
}
/** Replaces the box's content with plain text (no markup can enter). */
export function writeText(el: HTMLElement, text: string): void {
el.textContent = text;
}
/** Puts the caret after the last character. */
export function caretToEnd(el: HTMLElement): void {
const sel = typeof getSelection === 'function' ? getSelection() : null;
if (!sel || typeof document.createRange !== 'function') return;
const range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
sel.removeAllRanges();
sel.addRange(range);
}
/**
* Inserts plain text at the caret. Uses the browser's own insertion where it exists, so undo keeps working;
* otherwise inserts a text node at the selection.
*/
export function insertPlainText(el: HTMLElement, text: string): void {
try {
if (typeof document.execCommand === 'function' && document.execCommand('insertText', false, text)) return;
} catch {
// Fall through to the Range insertion.
}
const sel = typeof getSelection === 'function' ? getSelection() : null;
const node = document.createTextNode(text);
if (!sel || sel.rangeCount === 0 || !el.contains(sel.getRangeAt(0).commonAncestorContainer)) {
el.append(node);
return;
}
const range = sel.getRangeAt(0);
range.deleteContents();
range.insertNode(node);
range.setStartAfter(node);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
}
/** The soft keyboard a type asks for, as inputmode (an editable box has no type attribute). */
export function inputmodeFor(type: string): 'text' | 'email' | 'url' | 'tel' | 'decimal' | 'search' {
const map: Record<string, 'email' | 'url' | 'tel' | 'decimal' | 'search'> = {
email: 'email',
url: 'url',
tel: 'tel',
number: 'decimal',
search: 'search',
};
return map[type] ?? 'text';
}
+1 -1
View File
@@ -2,7 +2,7 @@
/* eslint-disable */
export const tokens = {
"name": "@domi/ui",
"version": "1.1.0",
"version": "1.0.4",
"note": "GENERATED by tools/build-tokens.mjs. Colours are sRGB hex. Use roles, never the hex in a component.",
"themes": {
"dark": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ianitor/ui",
"version": "1.0.0",
"version": "0.2.0",
"private": true,
"license": "CPAL-1.0",
"description": "Ianitor's own components on top of @domi/ui (the shared Domi design system): banners, dialogs, status, and adapters for Button and Segmented.",
+3 -4
View File
@@ -8,7 +8,7 @@
# (tests/diff/src/bin/pair.rs) to the same upstream; oha drives each in turn. Results are
# committed as data: bench/results/<date>-<label>.csv and the raw oha JSON beside it.
#
# scripts/bench.sh [label] # needs caddy, oha, jq, ss on PATH
# scripts/bench.sh [label] # needs caddy, oha, jq on PATH
# nix shell nixpkgs#caddy nixpkgs#oha nixpkgs#jq -c scripts/bench.sh wsl2-ryzen
#
# Environment: DURATION (each load run, default 20s), SOAK (the soak run, default 300s; 0 skips
@@ -23,7 +23,7 @@ duration=${DURATION:-20s}
soak=${SOAK:-300}
conns=${CONNS:-"1 16 64 256"}
profile=${BUILD:-release}
for tool in caddy oha jq ss; do
for tool in caddy oha jq; do
command -v "$tool" >/dev/null || { echo "missing: $tool" >&2; exit 2; }
done
@@ -66,8 +66,7 @@ done
# The process to sample for memory: edge runs inside ianitor-pair; each Caddy is a child of it.
pid_of() {
local port=$1
# No pid found is not an error (the row says 0); set -e and pipefail would end the run here, silently.
ss -Hltnp "sport = :$port" 2>/dev/null | grep -Eo 'pid=[0-9]+' | head -1 | cut -d= -f2 || true
ss -Hltnp "sport = :$port" 2>/dev/null | grep -Eo 'pid=[0-9]+' | head -1 | cut -d= -f2
}
rss_kb() { awk '/VmRSS/ {print $2}' "/proc/$1/status" 2>/dev/null || echo 0; }
+1 -7
View File
@@ -59,13 +59,7 @@ new=$(printf '%s\n' "${entries[@]}" | jq -s --arg v "$version" --arg sys "$syste
'{version: $v, system: $sys, commit: $c, sourceTree: $t, nixpkgs: $n, outputs: add}')
if [ "$mode" = --check ]; then
# With no pin yet, print the one this build would write: the NixOS runner has no commit rights, so its
# log is how the first pin of a release reaches the repo (docs/release.md, Handover 1a).
if [ ! -f "$pin" ]; then
echo "no $pin to check; this build's pin would be:" >&2
jq -S -c . <<<"$new" | sed 's/^/pin.json: /' >&2
exit 1
fi
[ -f "$pin" ] || { echo "no $pin to check" >&2; exit 1; }
# At a tag the commit is the pin's child (only pin.json differs), so the commit itself is not
# compared; the source tree, nixpkgs and every hash are.
if [ "$(jq -S 'del(.commit)' "$pin")" != "$(jq -S 'del(.commit)' <<<"$new")" ]; then