From b6cbcdc080510d5d39fa29e6e9ad66eea69bb686 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Tue, 13 Oct 2026 07:56:54 +0000 Subject: [PATCH] fix(service): don't prompt for a username (OpenCode web UI sends only a password) - the OpenCode web app's 'Add server' dialog asks for server address + password; the username defaults to 'opencode' and is never sent by the browser - so the installer no longer asks for a username (a custom one would break the web login); --username/OPENCODE_SERVER_USERNAME remain for API clients - README explains the add-server dialog and what to enter --- README.md | 2 ++ install-service.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 617c1a4..ec4ead6 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,8 @@ The service step is a **separate program** — `install-service.sh` — so you c **Auth (optional).** OpenCode's server has its own HTTP basic auth — enabled purely by setting `OPENCODE_SERVER_PASSWORD` (username defaults to `opencode`, or set `OPENCODE_SERVER_USERNAME`). The installer offers this interactively, or accept it non-interactively with `--password`. The secret is **never written into the unit**: it goes into a root-only env file (`/etc/opencode/opencode.env`, mode `600`) that the unit pulls in via `EnvironmentFile=`. Use this **or** your proxy's basic auth — they don't conflict. +> **The web app is a client.** On first use it shows an **"Add server"** dialog asking for the **server address** and the **password** — the username is *not* asked because it defaults to `opencode`. Enter your server URL and the password you set here. It's remembered after that. Keep the username as `opencode` (a custom one would not be sent by the browser). + It refuses to run non-interactively unless you pass `--yes`, and backs up any existing unit before replacing it. - **Default bind is `127.0.0.1`** — the server has **no authentication of its own**, so keep it loopback-only and put a reverse proxy (Zoraxy, nginx, …) in front. Choose `0.0.0.0` only if you deliberately want it exposed on your network. diff --git a/install-service.sh b/install-service.sh index 5b3b77f..fc09a21 100755 --- a/install-service.sh +++ b/install-service.sh @@ -228,7 +228,6 @@ if [ "$INTERACTIVE" = 1 ] && [ "$DRY_RUN" = 0 ]; then printf " Protect the server with a password? [y/N]: "; v=""; tty_read v case "$v" in [Yy]*) - printf " Username [%s]: " "$SVC_USERNAME"; v=""; tty_read v; [ -n "$v" ] && SVC_USERNAME="$v" pw1=""; printf " Password: "; tty_read_secret pw1 pw2=""; printf " Confirm password: "; tty_read_secret pw2 if [ -z "$pw1" ]; then