seawolf2357 commited on
Commit
1b3b2af
·
verified ·
1 Parent(s): c02d304

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +12 -0
index.html CHANGED
@@ -1253,6 +1253,17 @@ function requireLogin(action){
1253
  }
1254
 
1255
  let _indicesInterval = null;
 
 
 
 
 
 
 
 
 
 
 
1256
  function initApp(){initVideoPlayer();loadLiveNews();loadIndices();if(_indicesInterval)clearInterval(_indicesInterval);_indicesInterval=setInterval(loadIndices,120000);connectSSE();}
1257
 
1258
  async function loadProfile(){if(!U)return;try{const r=await(await fetch(`/api/user/profile?email=${U.email}`)).json();if(r.gpu_dollars!==undefined)document.getElementById('hGpu').textContent=`⚡ ${r.gpu_dollars.toLocaleString()} GPU`;}catch(e){}}
@@ -1284,6 +1295,7 @@ async function refreshCurrentTab(){
1284
  else if(t==='news'){await loadMarketPulse();await loadNewsFeed();}
1285
  else if(t==='analysis')await loadResearchDesk();
1286
  else if(t==='sec')await loadSECDashboard();
 
1287
  else if(t==='livechat')await _loadChatFull();
1288
  else await loadPosts(t);
1289
  }catch(e){}
 
1253
  }
1254
 
1255
  let _indicesInterval = null;
1256
+ /* ── Global fetch timeout (prevents infinite loading on all tabs) ── */
1257
+ const _origFetch = window.fetch;
1258
+ window.fetch = function(url, opts = {}) {
1259
+ if (opts.signal) return _origFetch(url, opts); // already has signal, don't override
1260
+ const controller = new AbortController();
1261
+ const timeout = setTimeout(() => controller.abort(), 15000); // 15s global timeout
1262
+ return _origFetch(url, { ...opts, signal: controller.signal })
1263
+ .then(r => { clearTimeout(timeout); return r; })
1264
+ .catch(e => { clearTimeout(timeout); throw e; });
1265
+ };
1266
+
1267
  function initApp(){initVideoPlayer();loadLiveNews();loadIndices();if(_indicesInterval)clearInterval(_indicesInterval);_indicesInterval=setInterval(loadIndices,120000);connectSSE();}
1268
 
1269
  async function loadProfile(){if(!U)return;try{const r=await(await fetch(`/api/user/profile?email=${U.email}`)).json();if(r.gpu_dollars!==undefined)document.getElementById('hGpu').textContent=`⚡ ${r.gpu_dollars.toLocaleString()} GPU`;}catch(e){}}
 
1295
  else if(t==='news'){await loadMarketPulse();await loadNewsFeed();}
1296
  else if(t==='analysis')await loadResearchDesk();
1297
  else if(t==='sec')await loadSECDashboard();
1298
+ else if(t==='republic')await loadRepublic();
1299
  else if(t==='livechat')await _loadChatFull();
1300
  else await loadPosts(t);
1301
  }catch(e){}