Spaces:
Paused
Paused
fix: force default auth token 'openclaw-space-default' to match client injection
Browse files- scripts/sync_hf.py +13 -2
scripts/sync_hf.py
CHANGED
|
@@ -372,11 +372,14 @@ class OpenClawFullSync:
|
|
| 372 |
if isinstance(locs, list) and "/dev/null" in locs:
|
| 373 |
data["plugins"]["locations"] = [l for l in locs if l != "/dev/null"]
|
| 374 |
|
| 375 |
-
# Force full gateway config for HF Spaces
|
|
|
|
|
|
|
| 376 |
data["gateway"] = {
|
| 377 |
"mode": "local",
|
| 378 |
"bind": "lan",
|
| 379 |
"port": 7860,
|
|
|
|
| 380 |
"trustedProxies": ["0.0.0.0/0"],
|
| 381 |
"controlUi": {
|
| 382 |
"allowInsecureAuth": True,
|
|
@@ -386,7 +389,7 @@ class OpenClawFullSync:
|
|
| 386 |
]
|
| 387 |
}
|
| 388 |
}
|
| 389 |
-
print("[SYNC] Set gateway config (
|
| 390 |
|
| 391 |
# Ensure agents defaults
|
| 392 |
data.setdefault("agents", {}).setdefault("defaults", {}).setdefault("model", {})
|
|
@@ -416,8 +419,16 @@ class OpenClawFullSync:
|
|
| 416 |
with open(config_path, "w") as f:
|
| 417 |
json.dump(data, f, indent=2)
|
| 418 |
print("[SYNC] Config patched and saved.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
except Exception as e:
|
| 420 |
print(f"[SYNC] Failed to patch config: {e}")
|
|
|
|
| 421 |
|
| 422 |
def _ensure_telegram_credentials(self):
|
| 423 |
"""Configure Telegram bot token and allowed users."""
|
|
|
|
| 372 |
if isinstance(locs, list) and "/dev/null" in locs:
|
| 373 |
data["plugins"]["locations"] = [l for l in locs if l != "/dev/null"]
|
| 374 |
|
| 375 |
+
# Force full gateway config for HF Spaces
|
| 376 |
+
# Note: Dockerfile injects "openclaw-space-default" token into Control UI,
|
| 377 |
+
# so we MUST set it here to match what the browser sends.
|
| 378 |
data["gateway"] = {
|
| 379 |
"mode": "local",
|
| 380 |
"bind": "lan",
|
| 381 |
"port": 7860,
|
| 382 |
+
"auth": {"token": "openclaw-space-default"},
|
| 383 |
"trustedProxies": ["0.0.0.0/0"],
|
| 384 |
"controlUi": {
|
| 385 |
"allowInsecureAuth": True,
|
|
|
|
| 389 |
]
|
| 390 |
}
|
| 391 |
}
|
| 392 |
+
print("[SYNC] Set gateway config (auth=default, trustedProxies=all)")
|
| 393 |
|
| 394 |
# Ensure agents defaults
|
| 395 |
data.setdefault("agents", {}).setdefault("defaults", {}).setdefault("model", {})
|
|
|
|
| 419 |
with open(config_path, "w") as f:
|
| 420 |
json.dump(data, f, indent=2)
|
| 421 |
print("[SYNC] Config patched and saved.")
|
| 422 |
+
|
| 423 |
+
# Verify write
|
| 424 |
+
with open(config_path, "r") as f:
|
| 425 |
+
verify_data = json.load(f)
|
| 426 |
+
gw = verify_data.get("gateway", {})
|
| 427 |
+
print(f"[SYNC] VERIFY GATEWAY CONFIG: mode={gw.get('mode')}, port={gw.get('port')}, auth={gw.get('auth')}, trustedProxies={gw.get('trustedProxies')}")
|
| 428 |
+
|
| 429 |
except Exception as e:
|
| 430 |
print(f"[SYNC] Failed to patch config: {e}")
|
| 431 |
+
traceback.print_exc()
|
| 432 |
|
| 433 |
def _ensure_telegram_credentials(self):
|
| 434 |
"""Configure Telegram bot token and allowed users."""
|