Spaces:
Sleeping
Sleeping
feat: switch auth from password to token mode (persists in browser)
Browse filesToken auth stores the credential in localStorage so user only needs
to enter it once. Password auth requires re-entry on every page refresh.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files changed (2)
- openclaw.json+1-1
- scripts/sync_hf.py+4-4
2 unmodified lines34567892 unmodified lines"mode": "local","bind": "lan","port": 7860,"auth": { "password": "__OPENCLAW_PASSWORD__" },"trustedProxies": ["0.0.0.0/0"],2 unmodified lines34567892 unmodified lines"mode": "local","bind": "lan","port": 7860,"auth": { "token": "__OPENCLAW_PASSWORD__" },"trustedProxies": ["0.0.0.0/0"],
345 unmodified lines34634734834935035135235366 unmodified lines42042142242342442542614 unmodified lines441442443444445446447345 unmodified linescfg = json.load(f)# Replace token placeholderif "gateway" in cfg and "auth" in cfg["gateway"]:if cfg["gateway"]["auth"].get("password") == "__OPENCLAW_PASSWORD__":cfg["gateway"]["auth"]["password"] = OPENCLAW_PASSWORDif OPENAI_API_KEY and "models" in cfg and "providers" in cfg["models"] and "openai" in cfg["models"]["providers"]:cfg["models"]["providers"]["openai"]["apiKey"] = OPENAI_API_KEYif OPENAI_BASE_URL:66 unmodified lines# Force full gateway config for HF Spacesif not OPENCLAW_PASSWORD:print("[SYNC] WARNING: OPENCLAW_PASSWORD not set! Gateway will have no auth.")auth = {"password": OPENCLAW_PASSWORD} if OPENCLAW_PASSWORD else {}# Dynamic allowedOrigins from SPACE_HOST (auto-set by HF runtime)allowed_origins = ["https://huggingface.co",14 unmodified lines"allowedOrigins": allowed_origins}}print(f"[SYNC] Set gateway config (auth={'password' if OPENCLAW_PASSWORD else 'none'}, origins={len(allowed_origins)})")# Ensure agents defaultsdata.setdefault("agents", {}).setdefault("defaults", {}).setdefault("model", {})345 unmodified lines34634734834935035135235366 unmodified lines42042142242342442542614 unmodified lines441442443444445446447345 unmodified linescfg = json.load(f)# Replace token placeholderif "gateway" in cfg and "auth" in cfg["gateway"]:if cfg["gateway"]["auth"].get("token") == "__OPENCLAW_PASSWORD__":cfg["gateway"]["auth"]["token"] = OPENCLAW_PASSWORDif OPENAI_API_KEY and "models" in cfg and "providers" in cfg["models"] and "openai" in cfg["models"]["providers"]:cfg["models"]["providers"]["openai"]["apiKey"] = OPENAI_API_KEYif OPENAI_BASE_URL:66 unmodified lines# Force full gateway config for HF Spacesif not OPENCLAW_PASSWORD:print("[SYNC] WARNING: OPENCLAW_PASSWORD not set! Gateway will have no auth.")auth = {"token": OPENCLAW_PASSWORD} if OPENCLAW_PASSWORD else {}# Dynamic allowedOrigins from SPACE_HOST (auto-set by HF runtime)allowed_origins = ["https://huggingface.co",14 unmodified lines"allowedOrigins": allowed_origins}}print(f"[SYNC] Set gateway config (auth={'token' if OPENCLAW_PASSWORD else 'none'}, origins={len(allowed_origins)})")# Ensure agents defaultsdata.setdefault("agents", {}).setdefault("defaults", {}).setdefault("model", {})
openclaw.json+1-1
scripts/sync_hf.py+4-4