1ccacad63281094de8a3372d5a507d38f9969e5c
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4d9b798d50 |
web: a LazyCat box's administrators open the page with the box's sign-in (MAGPIE_WEB_SIGN_IN=lazycat) (#5987)
magpie in a LazyCat app (懒猫微服) is opened from the box's app list by someone signed in to the box already, and asks for a key they never saw: it is in the container's log. A package can only hand the key to every browser that reaches the app, or put a proxy in front that adds the key's cookie to what the box signed in. The box's ingress, lzc-ingress, sends a browser that isn't signed in to the box's login page, and puts on every request it passes the app the box account (X-HC-User-ID), its role (X-HC-User-Role, ADMIN or NORMAL) and what sent it (X-HC-Source, client for a browser), in place of what the caller sent. With MAGPIE_WEB_SIGN_IN=lazycat webGuard takes that sign-in besides the key: lazyCatSignIn lets in an ADMIN account sent by a browser, each of the three named once, and tells anyone else the box's reason. The box's sign-in is a cookie of the box's, and the box's apps are one site, so a browser sends it with another app's page's requests too: an earlier build of this change let another app's page on the box include /boot.js and read window.bootPrefs. So it is taken only for what the page itself or the user asked for (boxFetched, the Fetch Metadata: Sec-Fetch-Site same-origin or none, or a GET or HEAD navigation to a document from another page), never for another page's script, frame, fetch or form POST, nor from a browser that sends no Fetch Metadata. It sets no cookie of the page's own, so signing out of the box signs out of the page. The key's link and cookie work as before, /api still answers the page alone (webOwnPage), and the gateway's client routes on the page's port go to the gateway first (onePort), which asks for a gateway key. StartWeb refuses another value, and lazycat where LAZYCAT_APP_DOMAIN, which LazyCat sets in an app's containers, isn't set: all magpie can check, so the setting is the package's word that the box's ingress is the only way to the page's port. magpie web prints the box's address beside the link. Docs: reference.md's new LazyCat section, with a manifest and what must never reach the page's port, and gui-shell.md's Browser mode row. On a box (lzcos 1.6.2+fix.4), a probe app that echoes its request headers: a signed-in browser's request carries X-HC-User-ID, X-HC-User-Role ADMIN and X-HC-Source client, forged ones replaced; not signed in, / goes to the login page and a public path gets none of the three (forged ones taken off, repeated or in lower case too), while X-HC-User-Groups passes on as the caller wrote it, so it is never read; a TCP ingress passes every header as sent. Another app's container reaches the app through the ingress alone (straight to the app's container it times out); the box itself, and a container in its network (network_mode: host, which a manifest may set), reach the port. A test app made from the docs' manifest, running a build of this change on |
||
|
|
f44fa2ef6a |
sessions: gateway mode lists only the gateway's sessions, never this computer's agents' files
paultian on Discord: magpie web in gateway mode, on a machine with Claude
Code and Codex installed, listed that machine's own sessions beside the
ones other computers sent through it. Owner's call (via the lead): keep
Sessions in gateway mode, scope it.
- sessions.OwnOff (set by the gui to ownSessionsOff): while it holds,
currentReads answers "none", Found and Dirs are empty, the trash lists
and restores/purges only what the gateway kept, and moving Claude
Code's folder is refused. Every route built on Reads follows: the list,
one, transcript, markdown, export, stats, overview, search, manage,
delete, carry, Usage's agent-file calls. Gateway-recorded sessions
(ledger projection, recorded conversations) are not behind the gate.
- ownSessionsOff: magpie web's page, and Settings' gateway mode On, or
Automatic with --gateway or no agents found (looked at once per 30s,
and again on another HOME/PATH). A turn of the answer resets the
sessions' caches and stats; the gateway-mode route does it at once.
- /api/sessions/reads says gateway:true: the page asks nothing, its empty
state names the gateway's sessions (en/zh/zh-TW/ja/de), and Settings ›
Privacy leaves out Agents' session history.
- The gateway-mode subtitle (5 languages), docs/reference.md and
site docs/docker.html (en/zh/ja) say Sessions stays and what it lists
(they said there was no Sessions tab, which was already wrong);
docs/subsystems/gateway-sessions.md has the design.
- Tests: Handler marks the process as magpie web for good, and 13 tests
served magpie web's page, so a later test's sandbox could be in gateway
mode by itself. webPageHandler ends the mark with the test, and
TestWebPageHandlerEveryWhere fails on a direct Handler(webHost{...}).
Ran (mote, at this tree rebased on origin/main):
- TestGatewayModeListsNoOwnSessions: red on the old code, green now.
- gateway-mode-sessions.test.cjs: chromium + webkit, en 900/390, zh,
zh-TW, ja 420, de 390: 36/36; red on the old client.js (every case).
- GUI files the change reaches (gateway-mode*, sessions-*, session-*,
privacy-*, usage-sessions-*, i18n-keys), both engines: 657/657.
- TestCoreScriptBudget ok.
- go test -shuffle=on ./internal/gui ./internal/sessions: sessions ok;
gui ok but TestMainWindowCorners/macOS_26_SDK, red the same on
origin/main
|
||
|
|
9022169f6a |
web: magpie web added to a phone's home screen opens as an app (ninja_s6114 on Discord)
ninja_s6114 runs magpie in Docker and put the web UI on an iPhone's home screen; it opened with Safari's address and bookmarks bars. Now it opens standalone, with no setup: - index.html links manifest.json (display standalone, name magpie, start_url and scope "./", 180 and 512 px icons) and an apple-touch-icon, and sets apple-mobile-web-app-capable, mobile-web-app-capable, the title and status bar style "default". theme-color is set only under (display-mode: standalone), light #f4f4f6 and dark #1a1a1e, so a browser tab and the Wails windows look as before. - webGuard serves exactly /manifest.json, /icons/apple-touch-icon.png and /icons/icon-512.png on GET/HEAD without the key, since a home screen may fetch them without the page's cookie. Everything else still needs it. - The header's safe-area padding already in app.css (body.web .top) keeps it out from under the status bar and notch; app.css is unchanged. Run, at this head (rebased on origin/main): - go test ./internal/gui: ok, except TestRestartHandsTheGatewayOver, the handover EOF under load (#3451); it and TestWebAppAddsToHomeScreen pass 3 of 3 alone. - gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui, and GOOS=windows: ok; go build ok. - GUI web-app-standalone + i18n-keys: chromium 8/8, webkit 6/6 (the standalone cases are Chromium only, as WebKit can't emulate display-mode standalone; they run under --app with iPhone 13 safe-area insets 47/34 and touch, portrait and landscape, light and dark). - Before the rebase, 34 GUI files picked for strict fixtures/assert.fail on unexpected requests, plus menu-scroll, phone-web, mobile-web, web-page, old-webkit, usage-ledger and i18n-keys, in both engines: 563 of 576 pass. The reds fail the same on an origin/main copy and are filed: old-webkit Safari 15 (#3403), phone-web flick under load (#3180), gateway-key-models webkit under load (#2648), usage-ledger return-to-live (#3104). provider-detect-draft timed out under load and passes 20/20 alone. Broken by hand: - the guard exemption removed: the Go test fails with 401 on the manifest and the icon; - the old index.html: the Go test fails on the missing tags, and the GUI test fails in WebKit too; - theme-color media without display-mode: the GUI test fails in both engines; - app.css's body.web .top safe-area padding removed: the standalone test fails, ".top .brand under the status bar: 8". Not tried: a real iPhone or Android device and a real install; the whole GUI suite (the machine is loaded and nearly out of disk; run afterwards). iOS keeps the display mode it saw when the icon was added, so a user removes the old icon and adds it again. A home-screen app on iOS may not share Safari's cookie, so it can ask for the key once; MAGPIE_WEB_KEY keeps the key the same across restarts. iOS 27's top blur over the header is #3515, not changed here. |