somratpro commited on
Commit
4daa85e
Β·
1 Parent(s): fb00c77

feat: add ACP plugin configuration toggle and strip host header from proxy requests

Browse files
Files changed (3) hide show
  1. cloudflare-proxy-setup.py +1 -0
  2. cloudflare-worker.js +1 -0
  3. start.sh +14 -1
cloudflare-proxy-setup.py CHANGED
@@ -103,6 +103,7 @@ async function handleRequest(request) {{
103
  headers.delete("cf-connecting-ip");
104
  headers.delete("cf-ray");
105
  headers.delete("cf-visitor");
 
106
  headers.delete("x-real-ip");
107
  headers.delete("x-target-host");
108
 
 
103
  headers.delete("cf-connecting-ip");
104
  headers.delete("cf-ray");
105
  headers.delete("cf-visitor");
106
+ headers.delete("host");
107
  headers.delete("x-real-ip");
108
  headers.delete("x-target-host");
109
 
cloudflare-worker.js CHANGED
@@ -70,6 +70,7 @@ export default {
70
  headers.delete("cf-connecting-ip");
71
  headers.delete("cf-ray");
72
  headers.delete("cf-visitor");
 
73
  headers.delete("x-real-ip");
74
  headers.delete("x-target-host");
75
 
 
70
  headers.delete("cf-connecting-ip");
71
  headers.delete("cf-ray");
72
  headers.delete("cf-visitor");
73
+ headers.delete("host");
74
  headers.delete("x-real-ip");
75
  headers.delete("x-target-host");
76
 
start.sh CHANGED
@@ -19,6 +19,7 @@ if [ -n "${SPACE_HOST:-}" ]; then
19
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
20
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-compact}"
21
  BROWSER_PLUGIN_MODE="${BROWSER_PLUGIN_MODE:-disabled}"
 
22
  # HF Spaces does not benefit from Bonjour discovery, and the retries add noise.
23
  export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-1}"
24
  else
@@ -26,6 +27,7 @@ else
26
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
27
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-pretty}"
28
  BROWSER_PLUGIN_MODE="${BROWSER_PLUGIN_MODE:-auto}"
 
29
  fi
30
  echo ""
31
  echo " ╔══════════════════════════════════════════╗"
@@ -280,7 +282,10 @@ elif [ "$BROWSER_PLUGIN_MODE" = "auto" ] && [ -n "$BROWSER_EXECUTABLE_PATH" ] &&
280
  fi
281
 
282
  # Restrict bundled plugin loading on HF Spaces so unrelated broken plugins do not crash the gateway after startup.
283
- PLUGIN_ALLOW_JSON='["acpx","device-pair","phone-control","talk-voice"]'
 
 
 
284
  if [ "$BROWSER_SHOULD_ENABLE" = "true" ]; then
285
  PLUGIN_ALLOW_JSON=$(jq '. + ["browser"]' <<<"$PLUGIN_ALLOW_JSON")
286
  fi
@@ -294,6 +299,14 @@ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".plugins.allow = $PLUGIN_ALLOW_JSON")
294
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.deny = ["lmstudio","xai"]')
295
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.lmstudio.enabled = false | .plugins.entries.xai.enabled = false')
296
 
 
 
 
 
 
 
 
 
297
  if [ "$BROWSER_SHOULD_ENABLE" = "true" ]; then
298
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq \
299
  ".browser = {
 
19
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
20
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-compact}"
21
  BROWSER_PLUGIN_MODE="${BROWSER_PLUGIN_MODE:-disabled}"
22
+ ACP_PLUGIN_MODE="${ACP_PLUGIN_MODE:-disabled}"
23
  # HF Spaces does not benefit from Bonjour discovery, and the retries add noise.
24
  export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-1}"
25
  else
 
27
  OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
28
  OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-pretty}"
29
  BROWSER_PLUGIN_MODE="${BROWSER_PLUGIN_MODE:-auto}"
30
+ ACP_PLUGIN_MODE="${ACP_PLUGIN_MODE:-auto}"
31
  fi
32
  echo ""
33
  echo " ╔══════════════════════════════════════════╗"
 
282
  fi
283
 
284
  # Restrict bundled plugin loading on HF Spaces so unrelated broken plugins do not crash the gateway after startup.
285
+ PLUGIN_ALLOW_JSON='["device-pair","phone-control","talk-voice"]'
286
+ if [ "$ACP_PLUGIN_MODE" = "enabled" ] || [ "$ACP_PLUGIN_MODE" = "auto" ]; then
287
+ PLUGIN_ALLOW_JSON=$(jq '. + ["acpx"]' <<<"$PLUGIN_ALLOW_JSON")
288
+ fi
289
  if [ "$BROWSER_SHOULD_ENABLE" = "true" ]; then
290
  PLUGIN_ALLOW_JSON=$(jq '. + ["browser"]' <<<"$PLUGIN_ALLOW_JSON")
291
  fi
 
299
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.deny = ["lmstudio","xai"]')
300
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.lmstudio.enabled = false | .plugins.entries.xai.enabled = false')
301
 
302
+ if [ "$ACP_PLUGIN_MODE" = "disabled" ]; then
303
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.acpx.enabled = false')
304
+ fi
305
+
306
+ if [ "$BROWSER_SHOULD_ENABLE" != "true" ]; then
307
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.browser.enabled = false | .browser.enabled = false')
308
+ fi
309
+
310
  if [ "$BROWSER_SHOULD_ENABLE" = "true" ]; then
311
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq \
312
  ".browser = {