8cadacb553
gates / gates (push) Successful in 26s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
36 lines
3.1 KiB
Python
36 lines
3.1 KiB
Python
# Decision 48 / R-714: wanderer cannot be gated (its web server calls its own database through the public name), and
|
|
# needs no gate for the first admin (PocketBase's superuser installer needs the one-time link from the server log).
|
|
# Its door is sign-up — through the web AND straight through PocketBase's API. Closed by the household's press.
|
|
import os, re, sys
|
|
R = sys.argv[1]
|
|
c = os.path.join(R, "templates", "wanderer", "docker-compose.yml"); s = open(c).read()
|
|
assert " - PUBLIC_DISABLE_SIGNUP=false\n" in s
|
|
s = s.replace(" - PUBLIC_DISABLE_SIGNUP=false\n", " # decision 47/48: open until the household closes sign-up (after_setup / close sign-up now)\n - PUBLIC_DISABLE_SIGNUP=${SIGNUP_CLOSED:-false}\n", 1)
|
|
open(c, "w").write(s)
|
|
f = os.path.join(R, "templates", "wanderer", ".felhom.yml"); s = open(f).read()
|
|
i = s.index("\n# --- App info") if "\n# --- App info" in s else s.index("\napp_info:")
|
|
block = """
|
|
# --- Sign-up (controller >= 0.282.0, `09` §3 decisions 47-48) ---
|
|
# NOT gated: its web server calls its own database through the public name, which a gate would refuse (measured on
|
|
# 9202 2026-09-29, R-714). No first-admin screen to take: PocketBase's superuser installer needs the one-time link
|
|
# from the server log. The door is SIGN-UP — in the web and straight through PocketBase's API (measured 2026-09-29:
|
|
# a stranger's POST /api/collections/users/records answered 200 — and PocketBase takes the collection by its id
|
|
# `_pb_users_auth_` and in ANY letter case, hence the case-insensitive pattern). After the household makes its account, the app
|
|
# page offers "Close sign-up now": both addresses answer "sign-up is closed", and wanderer's own switch goes on.
|
|
signup_block: "Path(`/register`) || (PathRegexp(`(?i)^/+api/+collections/+(users|_pb_users_auth_)/+records`) && Method(`POST`))"
|
|
after_setup:
|
|
env:
|
|
SIGNUP_CLOSED: "true"
|
|
"""
|
|
s = s[:i] + block + s[i:]
|
|
s = re.sub(r"(\napp_info:\n(?: [^\n]*\n)*? tagline: [^\n]*\n)", lambda m: m.group(1) + ' add_people: "Nyisd meg a regisztrációt 15 percre, és a családtagod regisztrál."\n', s, count=1)
|
|
s = re.sub(r"(\n en:\n(?: [^\n]*\n)*? app_info:\n tagline: [^\n]*\n)", lambda m: m.group(1) + " add_people: 'Open sign-up for 15 minutes, and your family member signs up.'\n", s, count=1)
|
|
old_hu = " - 'Hozd létre a fiókodat azonnal a telepítés után. Figyelem: ebben az alkalmazásban bárki, aki megtalálja a címet, fiókot hozhat létre.'\n"
|
|
old_en = " - 'Create your account right after the install. Note: in this app, anyone who finds the address can make an account.'\n"
|
|
assert old_hu in s and old_en in s
|
|
s = s.replace(old_hu, " - 'Hozd létre a fiókodat azonnal a telepítés után, aztán az alkalmazás oldalán zárd le a regisztrációt. Addig bárki, aki megtalálja a címet, fiókot hozhat létre.'\n")
|
|
s = s.replace(old_en, " - 'Create your account right after the install, then close sign-up on the app page. Until then, anyone who finds the address can make an account.'\n")
|
|
assert s.count("add_people:") == 2
|
|
open(f, "w").write(s)
|
|
print("wanderer patched")
|