Brozy123 commited on
Commit
1fa89f0
·
verified ·
1 Parent(s): e529984

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +5 -14
index.js CHANGED
@@ -12,9 +12,8 @@ const { createProfileAttachment } = require('./profileRenderer');
12
 
13
  // Network hijack can break Discord auth on some environments.
14
  // Keep it opt-in via env when explicitly needed.
15
- const FORCE_NETWORK_HIJACK = process.env.ENABLE_NETWORK_HIJACK === 'true';
16
- let dynamicNetworkHijackEnabled = FORCE_NETWORK_HIJACK;
17
- if (dynamicNetworkHijackEnabled) {
18
  networkFix.applyAdvancedFixes();
19
  } else {
20
  // Safe network tuning for HF/containers without hostname rewriting.
@@ -1366,7 +1365,7 @@ setInterval(async () => {
1366
  if (client.ws.status !== 0) {
1367
  console.log("[!] Gateway issues detected. Status:", client.ws.status);
1368
  console.log("[*] Performing emergency reconnect...");
1369
- if (dynamicNetworkHijackEnabled) {
1370
  networkFix.rotateEndpoint();
1371
  }
1372
 
@@ -1444,16 +1443,8 @@ async function initialize() {
1444
  } catch (err) {
1445
  console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
1446
 
1447
- // Automatic fallback for HF TLS edge issues:
1448
- // after a few failed attempts, enable alternate route mode.
1449
- if (!dynamicNetworkHijackEnabled && retryCount >= 2) {
1450
- dynamicNetworkHijackEnabled = true;
1451
- console.log('[NETWORK] Enabling alternate route mode after repeated TLS/auth failures...');
1452
- networkFix.applyAdvancedFixes();
1453
- }
1454
-
1455
- // Retry login; rotate endpoint only when alternate mode is enabled.
1456
- if (dynamicNetworkHijackEnabled) {
1457
  networkFix.rotateEndpoint();
1458
  }
1459
 
 
12
 
13
  // Network hijack can break Discord auth on some environments.
14
  // Keep it opt-in via env when explicitly needed.
15
+ const ENABLE_NETWORK_HIJACK = process.env.ENABLE_NETWORK_HIJACK === 'true';
16
+ if (ENABLE_NETWORK_HIJACK) {
 
17
  networkFix.applyAdvancedFixes();
18
  } else {
19
  // Safe network tuning for HF/containers without hostname rewriting.
 
1365
  if (client.ws.status !== 0) {
1366
  console.log("[!] Gateway issues detected. Status:", client.ws.status);
1367
  console.log("[*] Performing emergency reconnect...");
1368
+ if (ENABLE_NETWORK_HIJACK) {
1369
  networkFix.rotateEndpoint();
1370
  }
1371
 
 
1443
  } catch (err) {
1444
  console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
1445
 
1446
+ // Retry login; rotate endpoint only when explicitly enabled.
1447
+ if (ENABLE_NETWORK_HIJACK) {
 
 
 
 
 
 
 
 
1448
  networkFix.rotateEndpoint();
1449
  }
1450