Merge branch 'worktree-agent-a7f96a1eb9a56587d'

# Conflicts:
#	cmd/pipelines-server/main.go
#	internal/server/websocket.go
#	scripts/manage.py
#	scripts/setup-native.py
#	web/serve.mjs
#	web/src/peerRelay.js
This commit is contained in:
2026-11-10 01:25:04 +00:00
60 changed files with 3994 additions and 157 deletions
+27 -11
View File
@@ -45,6 +45,7 @@ release_lookup = module("resolve_releases", "resolve-releases.py")
tokens = module("save_ntfy_token", "save-ntfy-token.py")
app_build = module("app_build", "app_build.py")
web_access = module("web_access", "web_access.py")
web_password = module("pipelines_password", "password.py")
DEFAULT_PREFIX = Path.home() / ".local/share/pipelines"
MARKER = "pipelines-install.json"
@@ -351,16 +352,17 @@ class Setup:
or Path.home() / ".config/pipelines/web-auth.json").expanduser().resolve()
if auth.exists():
data = json.loads(auth.read_text())
if (not isinstance(data, dict) or not isinstance(data.get("password"), str)
or len(data["password"]) < 8 or not isinstance(data.get("secret"), str)
or len(data["secret"]) < 32):
if not web_password.valid_auth(data):
raise ValueError(f"Invalid existing web auth file; retained unchanged: {auth}")
if auth.stat().st_mode & 0o077:
raise ValueError(f"Web auth file must be private (chmod 600): {auth}")
else:
password = self.choose_password()
self.chosen_web_password = password
auth.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
self._write_atomic(auth, (json.dumps({"password": password,
# Only a scrypt hash is stored (see scripts/password.py).
self._write_atomic(auth, (json.dumps({"password_hash": web_password.hash_password(password),
"password_weak": False, "generation": 0,
"secret": secrets.token_urlsafe(48)}) + "\n").encode(), 0o600)
server_token = self.ensure_server_token(auth.parent / "server-token")
target = prefix / "lib/web"
@@ -395,17 +397,20 @@ class Setup:
PIPELINES_WEB_PASSWORD answers it without a terminal (automation)."""
given = self.environ.get("PIPELINES_WEB_PASSWORD")
if given is not None:
if len(given) < 8:
raise ValueError("PIPELINES_WEB_PASSWORD must be at least 8 characters")
problem = web_password.password_problem(given)
if problem:
raise ValueError(f"PIPELINES_WEB_PASSWORD is too weak. {problem}")
return given
if not sys.stdin.isatty():
raise ValueError("Choose the web sign-in password: rerun ./install in a terminal, "
"or set PIPELINES_WEB_PASSWORD (at least 8 characters)")
"or set PIPELINES_WEB_PASSWORD. " + web_password.PASSWORD_RULE)
print("This computer has no web sign-in yet. Choose the password for the web app and phone.")
print(web_password.PASSWORD_RULE)
while True:
first = getpass.getpass("Web password (at least 8 characters): ")
if len(first) < 8:
print("Too short; use at least 8 characters.")
first = getpass.getpass("Web password: ")
problem = web_password.password_problem(first)
if problem:
print(problem)
continue
if getpass.getpass("Repeat the password: ") != first:
print("The passwords did not match; try again.")
@@ -695,6 +700,17 @@ class Setup:
process.kill()
process.wait()
def reader_password(self, web):
"""The phone's ntfy password, which matches the web password: the one
chosen during this install, else a not yet migrated plaintext file. A
hashed file has no plaintext; an existing ntfy account keeps its own
password and a new one is asked for on the terminal."""
chosen = getattr(self, "chosen_web_password", None)
if chosen is not None:
return chosen
legacy = json.loads(Path(web["auth_file"]).read_text()).get("password")
return legacy if isinstance(legacy, str) else None
def bootstrap_ntfy(self, prefix, config_path, reader_password=None):
def run_ntfy(args, capture=False, interactive=False, password=None):
return self.ntfy(prefix, config_path, list(args), capture=capture, password=password)
@@ -880,7 +896,7 @@ class Setup:
else:
self.migrate_docker(prefix, args.replace_data)
self.bootstrap_ntfy(prefix, config_path,
reader_password=json.loads(Path(web["auth_file"]).read_text())["password"])
reader_password=self.reader_password(web))
timezone = args.timezone
if not timezone:
try: