From 6772c96fef054461c50fcbe200db0bf982941da5 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Mon, 15 Jun 2026 20:03:17 -0700 Subject: [PATCH] sync: auto-sync from GURU-5070 at 2026-06-15 20:03:03 Author: Mike Swanson Machine: GURU-5070 Timestamp: 2026-06-15 20:03:03 --- .claude/skills/unifi-wifi/scripts/apply-radio.sh | 2 +- .claude/skills/unifi-wifi/scripts/live-stats.sh | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.claude/skills/unifi-wifi/scripts/apply-radio.sh b/.claude/skills/unifi-wifi/scripts/apply-radio.sh index 9b3670e..b2ac3da 100644 --- a/.claude/skills/unifi-wifi/scripts/apply-radio.sh +++ b/.claude/skills/unifi-wifi/scripts/apply-radio.sh @@ -87,7 +87,7 @@ def call(method,path,body=None,csrf=None,want_headers=False): r=urllib.request.Request(base+path,data=data,method=method) r.add_header('Content-Type','application/json') if csrf:r.add_header('X-CSRF-Token',csrf) - resp=op.open(r,timeout=20);hdr=dict(resp.headers);txt=resp.read().decode('utf-8','replace') + resp=op.open(r,timeout=20);hdr=resp.headers;txt=resp.read().decode('utf-8','replace') return (txt,hdr) if want_headers else txt # login + CSRF try:_,hd=call('POST','/api/auth/login',{'username':os.environ['RW_U'],'password':os.environ['RW_P']},want_headers=True) diff --git a/.claude/skills/unifi-wifi/scripts/live-stats.sh b/.claude/skills/unifi-wifi/scripts/live-stats.sh index 1db8f29..65cfa46 100644 --- a/.claude/skills/unifi-wifi/scripts/live-stats.sh +++ b/.claude/skills/unifi-wifi/scripts/live-stats.sh @@ -36,20 +36,17 @@ CJ="$(mktemp)"; trap 'rm -f "$CJ"' EXIT base="https://$HOST:$PORT" # UniFi OS login -> session cookie code=$(curl -sk -c "$CJ" -o /dev/null -w '%{http_code}' -X POST "$base/api/auth/login" \ - -H 'Content-Type: application/json' --data-binary "$(python -c 'import json,os;print(json.dumps({"username":os.environ["U"],"password":os.environ["P"]}))' U="$U" P="$P")") + -H 'Content-Type: application/json' --data-binary "$(python -c 'import json,sys;print(json.dumps({"username":sys.argv[1],"password":sys.argv[2]}))' "$U" "$P")") [ "$code" = "200" ] || { echo "[ERROR] login HTTP $code"; exit 1; } -# resolve site short name (classic API keys on the short name, not the _id) -SHORT="$SITEARG" -if [[ "$SITEARG" =~ ^[0-9a-f]{24}$ || ! "$SITEARG" =~ ^[a-z0-9]{8}$ ]]; then - SHORT="$(curl -sk -b "$CJ" "$base/proxy/network/api/self/sites" | python -c " +# resolve site short name (classic API keys on the short name, not the _id or display name) +SHORT="$(curl -sk -b "$CJ" "$base/proxy/network/api/self/sites" | python -c " import sys,json -d=json.load(sys.stdin).get('data',[]) -q='''$SITEARG'''.lower() +d=json.load(sys.stdin).get('data',[]); q='''$SITEARG'''.lower() for s in d: - if s.get('_id')=='''$SITEARG''' or q in (s.get('desc','').lower()): print(s.get('name')); break + if s.get('_id')=='''$SITEARG''' or s.get('name')=='''$SITEARG''' or q in (s.get('desc','').lower()): print(s.get('name')); break " 2>/dev/null)" -fi +[ -n "$SHORT" ] || SHORT="$SITEARG" [ -n "$SHORT" ] || { echo "[ERROR] could not resolve site '$SITEARG'"; exit 1; } echo "[INFO] site short=$SHORT"