"Location", never "campus", in everything people read; SC FOH joined with its MIDI links
- pages (NA 98 Locations / 99 Location, re-imported via PAGES_VERSION), keys, settings page, setup and install messages, alerts, docs, the Apollo Beach kit; python3 -m settings.location and /location/... addresses (the old names still answer for installed Macs) - Apply reads the before settings from the file: an in-place edit skipped the watchdog restart - SC: SUPERRACK (+SoundGrid) and X32 EDIT from SC FOH; FOH TRACKS and TRACKS LIGHTS MIDI links watched Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+15
-15
@@ -687,14 +687,14 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
return self.send(200, keyguide.cheat_sheet(site.load(), self.my_address()), "text/html; charset=utf-8")
|
||||
if path == "/where.html":
|
||||
return self.send(200, keyguide.where_things_are(site.load(), site.data_dir, self.my_address()), "text/html; charset=utf-8")
|
||||
# ---- auto-setup: the install line for a new campus, the join lines for its computers ----
|
||||
if path == "/campus/install":
|
||||
# ---- auto-setup: the install line for a new location, the join lines for its computers ----
|
||||
if path in ("/campus/install", "/location/install"):
|
||||
key, _ = scripts.public_key(site.load())
|
||||
return self.send(200, campus.install_script(self.base_url(), q.get("id", ["new"])[0], key), "text/plain; charset=utf-8")
|
||||
if path == "/campus/program.tgz":
|
||||
if path in ("/campus/program.tgz", "/location/program.tgz"):
|
||||
return self.send(200, campus.program_kit(site.data_dir), "application/gzip")
|
||||
if path == "/campus/companion.zip":
|
||||
# Companion 5.0.7 as this Mac has it, for `settings.campus upgrade-companion` on a campus
|
||||
if path in ("/campus/companion.zip", "/location/companion.zip"):
|
||||
# Companion 5.0.7 as this Mac has it, for `settings.campus upgrade-companion` on a location
|
||||
# still on an older one (packed once, kept beside the config, streamed).
|
||||
app = "/Applications/Companion 5.0.7.app"
|
||||
pack = os.path.join(site.data_dir, "companion-5.0.7.zip")
|
||||
@@ -721,7 +721,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
if path == "/api/state":
|
||||
return self.send(200, campuses.state_now(site))
|
||||
if path == "/api/campuses":
|
||||
# The hub's own view (its settings page). A campus only ever lists itself.
|
||||
# The hub's own view (its settings page). A location only ever lists itself.
|
||||
data = campuses.load(site.data_dir)
|
||||
hub = campuses.Mirror.is_hub(data)
|
||||
return self.send(200, {"list": data.get("list") or {}, "pages": data.get("pages") or {} if hub else {},
|
||||
@@ -824,7 +824,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
if os.path.exists(fp):
|
||||
z.write(fp, name)
|
||||
z.writestr("README.txt", "Site bundle of %s, exported %s from the settings page.\nDrop it in the repo as sites/%s/ or feed it to "
|
||||
"'New campus from a bundle' on another campus's page.\n" % ((cfg.get("site") or {}).get("name", "?"), time.strftime("%Y-%m-%d %H:%M"), (cfg.get("site") or {}).get("id", "site")))
|
||||
"'New location from a bundle' on another location's page.\n" % ((cfg.get("site") or {}).get("name", "?"), time.strftime("%Y-%m-%d %H:%M"), (cfg.get("site") or {}).get("id", "site")))
|
||||
data = buf.getvalue()
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/zip")
|
||||
@@ -906,7 +906,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
site.discover_poke.set()
|
||||
return self.send(200, {"ok": True})
|
||||
if path == "/api/campus/hello":
|
||||
# Another campus says where its settings page is (the hub keeps the list for everyone).
|
||||
# Another location says where its settings page is (the hub keeps the list for everyone).
|
||||
cid = str(body.get("id") or "")
|
||||
url = str(body.get("url") or "")
|
||||
if not re.fullmatch(r"[a-z0-9]{1,8}", cid) or not re.fullmatch(r"http://\d{1,3}(\.\d{1,3}){3}:\d{2,5}", url) \
|
||||
@@ -914,7 +914,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
return self.send(400, {"error": "an id like ws and an address like http://10.5.1.1:8020"})
|
||||
data = campuses.load(site.data_dir)
|
||||
if not campuses.Mirror.is_hub(data):
|
||||
return self.send(403, {"error": "this settings page keeps no list of campuses"})
|
||||
return self.send(403, {"error": "this settings page keeps no list of locations"})
|
||||
lst = data.setdefault("list", {})
|
||||
for other in [k for k, e in lst.items() if k != cid and (e or {}).get("url") == url]:
|
||||
lst.pop(other) # the same Mac under its old name (before its first setup)
|
||||
@@ -924,7 +924,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
campuses.save(site.data_dir, data)
|
||||
return self.send(200, {"ok": True})
|
||||
if path == "/api/fleet/hello":
|
||||
# A machine anywhere (any campus) says it now takes the admin laptop's key: kept for the
|
||||
# A machine anywhere (any location) says it now takes the admin laptop's key: kept for the
|
||||
# laptop's SSH shortcuts (tools/fleet.py). Nothing here acts on it.
|
||||
try:
|
||||
entry = discover.clean_hello(body, self.client_address[0])
|
||||
@@ -1098,7 +1098,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
return self.send(400, {"error": "not a site bundle or settings file: %s" % e})
|
||||
cfg = site.load()
|
||||
mine = cfg.get("site") or {}
|
||||
src = (new_cfg.get("site") or {}).get("name") or "the other campus"
|
||||
src = (new_cfg.get("site") or {}).get("name") or "the other location"
|
||||
new_cfg["site"] = dict(new_cfg.get("site") or {}, **{k: mine[k] for k in ("id", "name", "ingest_name", "ingest_hostname", "ingest_ips", "editing_code", "settings_port") if k in mine})
|
||||
flag = "copied from %s - check it" % src
|
||||
for alias, h in (new_cfg.get("hosts") or {}).items():
|
||||
@@ -1110,7 +1110,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
f["label"] = f.get("label", "")
|
||||
errors, warnings = schema.validate(new_cfg)
|
||||
draft, _ = site.draft.update(new_cfg, who, site.cfg_sha)
|
||||
log.info("%s started a new campus from a bundle of %s", who, src)
|
||||
log.info("%s started a new location from a bundle of %s", who, src)
|
||||
return self.send(200, {"draft": self.masked_draft(draft), "from": src, "errors": errors, "warnings": warnings})
|
||||
if path == "/api/atem-reference/pick-newest":
|
||||
folder = os.path.expanduser((site.cfg.get("atem") or {}).get("source_folder") or "")
|
||||
@@ -1148,7 +1148,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
|
||||
def names_check(self, cfg):
|
||||
"""Every device name the keys use, against what this Companion, the Dante network and the Macs report now:
|
||||
the mapping step of a copied campus."""
|
||||
the mapping step of a copied location."""
|
||||
site = self.site
|
||||
try:
|
||||
live = {c["label"]: c.get("moduleId") for c in site.comp.connections()}
|
||||
@@ -1388,7 +1388,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
return self.send(404, {"error": "missing %s" % name})
|
||||
|
||||
def base_url(self):
|
||||
"""This page as the caller reached it (an address, across campuses: names do not cross subnets)."""
|
||||
"""This page as the caller reached it (an address, across locations: names do not cross subnets)."""
|
||||
host = (self.headers.get("Host") or "").strip() or "%s:%d" % (self.server.server_address[0], self.server.server_address[1])
|
||||
if not re.fullmatch(r"[A-Za-z0-9.\-]+(:\d+)?", host):
|
||||
host = "%s:%d" % (self.server.server_address[0], self.server.server_address[1])
|
||||
@@ -1506,7 +1506,7 @@ def main(argv=None):
|
||||
stop = threading.Event()
|
||||
threading.Thread(target=rebind_loop, args=(site, servers, port, stop), daemon=True).start()
|
||||
threading.Thread(target=campus.loop, args=(site, stop, site.discover_poke), name="auto-setup", daemon=True).start()
|
||||
threading.Thread(target=campuses.loop, args=(site, stop), name="campuses", daemon=True).start()
|
||||
threading.Thread(target=campuses.loop, args=(site, stop), name="locations", daemon=True).start()
|
||||
try:
|
||||
while True:
|
||||
time.sleep(3600)
|
||||
|
||||
Reference in New Issue
Block a user