somratpro commited on
Commit
561793f
Β·
1 Parent(s): 4511427

feat: expand Cloudflare proxy support to include Discord and Google services while streamlining configuration settings

Browse files
.env.example CHANGED
@@ -170,6 +170,18 @@ TELEGRAM_USER_ID=123456789
170
  # Multiple user IDs (comma-separated for team access)
171
  # TELEGRAM_USER_IDS=123456789,987654321,555555555
172
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  # ── OPTIONAL: Workspace Backup to HF Dataset ──
174
  HF_USERNAME=your_hf_username
175
  HF_TOKEN=hf_your_token_here
 
170
  # Multiple user IDs (comma-separated for team access)
171
  # TELEGRAM_USER_IDS=123456789,987654321,555555555
172
 
173
+ # ── OPTIONAL: Cloudflare Outbound Proxy ──
174
+ # Automatically bypass platform network blocks for Telegram/WhatsApp/Google/etc.
175
+ # Get a Cloudflare API Token with Account: Workers Scripts: Edit permissions.
176
+ # CLOUDFLARE_WORKERS_TOKEN=your_cloudflare_api_token_here
177
+
178
+ # Alternatively, if you already have a worker deployed:
179
+ # CLOUDFLARE_PROXY_URL=https://your-proxy.workers.dev
180
+ # CLOUDFLARE_PROXY_SECRET=your_proxy_secret_here
181
+
182
+ # Domains to proxy (default: *)
183
+ # CLOUDFLARE_PROXY_DOMAINS=*
184
+
185
  # ── OPTIONAL: Workspace Backup to HF Dataset ──
186
  HF_USERNAME=your_hf_username
187
  HF_TOKEN=hf_your_token_here
cloudflare-proxy-setup.py CHANGED
@@ -13,7 +13,16 @@ API_BASE = "https://api.cloudflare.com/client/v4"
13
  ENV_FILE = Path("/tmp/huggingclaw-cloudflare-proxy.env")
14
  DEFAULT_ALLOWED = [
15
  "api.telegram.org",
 
 
 
 
16
  "web.whatsapp.com",
 
 
 
 
 
17
  ]
18
 
19
 
 
13
  ENV_FILE = Path("/tmp/huggingclaw-cloudflare-proxy.env")
14
  DEFAULT_ALLOWED = [
15
  "api.telegram.org",
16
+ "discord.com",
17
+ "discordapp.com",
18
+ "gateway.discord.gg",
19
+ "status.discord.com",
20
  "web.whatsapp.com",
21
+ "graph.facebook.com",
22
+ "googleapis.com",
23
+ "google.com",
24
+ "googleusercontent.com",
25
+ "gstatic.com",
26
  ]
27
 
28
 
cloudflare-proxy.js CHANGED
@@ -48,6 +48,7 @@ if (PROXY_URL) {
48
  normalized === "127.0.0.1" ||
49
  normalized === "::1" ||
50
  normalized === "0.0.0.0" ||
 
51
  normalized.endsWith(".hf.space") ||
52
  normalized.endsWith(".huggingface.co") ||
53
  normalized === "huggingface.co";
 
48
  normalized === "127.0.0.1" ||
49
  normalized === "::1" ||
50
  normalized === "0.0.0.0" ||
51
+ normalized === proxy.hostname ||
52
  normalized.endsWith(".hf.space") ||
53
  normalized.endsWith(".huggingface.co") ||
54
  normalized === "huggingface.co";
cloudflare-worker.js CHANGED
@@ -39,7 +39,7 @@ export default {
39
  const allowProxyAll =
40
  String(env.ALLOW_PROXY_ALL || "true").toLowerCase() === "true";
41
  const allowedTargets = normalizeList(
42
- env.ALLOWED_TARGETS || "api.telegram.org,web.whatsapp.com",
43
  );
44
 
45
  const isAllowedHost = (hostname) => {
 
39
  const allowProxyAll =
40
  String(env.ALLOW_PROXY_ALL || "true").toLowerCase() === "true";
41
  const allowedTargets = normalizeList(
42
+ env.ALLOWED_TARGETS || "api.telegram.org,discord.com,discordapp.com,gateway.discord.gg,status.discord.com,web.whatsapp.com,graph.facebook.com,googleapis.com,google.com,googleusercontent.com,gstatic.com",
43
  );
44
 
45
  const isAllowedHost = (hostname) => {
start.sh CHANGED
@@ -362,7 +362,6 @@ if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
362
  | .channels.telegram.botToken = $token
363
  | .channels.telegram.commands.native = false
364
  | .channels.telegram.timeoutSeconds = 60
365
- | (if $proxy_url != "" then .channels.telegram.apiRoot = $proxy_url else . end)
366
  # | .channels.telegram.network.autoSelectFamily = false
367
  # | .channels.telegram.network.dnsResultOrder = "ipv4first"
368
  | .channels.telegram.retry = {
 
362
  | .channels.telegram.botToken = $token
363
  | .channels.telegram.commands.native = false
364
  | .channels.telegram.timeoutSeconds = 60
 
365
  # | .channels.telegram.network.autoSelectFamily = false
366
  # | .channels.telegram.network.dnsResultOrder = "ipv4first"
367
  | .channels.telegram.retry = {