From 7088b94a87a07a317d872aaf7d7703206a5c4e57 Mon Sep 17 00:00:00 2001 From: Davide Scaini Date: Fri, 10 Apr 2026 15:26:11 +0200 Subject: [PATCH] fix: bincio init always sets private:true even if index.json already exists --- bincio/serve/init_cmd.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bincio/serve/init_cmd.py b/bincio/serve/init_cmd.py index 5dfbb84..7c6fc8e 100644 --- a/bincio/serve/init_cmd.py +++ b/bincio/serve/init_cmd.py @@ -55,7 +55,19 @@ def init(data_dir: str, handle: str, password: str, display_name: str, name: str from datetime import datetime, timezone root_index = dd / "index.json" - if not root_index.exists(): + if root_index.exists(): + # Preserve existing manifest but always enforce private: True for a multi-user instance. + manifest = json.loads(root_index.read_text()) + instance = manifest.setdefault("instance", {}) + if not instance.get("private"): + instance["private"] = True + if name: + instance["name"] = name + root_index.write_text(json.dumps(manifest, indent=2)) + console.print(" [green]✓[/green] root index.json updated (private: true)") + else: + console.print(" [yellow]·[/yellow] root index.json already private — skipping") + else: manifest = { "bas_version": "1.0", "instance": {"name": name or "BincioActivity", "private": True}, @@ -65,8 +77,6 @@ def init(data_dir: str, handle: str, password: str, display_name: str, name: str } root_index.write_text(json.dumps(manifest, indent=2)) console.print(" [green]✓[/green] root index.json manifest written") - else: - console.print(" [yellow]·[/yellow] root index.json already exists — skipping") # ── User limit ──────────────────────────────────────────────────────────── if max_users > 0: