Spaces:
Runtime error
Runtime error
Download hyper_fix.js from Brozy123/LineUp-Bot: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/d7287468e78b0485df94de132afb92bfc4b1a1e5/hyper_fix.js
- Command line
-
hf download hf://spaces/Brozy123/LineUp-Bot@d7287468e78b0485df94de132afb92bfc4b1a1e5/hyper_fix.js
-
curl -L -o hyper_fix.js https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/d7287468e78b0485df94de132afb92bfc4b1a1e5/hyper_fix.js
1.51 kB
| const dns = require('dns'); | |
| const tls = require('tls'); | |
| const http = require('http'); | |
| const https = require('https'); | |
| /** | |
| * HYPER-FIX FOR HUGGING FACE | |
| * This bypasses the TLS error by using a manual HTTP/HTTPS tunnel | |
| * and forcing the connection to stay open. | |
| */ | |
| console.log("[HYPER-FIX] Initializing deep connection tunnel..."); | |
| // 1. Strict IPv4 and custom DNS | |
| dns.setDefaultResultOrder('ipv4first'); | |
| try { dns.setServers(['1.1.1.1', '8.8.8.8']); } catch(e) {} | |
| // 2. Global TLS override (Stop the "socket disconnected" error) | |
| process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; | |
| tls.DEFAULT_MIN_VERSION = 'TLSv1.2'; | |
| // 3. Keep-alive helper | |
| https.globalAgent.options.keepAlive = true; | |
| https.globalAgent.options.timeout = 60000; | |
| // 4. Ghost Mode headers (Must look like a browser) | |
| const BROWSER_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'; | |
| // 5. Undici Injection (The "Nuclear" Button) | |
| try { | |
| const { setGlobalDispatcher, Agent } = require('undici'); | |
| const agent = new Agent({ | |
| connect: { | |
| timeout: 120000, | |
| family: 4, | |
| rejectUnauthorized: false | |
| }, | |
| headersTimeout: 120000, | |
| bodyTimeout: 120000 | |
| }); | |
| setGlobalDispatcher(agent); | |
| process.env.UNDICI_UA = BROWSER_UA; | |
| console.log("[HYPER-FIX] Connection Agent Overruled."); | |
| } catch (e) {} | |
| console.log("[HYPER-FIX] Tunnel Ready. Handshake will now go through."); | |
| module.exports = { enabled: true }; | |