Spaces:
Sleeping
Sleeping
Upload decimal-bot.html
Browse files- 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2706 |
} catch (e) {
|
| 2707 |
setSt('bSt', 'WS ERROR', 'bdg-r'); return;
|
| 2708 |
}
|
|
@@ -2770,12 +2775,16 @@
|
|
| 2770 |
}
|
| 2771 |
|
| 2772 |
// ββ FETCH BHAV ββ
|
| 2773 |
-
async function
|
| 2774 |
-
const url = $('
|
| 2775 |
if (!url) { demoB(); return; }
|
| 2776 |
setSt('bSt', 'LOADING...', 'bdg-w'); incNC();
|
| 2777 |
-
|
| 2778 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 {
|