Arbitrage01 commited on
Commit
6223280
Β·
verified Β·
1 Parent(s): 331348f

Upload decimal-bot.html

Browse files
Files changed (1) hide show
  1. decimal-bot.html +14 -5
decimal-bot.html CHANGED
@@ -2702,7 +2702,12 @@
2702
  function connectRebelWs() {
2703
  setSt('bSt', 'CONNECTING...', 'bdg-w');
2704
  try {
2705
- rebelWs = new WebSocket('ws://localhost:3000');
 
 
 
 
 
2706
  } catch (e) {
2707
  setSt('bSt', 'WS ERROR', 'bdg-r'); return;
2708
  }
@@ -2770,12 +2775,16 @@
2770
  }
2771
 
2772
  // ── FETCH BHAV ──
2773
- async function fetchBhav() {
2774
- const url = $('sBhavUrl').value.trim();
2775
  if (!url) { demoB(); return; }
2776
  setSt('bSt', 'LOADING...', 'bdg-w'); incNC();
2777
- // Route through local proxy to avoid CORS block
2778
- const proxyUrl = `http://localhost:3000/proxy?url=${encodeURIComponent(url)}`;
 
 
 
 
2779
  const controller = new AbortController();
2780
  const timer = setTimeout(() => controller.abort(), 10000);
2781
  try {
 
2702
  function connectRebelWs() {
2703
  setSt('bSt', 'CONNECTING...', 'bdg-w');
2704
  try {
2705
+ // Dynamic WebSocket URL to work on both localhost and cloud (Hugging Face)
2706
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
2707
+ const host = window.location.host || 'localhost:3000';
2708
+ const wsUrl = `${protocol}//${host}`;
2709
+ console.log(`[REBEL777] Connecting to ${wsUrl}...`);
2710
+ rebelWs = new WebSocket(wsUrl);
2711
  } catch (e) {
2712
  setSt('bSt', 'WS ERROR', 'bdg-r'); return;
2713
  }
 
2775
  }
2776
 
2777
  // ── FETCH BHAV ──
2778
+ async function fetchRebel777() {
2779
+ const url = $('sRebel777Url').value.trim();
2780
  if (!url) { demoB(); return; }
2781
  setSt('bSt', 'LOADING...', 'bdg-w'); incNC();
2782
+
2783
+ // Dynamic host detection for local/cloud
2784
+ const host = window.location.host || 'localhost:3000';
2785
+ const protocol = window.location.protocol;
2786
+ const proxyUrl = `${protocol}//${host}/start-rebel777?url=${encodeURIComponent(url)}`;
2787
+
2788
  const controller = new AbortController();
2789
  const timer = setTimeout(() => controller.abort(), 10000);
2790
  try {