fix: bincio init always sets private:true even if index.json already exists
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user