somratpro commited on
Commit
1b1f2ba
·
1 Parent(s): 46747b3

feat: allow merging multiple origins into control UI allowed list instead of overwriting

Browse files
Files changed (1) hide show
  1. start.sh +4 -3
start.sh CHANGED
@@ -360,11 +360,12 @@ if [ -n "${TRUSTED_PROXIES:-}" ]; then
360
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".gateway.trustedProxies += $PROXIES_JSON | .gateway.trustedProxies |= unique")
361
  fi
362
 
363
- # Allowed origins (optional — lock down Control UI to specific URLs)
364
- # Set ALLOWED_ORIGINS as comma-separated URLs, e.g. "https://your-space.hf.space"
 
365
  if [ -n "${ALLOWED_ORIGINS:-}" ]; then
366
  ORIGINS_JSON=$(echo "$ALLOWED_ORIGINS" | tr ',' '\n' | sed 's/^ *//;s/ *$//' | jq -R . | jq -s .)
367
- CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".gateway.controlUi.allowedOrigins = $ORIGINS_JSON")
368
  fi
369
 
370
  # Telegram (supports multiple user IDs, comma-separated)
 
360
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".gateway.trustedProxies += $PROXIES_JSON | .gateway.trustedProxies |= unique")
361
  fi
362
 
363
+ # Allowed origins (optional — add extra origins for external OpenClaw clients)
364
+ # Set ALLOWED_ORIGINS as comma-separated URLs, e.g. "https://app.openclaw.ai"
365
+ # These are MERGED with the Space host origin (which is always allowed).
366
  if [ -n "${ALLOWED_ORIGINS:-}" ]; then
367
  ORIGINS_JSON=$(echo "$ALLOWED_ORIGINS" | tr ',' '\n' | sed 's/^ *//;s/ *$//' | jq -R . | jq -s .)
368
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".gateway.controlUi.allowedOrigins += $ORIGINS_JSON | .gateway.controlUi.allowedOrigins |= unique")
369
  fi
370
 
371
  # Telegram (supports multiple user IDs, comma-separated)