PC set-up: one line per PC (/setup/<name>.ps1), the admin laptop always let in, and the admin check no longer breaks the script
- the inserted administrator check split the header comment, leaving '} for ... run ONCE' as code: WS and SC
join.ps1 failed to parse (Windows' parser: Missing opening '(' after keyword 'for'); now after the whole line
- site.admin_ips / admin_keys (laptop 10.6.7.38, fixed in UniFi) go into every PC script's firewall rule and key
files, and into the Mac join line, so running a set-up again never shuts the laptop out
- scripts verified by Windows' own PowerShell parser on the NA Lighting PC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -716,6 +716,17 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
return
|
||||
if path == "/join":
|
||||
return self.send(200, campus.join_mac(site.load(), self.base_url()), "text/plain; charset=utf-8")
|
||||
m = re.fullmatch(r"/setup/([A-Za-z0-9_]+)\.ps1", path)
|
||||
if m:
|
||||
# One computer's set-up script, for "irm http://<this Mac>:8020/setup/<name>.ps1 | iex" in an
|
||||
# administrator PowerShell on that PC (2026-10-21: the Bible TV PC's SSH had stopped).
|
||||
cfg = site.load()
|
||||
h = (cfg.get("hosts") or {}).get(m.group(1))
|
||||
if not h or h.get("os") != "windows":
|
||||
return self.send(404, {"error": "no Windows computer called %s here" % m.group(1)})
|
||||
text = "# Run in PowerShell as administrator: irm %s/setup/%s.ps1 | iex\n%s" % (
|
||||
self.base_url(), m.group(1), scripts.with_admin_check(scripts.windows_setup(cfg, m.group(1))))
|
||||
return self.send(200, text, "text/plain; charset=utf-8")
|
||||
if path == "/join.ps1":
|
||||
return self.send(200, campus.join_windows(site.load(), self.base_url()), "text/plain; charset=utf-8")
|
||||
if path == "/api/state":
|
||||
|
||||
Reference in New Issue
Block a user