Split the internet upgrades: API-only tunnel, OIDC, authenticator codes, expose-dashboard
install-newt now sets up the tunnel for the API only; the dashboard stays on the LAN. Dashboard sign-in is its own step: install-oidc (the OIDC flow, split out) or install-otp, which pairs authenticator apps with a QR code in the terminal (stdlib QR encoder, TOTP per RFC 6238) so a code also opens the dashboard, with replay and lockout rules. expose-dashboard walks through publishing the dashboard, only after install-newt, and warns while it's protected by the API key alone; with codes it offers to switch the key off for the dashboard. Each install-* has a remove-*. Also opencode-install.sh: a standalone script, fetched from the repo, that installs opencode if needed, saves the API key to a 0600 file and adds the provider to opencode.json for new and existing configs. /v1/models reports whether the model reasons, for that script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e6ff4ce909
commit
c8b70afdbf
20 changed files with 1715 additions and 239 deletions
|
|
@ -109,6 +109,14 @@ check("opencode block is the openai-compatible provider", blk["npm"] == "@ai-sdk
|
|||
check("opencode block offers the one alias", list(blk["models"]) == [cx["model"]] == ["default"], blk["models"])
|
||||
check("opencode block leaves the address to the page", "LABEL" in blk["name"] and "HOST" in blk["options"]["baseURL"], blk)
|
||||
check("the key isn't inlined in the block", KEY not in json.dumps(blk))
|
||||
check("installer URL is a raw file in the repo", cx["installer"].startswith("https://")
|
||||
and cx["installer"].endswith("/opencode-install.sh"), cx["installer"])
|
||||
R = web.raw_file_url
|
||||
check("raw URL for a Gitea/Forgejo repo", R("https://git.example.com/pub/llm-host.git", "main", "f.sh")
|
||||
== "https://git.example.com/pub/llm-host/raw/branch/main/f.sh")
|
||||
check("raw URL for a GitHub repo", R("https://github.com/someone/llm-host", "dev", "f.sh")
|
||||
== "https://raw.githubusercontent.com/someone/llm-host/dev/f.sh")
|
||||
check("no raw URL for an ssh remote", R("git@github.com:someone/llm-host.git", "main", "f.sh") is None)
|
||||
srv.shutdown()
|
||||
|
||||
print("\n2. OIDC mode refuses the key and unsigned visitors")
|
||||
|
|
@ -120,6 +128,7 @@ srv = serve(o)
|
|||
st, _, body, _ = req(srv, "GET", "/auth/config", PUB_HOST)
|
||||
check("config reports oidc, nobody signed in", json.loads(body) == {"mode": "oidc", "user": None, "name": None}, body)
|
||||
check("status without session -> 401", req(srv, "GET", "/api/status", PUB_HOST)[0] == 401)
|
||||
check("the dashboard doesn't serve the opencode installer", req(srv, "GET", "/opencode-install.sh", PUB_HOST)[0] == 404)
|
||||
check("the API key no longer opens it", req(srv, "GET", "/api/status", {**PUB_HOST, "Authorization": f"Bearer {KEY}"})[0] == 401)
|
||||
st, h, _, _ = req(srv, "GET", "/", {"Host": "mybox.local:11340"})
|
||||
check("a LAN name is sent to the public URL", st == 302 and h["location"] == PUBLIC + "/", h.get("location"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue