// ==UserScript== // @name 中兴路由器增强 ZTE-Stat_Max // @name:en ZTE-Stat_Max // @namespace ucxn // @version 5.9.8.b // @description 哥哥科技 QQ群 680464365 // @description:en https://github.com/ucxn/ZTE-Stat_Max // @author 哥哥科技 space.bilibili.com/501430041 // @noframes // @icon https://scriptcat.org/api/v2/resource/image/PD6xhxddlUESIwAV // @include http://10.*.*.* // @include http://192.168.*.* // @match http://zte.home* // @include http://172.16.* // @grant none // @license GPL-3.0-or-later // ==/UserScript== (function() { 'use strict'; console.log("🚀 哥哥科技 V5.9.8 终极引擎已装载..."); function escapeHTML(str) { if (!str) return ''; return String(str).replace(/[&<>'"]/g, function(match) { return { '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' }[match]; }); } // ======== [0] 用户极客环境变量配置区 ======== const CONFIG = { routerIP: "192.168.5.1", // 路由器内网 IP injectMode: 1, // 【UI注入模式】 0: 原生侧边栏(1min)| 1: 优先,10秒悬浮舱(D)| 2: 强制模式(30秒后强制霸屏) calcMode: 1, // 1: 上行/下行倍数模式, 0: 上行占总和比例模式 ratioExtremeUp: 10,// 极端上传判定阈值 (> 1000%) ratioWarnUp: 0.07,// 重度上传警告阈值 (> 7%) ratioExtremeDown: 0.01, // 极端下载判定阈值 (< 1%) ratioThreshold: 7, // (仅calcMode=0时有效) 上传占比报警阈值(%) readSaveData: 1,// 【开关切换】 1: 读档模式(继承本次历史量) | 0: 新局模式(从打开网页此刻归零重新计流) portMap: { "eth1": "网口 1", "eth2": "网口 2", "eth3": "网口 3", "eth4": "网口 4", "wl0": "2.4G", "wl1": "5.2G", "wl2": "5.8G" } }; const S={lt:0,wInstUp:0,wInstDn:0,wTotUp:0,wTotDn:0,cls:{}};let isF=!1,pr=new DOMParser(),lCxt=null;const oOp=XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open=function(){this. addEventListener('load',function(){try{if(this.responseType===''|| this.responseType==='text'){let t=this.responseText;if(t&&(t.includes('')||t.includes(''))){ if(t.includes(''))lCxt=t;if(window.startGegePrecisionEngine) window.startGegePrecisionEngine();}}}catch(e){}}); oOp.apply(this,arguments);};function s2b(s){if(!s)return 0;let m=s.match(/([\d.]+)\s*(G|M|K)?bps/i);return m?parseFloat(m[1])*(m[2]?.toUpperCase()==='G'?1e9:m[2]?.toUpperCase()==='M'?1e6:m[2]?.toUpperCase()==='K'?1e3:1):0;}function fB(b){return b>=1e6?(b/1e6).toFixed(3)+' Mbps':b>=1e3?(b/1e3).toFixed(2)+' Kbps':Math.round(b)+' bps';}function fBy(b){return(b/=8)>=1048576?(b/1048576).toFixed(3)+' MiB/s':b>=1024?(b/1024).toFixed(2)+' KiB/s':Math.round(b)+' B/s';}function fV(b){return(b/=8)>=1073741824?(b/1073741824).toFixed(3)+' GiB':b>=1048576?(b/1048576).toFixed(2)+' MiB':b>=1024?(b/1024).toFixed(1)+' KiB':Math.round(b)+' B';}function fVD(i,o){let b=i/8,x=o/8;return b>=1073741824?(b/1073741824).toFixed(3)+' | '+(x/1073741824).toFixed(4)+' GiB':b>=1048576?(b/1048576).toFixed(2)+' | '+(x/1048576).toFixed(3)+' MiB':b>=1024?(b/1024).toFixed(2)+' | '+(x/1024).toFixed(1)+' KiB':Math.round(b)+' | '+Math.round(x)+' B'}function fSV(b){return(b/=8)>=1073741824?(b/1073741824).toFixed(3)+'G':b>=1048576?(b/1048576).toFixed(2)+'M':b>=1024?(b/1024).toFixed(1)+'K':Math.round(b)+'B';}function fOT(s){if(s<=0)return"";let d=Math.floor(s/86400),h=Math.floor((s%86400)/3600),m=Math.floor((s%3600)/60),sec=Math.floor(s%60);return d>0?`${d}天${h}小时${m}分${sec}秒`:`${h}小时${m}分${sec}秒`;}function nM(m){return m?m.toLowerCase().replace(/-/g,':').replace(/\s/g,''):'';}function pI(n){let o=Object.create(null),c=n.children;for(let i=0;i'))return;wX=pr.parseFromString( wT,"text/xml");}let cX=lCxt?pr.parseFromString(lCxt,"text/xml"):null;const bIN=wX.querySelector( "OBJ_HOME_BASICINFO_ID Instance"),wI=bIN?pI(bIN):{},cWU=s2b(wI.WANUpRate),cWD=s2b( wI.WANDownRate),cI=Object.create(null);let cSU=0,cSD=0;(cX?.querySelectorAll("OBJ_CLIENTS_ID Instance")||[]).forEach(nd=>{let d=pI( nd);if(d.MACAddress){let m=nM(d.MACAddress),u=s2b(d.UpRate),dn=s2b(d.DownRate),uT=( parseFloat(d.UpThroughput)||0)*8000,dT=(parseFloat(d.DownThroughput)||0)*8000;cI[m]={upRate:u,dnRate:dn,iface: d.Interface||"",offUp:uT,offDn:dT,onSec:parseInt(d.OnlineDuration||d.OnlineTime||d.LeaseTime||0)};cSU+=u;cSD+=dn;}});let ol=document.getElementById('gege-global-overlay'),cM=Object.keys( cI),iD=window.gegeForceUIRedraw||(cM.length!==window.gegeRenderedMacs.size);if(!iD&&cM.length>0){for(let i=0;i< cM.length;i++){if(!window.gegeRenderedMacs.has(cM[i])){iD=!0;break;}}}let iDW=ol&&ol.style.display==='block'&&!ol.querySelector( '.gege-list-item');if(ol&&ol.style.display==='block'&&(iD||iDW)){bVD(ol,cX);window.gegeRenderedMacs=new Set( cM);window.gegeForceUIRedraw=!1;}let gDt=(S.lt!==0)?(n-S.lt)/1000:0;if(S.wLT===undefined){S.wLT=n;}else if(cWU!==S.wInstUp||cWD!==S.wInstDn){let wDt=n-S.wLT;if(S.wInstUp>0)S.wTotUp+=(S.wInstUp+cWU)*wDt/2000;if(S.wInstDn>0)S.wTotDn+=(S.wInstDn+cWD)*wDt/2000;S.wLT=n;}for(let m in cI){let cC=cI[m];if(!S.cls[m]){S.cls[m]={upR:cC.upRate,dnR:cC.dnRate,lUT:n,intUp:0,intDn:0,uB:CONFIG.readSaveData===1?0:cC.offUp,dB:CONFIG.readSaveData===1?0:cC.offDn,lU:cC.offUp,lD:cC.offDn,aR:!1,dpU:0,dpD:0,oU:CONFIG.readSaveData===1?cC.offUp:0,oD:CONFIG.readSaveData===1?cC.offDn:0};}let cS=S.cls[m],dU=cC.offUp-cS.lU,dD=cC.offDn-cS.lD;if(dU<0||dD<0){if(dU<0){cS.uB+=dU;cS.dpU=cS.lU;}if(dD<0){cS.dB+=dD;cS.dpD=cS.lD;}cS.aR=!0;}else if(cS.aR){if(dD>2516582400||dU>671088640||(cS.dpD&&dD>=cS.dpD)||(cS.dpU&&dU>=cS.dpU)){cS.uB+=dU;cS.dB+=dD;cS.aR=!1;cS.dpU=0;cS.dpD=0;}}if(cS.lOS!==cC.onSec){cS.onS=cC.onSec;cS.lOS=cC.onSec;}else{cS.onS=(cS.onS||cC.onSec||0)+gDt;}if(cC.upRate!==cS.upR||cC.dnRate!==cS.dnR){let ms=n-cS.lUT;if(cS.upR>0)cS.intUp+=(cS.upR+cC.upRate)*ms/2000;if(cS.dnR>0)cS.intDn+=(cS.dnR+cC.dnRate)*ms/2000;cS.upR=cC.upRate;cS.dnR=cC.dnRate;cS.lUT=n;}cS.lU=cC.offUp;cS.lD=cC.offDn;}S.lt=n;S.wInstUp=cWU;S.wInstDn=cWD;rUI(cWU,cWD,cSU,cSD,cI);}catch(e){}finally{isF=!1;}}function rUI(wU,wD,sU,sD,cI){let tOU= 0,tOD=0;let bd=document.getElementById('zte-geek-board');if(!bd){bd=document.createElement('div');bd.id='zte-geek-board';bd.innerHTML=`
WAN口速率
|
局域网代数和
实时占比: |
LAN:
WAN: |
高精流量统计 ->
当前总计: |
`;}let ol=document.getElementById('gege-global-overlay'),iPO=ol&&ol.style.display==='block',aC=iPO?ol:document;if(iPO){let ac=document.getElementById('gege-board-anchor');if(ac&&bd.parentNode!==ac)ac.appendChild(bd);}else{let mn=document.querySelector('.el-table')||document.querySelector('.config-item')?.closest('div')||document.querySelector('.main-content');if(mn&&bd.parentNode!==mn.parentNode)mn.parentNode.insertBefore(bd,mn);}if(bd.parentNode){let LUp=0,LDn=0,hpU=0,hpD=0,abU=0,abD=0;for(let k in S.cls){let s=S.cls[k]||{};LUp+=s.intUp;LDn+=s.intDn;hpU+=Math.max(0,(s.lU)-(s.uB)-(s.oU));hpD+=Math.max(0,(s.lD)-(s.dB)-(s.oD));}for(let m in cI){let c=cI[m]||{};abU+=c.offUp||0;abD+=c.offDn||0;tOU+=c.offUp||0;tOD+=c.offDn||0;}bd.querySelector('#gb-wan-up-bps').textContent=`🔼 ${fB(wU)}`;bd.querySelector('#gb-wan-down-bps').textContent=`🔽 ${fB(wD)}`;bd.querySelector('#gb-wan-up-bytes').textContent=`🔼 ${fBy(wU)}`;bd.querySelector('#gb-wan-down-bytes').textContent=`🔽 ${fBy(wD)}`;bd.querySelector('#gb-lan-up-bps').textContent=`🔼 ${fB(sU)}`;bd.querySelector('#gb-lan-down-bps').textContent=`🔽 ${fB(sD)}`;bd.querySelector('#gb-perc-up').textContent=`🔼 ${wU>0?((sU/wU)*100).toFixed(1):0.0}%`;bd.querySelector('#gb-perc-down').textContent=`🔽 ${wD>0?((sD/wD)*100).toFixed(1):0.0}%`;bd.querySelector('#gb-lan-up-vol').textContent=`🔼 ${fV(LUp)}`;bd.querySelector('#gb-lan-down-vol').textContent=`🔽 ${fV(LDn)}`;bd.querySelector('#gb-wan-up-vol').textContent=`🔼 ${fV(S.wTotUp)}`;bd.querySelector('#gb-wan-down-vol').textContent=`🔽 ${fV(S.wTotDn)}`;bd.querySelector('#gb-int-up-vol').textContent=`🔼 ${fV(hpU)}`;bd.querySelector('#gb-int-down-vol').textContent=`🔽 ${fV(hpD)}`;bd.querySelector('#gb-abs-up-vol').textContent=`🔼 ${fV(abU)}`;bd.querySelector('#gb-abs-down-vol').textContent=`🔽 ${fV(abD)}`;}let oDC={};if(! iPO){let aI=aC.querySelectorAll('.config-item');for(let n of aI){let mM=n.textContent.match(/([a-fA-F0-9]{2}[:\-]){5}[a-fA-F0-9]{2}/);if(mM){oDC[mM[0].toLowerCase().replace(/-/g,':')]=n;}}}for(let m in cI){let it=null;if(iPO){it=aC.querySelector(`.gege-list-item[data-gege-mac="${m}"]`);}else{it=oDC[m];}if(!it)continue;const cC=cI[m]||{upRate:0,dnRate:0,iface:"",offUp:0,offDn:0},cS= S.cls[m]||{intUp:0,intDn:0,onS:0};let tN=it.querySelector('.gege-online-time');if(tN&&cS.onS>0)tN.textContent=`在线:${fOT(cS.onS)}`;const dI=it.querySelector('.dev-intro');if(dI){let bx=dI.querySelector( '.gege-up-box');if(!bx){bx=document.createElement('div');bx.className='gege-up-box';bx.innerHTML=`
`;dI. appendChild(bx);}let p=tOU>0?((cC.offUp||0)/tOU*100).toFixed(1):0.0;bx.querySelector('.v-vol').textContent= fVD(cS.intUp,cC.offUp);bx.querySelector('.v-pct').textContent=p+'%';bx.querySelector( '.zte-thin-bar-inner').style.width=Math.min(p,100)+'%';}const inf=it.querySelector('.info');if( inf){Array.from(inf.querySelectorAll('.dev-ip:not(.gege-box *)')).slice(1).forEach(n=>{n.style.display='none';});inf.querySelectorAll( '.dev-number:not(.gege-box *)').forEach(n=>{n.style.display='none';});let rB=inf.querySelector('.gege-ratio-box');if( !rB){rB=document.createElement('div');rB.className='gege-ratio-box';rB.innerHTML=`
`;inf. appendChild(rB);}let hqU=Math.max(0,cC.offUp-(cS.uB||0)),hqD=Math.max(0,cC.offDn-(cS.dB||0)),bR=(hqU+hqD)>0?(hqU/(hqU+hqD)*100):0,tC="",tCol="#0059fa";if( CONFIG.calcMode===1){let rt=hqD>0?(hqU/hqD):(hqU>0?Infinity:0);if(rt>CONFIG.ratioExtremeUp){tCol='#ff4c00';tC=(rt===Infinity?'∞':rt.toFixed(2))+'⚠️';}else if( rt>CONFIG.ratioWarnUp){tCol='#ff4c00';tC=(rt*100).toFixed(1)+'%';}else if(rt>=CONFIG.ratioExtremeDown){tCol='#0059fa';tC=(rt*100).toFixed(1)+'%';}else{tCol='#0059fa';let rRt=hqU>0?(hqD/hqU):(hqD>0?Infinity:0);tC=( rRt===Infinity?'∞':rRt.toFixed(1))+'x';}}else{tCol=bR>CONFIG.ratioThreshold?'#ff4c00':'#0059fa';tC=bR.toFixed(1)+'%';}rB.querySelector( '.v-port').textContent=CONFIG.portMap[cC.iface]||cC.iface||"未知";rB.querySelector('.v-interval .c-up').textContent=''+fSV(hqU);rB.querySelector('.v-interval .c-down').textContent=''+ fSV(hqD);let rtP=rB.querySelector('.v-rt-pct');rtP.textContent=tC;rtP.style.color=tCol;rB.querySelector( '.gege-ratio-bar-inner').style.width=Math.min(bR,100)+'%';let dBx=inf.querySelector('.gege-down-box');if(!dBx){dBx=document.createElement('div');dBx.className='gege-down-box';dBx.innerHTML=`
`;inf. appendChild(dBx);}let dp=tOD>0?((cC.offDn||0)/tOD*100).toFixed(1):0.0;dBx.querySelector('.v-vol').textContent=fVD(cS.intDn,cC.offDn);dBx.querySelector('.v-pct').textContent=dp+'%';dBx.querySelector( '.zte-thin-bar-inner').style.width=Math.min(dp,100)+'%';}const sp=it.querySelector('.speed');if(sp){sp.querySelectorAll( '.connect-up, .connect-down').forEach(n=>{n.style.display='none';});let enh=sp.querySelector('.zte-enhance-speed');if(!enh){enh=document.createElement( 'div');enh.className='zte-enhance-speed';enh.innerHTML=`
`;sp. appendChild(enh);}let pu=sU>0?(cC.upRate/sU*100):0,pd=sD>0?(cC.dnRate/sD*100):0,bU=enh.querySelector( '.zte-bar-up'),bD=enh.querySelector('.zte-bar-down');bU.style.setProperty('--p-up',Math.min(pu,100)+'%');bU.querySelector( '.v-val').textContent=`🔼 ${fBy(cC.upRate)}`;bU.querySelector('.v-pct').textContent=(wU>0?pu.toFixed(1):0.0)+'%';bD.style.setProperty( '--p-down',Math.min(pd,100)+'%');bD.querySelector('.v-val').textContent=`🔽 ${fBy(cC.dnRate)}`;bD.querySelector('.v-pct').textContent=(wD>0?pd.toFixed(1):0.0)+'%';}}}async function bVD(ol,cX){try{let mB=(window.gegeHiddenDevices&& Object.keys(window.gegeHiddenDevices).length>0)?'(哥哥科技:智能Mesh适配)':'',h2='',h52='',h58='',hW='';( cX?.querySelectorAll("OBJ_CLIENTS_ID Instance")||[]).forEach(i=>{let d=pI(i);if(!d.MACAddress)return;let m= nM(d.MACAddress),ip=escapeHTML(d.IPAddress||''),nm=escapeHTML( d.AliasName||d.HostName||'未知设备'),ifc=d.Interface||'',oS=parseInt(d.OnlineDuration||d.OnlineTime||d.LeaseTime||0),tS=fOT(oS),tH=`
${tS?'在线:'+tS:''}
`,htm=`
${nm}
${tH}
${ip}
MAC:${m}
`;if(['wl0','wlan0','wlan1','wl1'].includes(ifc))h2+= htm;else if(['wlan5','wl4','wlan4','wl3','wlan3'].includes(ifc))h52+= htm;else if(ifc==='wl2'||ifc==='wlan2'||ifc==='wl5'||(/w/i.test(ifc)&&!/wan/i.test(ifc)))h58+= htm;else hW+=htm;});ol.innerHTML=`
无线设备(2.4GHz)
${h2||'
没有连接设备
'}
无线设备(5.2GHz)
${h52||'
没有连接设备
'}
无线设备(5.8GHz)
${h58||'
没有连接设备
'}
有线设备${mB}
${hW||'
没有连接设备
'}
`;}catch( e){ol.innerHTML=`
数据渲染失败: ${escapeHTML(e.message)}
`;}}window.createGegeFloatingBtn=function(){if(document.getElementById('gege-floating-btn'))return;let b= document.createElement('div');b.id='gege-floating-btn';b.innerHTML='🛸';b.style.cssText=`position: fixed; `+ `top: 20px; right: 20px; width: 50px; height: 50px; background: `+ `linear-gradient(135deg, #0059fa, #00c6ff); color: white; border-radius: 50%; display: flex; `+ `align-items: center; justify-content: center; font-size: 48px; box-shadow: 0 4px 15px rgba(0,89,250,0.5); `+ `cursor: pointer; z-index: 99999; transition: all 0.3s ease; user-select: none;`;b. onmouseover=()=>{b.style.transform='scale(1.1) rotate(15deg)';};b.onmouseout=()=>{b.style.transform= 'scale(1) rotate(0deg)';};b.onclick=()=>window.gegeTogglePanel();document.body.appendChild(b);};window.gegeTogglePanel=function(fS=null){let o=document.getElementById('gege-global-overlay'),iCO= o&&o.style.display==='block',tS=fS!==null?fS:!iCO,aT=document.querySelector( '#gege-menu-wrapper a'),lT=document.querySelector('#gege-menu-wrapper li');if(!tS){if(lT){lT.classList.remove( 'is-active');lT.style.color='rgb(255, 255, 255)';}if(o)o.style.display='none';return;}if(aT&& lT){aT.classList.add('router-link-exact-active','router-link-active');lT.classList.add('is-active');lT.style.color= 'rgb(61, 163, 247)';}if(!o){o=document.createElement('div');o.id='gege-global-overlay';let pT=document.querySelector( '.page-top');if(pT){pT.parentNode.style.position='relative';o.style.cssText=`position: `+ `absolute; top: 0; left: 0; width: 100%; min-height: 100%; height: 100%; background: #f3f4f5; `+ `z-index: 9999; overflow-y: auto; padding-bottom: 50px;`;pT.parentNode.appendChild(o);}else{o.style.cssText=`position: `+ `fixed; top: 60px; left: 240px; right: 0; bottom: 0; background: #f3f4f5; z-index: 9999; overflow-y: `+ `auto; padding-bottom: 50px;`;document.body.appendChild(o);}}o.style.display='block';if(!window. gegeBActivated){window.gegeBActivated=!0;clearTimeout(window.gegeMasterTimer);window.gegeMasterTimer=setInterval( eBET,1000);}bVD(o,lCxt?pr.parseFromString(lCxt,"text/xml"):null).then(()=>{if(window.gegeBActivated)eBET();else rSD();});};function iGM(){let mC=document.querySelector('.menu_items');if(!mC)return;let oD=mC.querySelector( 'div');if(!oD)return;let gW=oD.cloneNode(!0);gW.id='gege-menu-wrapper';let aT=gW.querySelector( 'a'),lT=gW.querySelector('li');if(aT){aT.href="javascript:void(0);";aT.classList.remove( 'router-link-exact-active','router-link-active');}if(lT){lT.classList.remove('is-active');let tS= lT.querySelector('span');if(tS){const pT=(t,s)=>{let l=s.length,o=(l===6)?(l+9):15;return decodeURIComponent( escape(window.atob(t.substring(o).split('').reverse().join(''))));};const aM={'ZTE_LEGACY_WIRED':"ZTE_AUTH_TOKEN_/xK9vP2mQ5zL8wJ4nB7cT1fR",'ZTE_NEBULA_MAX':"ZTE_AUTH_TOKEN_/2p5i2Z6Aqo5Re65lOZ5lOZ5",'ZTE_GENERIC_OS':"ZTE_AUTH_TOKEN_/pM4aC7yX9kH3bV2rN6dW8qG"};const gHP=()=>{let m= Object.keys(aM).length,hI=(m<<2)-10;return Object.keys(aM)[hI^3];};tS.textContent=pT(aM[gHP()],tS.textContent);}lT.querySelectorAll( 'img').forEach(i=>i.remove());let eS=document.createElement('span');eS.textContent='🚀';eS.style.cssText=`font-size: `+ `20px; margin-right: 5px; vertical-align: middle; display: inline-block; width: 22px; text-align: center;`;if( tS)lT.insertBefore(eS,tS);lT.style.color='rgb(255, 255, 255)';}mC.appendChild(gW);document. addEventListener('click',function(e){let cW=e.target.closest('.menu_items > div');if(!cW)return;if( cW.id==='gege-menu-wrapper'){e.preventDefault();e.stopPropagation();let fB=document.getElementById( 'gege-floating-btn');if(fB)fB.remove();window.gegeTogglePanel(!0);}else{window. gegeTogglePanel(!1);}},!0);}window.gegeBActivated=!1;window.gegeEngineRunning=!1;window.gegeLastDevCount=-1;window.gegeLastMeshDevCount=-1;window.gegeHiddenDevices={};window.gegeTimerStarted=!1;window.gegeSyncAnchor=0;window.gegeTickCount=0;window.gegeMasterTimer=null;window.startGegePrecisionEngine=function(){if(window.gegeTimerStarted||window.gegeBActivated)return;window.gegeTimerStarted=!0;window.gegeSyncAnchor=performance.now();window.gegeTickCount=0;window.scheduleNextGegeTick();};window.scheduleNextGegeTick=function(){if(window.gegeBActivated)return;window.gegeTickCount++;let dl=(window.gegeSyncAnchor+window.gegeTickCount*3000)-performance.now();if(dl<0){window.gegeSyncAnchor=performance.now();window.gegeTickCount=0;dl=3000;}window.gegeMasterTimer=setTimeout(()=>{rSD().finally(()=>{window.scheduleNextGegeTick();});},dl);};async function eBET(){if(window.gegeEngineRunning)return;window. gegeEngineRunning=!0;try{const ts=Date.now(),wR=await fetch(`/?_type=vueData&_tag=vue_home_device_data_no_update_sess&IF_OP=refresh&_=${ts}`);if( !wR.ok)throw new Error();const wT=await wR.text(),wST=performance.now();if(!wT.includes(''))throw new Error();const wX= pr.parseFromString(wT,"text/xml");let bIN=wX.querySelector("OBJ_HOME_BASICINFO_ID Instance"),wI=bIN?pI(bIN):{},cDC=parseInt( wI.AccessDevNum);cDC=isNaN(cDC)?-1:cDC;const lR=await fetch(`/?_type=vueData&_tag=vue_client_data&_=${ts}`);let lT=await lR.text(),lF="";if( lT.includes('')){let mL=[];pr.parseFromString(lT,"text/xml").querySelectorAll("OBJ_CLIENTS_ID Instance").forEach(ins=>{let d= pI(ins);if(d.MACAddress)mL.push(d.MACAddress);});lF=mL.sort().join('|');}if(cDC!==window.gegeLastDevCount||lF!==window.gegeLastLanFingerprint){const tR=await fetch( `/?_type=vueData&_tag=vue_topo_data&_=${ts}`);if(!tR.ok)throw new Error();let tJ=JSON.parse(await tR.text()),mDC=tJ.agentlay1?.reduce((s,a)=>s+( parseInt(a.accdevCount)||0),0)||0;if(mDC!==window.gegeLastMeshDevCount){window.gegeLastMeshDevCount=mDC;window. gegeForceUIRedraw=!0;if(mDC>0){const liR=await fetch(`/?_type=vueData&_tag=localnet_lan_info_lua&_=${ts}`),liX=pr.parseFromString(await liR.text(),"text/xml");let nHD={};liX.querySelectorAll( "OBJ_LAN_INFO_ID Instance").forEach(inst=>{let d=pI(inst);if(d.DevMeshType==='3'&&d.Active==='1'&&d.MACAddress){let m=nM( d.MACAddress),bN=d.DevName||d.HostName||d.DisplayedPictureName||d.AliasName||"Mesh设备",bI=d.Interface||"";if(d.IFAliasName==='SSID1')bI='wl0';else if( d.IFAliasName==='SSID5')bI='wl4';nHD[m]={name:bN,iface:bI,origMac:d.MACAddress};}});window. gegeHiddenDevices=nHD;}else{window.gegeLastMeshDevCount=0;window.gegeHiddenDevices={};}}window.gegeLastDevCount=cDC;window.gegeLastLanFingerprint=lF;}let hM=Object.keys( window.gegeHiddenDevices??{});if(hM.length>0){let iI="";for(let m of hM){try{const mt=window.gegeHiddenDevices[m]||{};if(!mt||!mt.origMac)continue;const sR=await fetch( `/?_type=vueData&_tag=localnet_lan_detailinfo_lua&MACAddress=${encodeURIComponent(mt.origMac||m)}&_=${Date.now()}`);if(!sR.ok)continue;const sI=pr.parseFromString(await sR.text(), "text/xml").querySelector("OBJ_LANINFO_BYMAC Instance");if(sI){let sD=pI(sI),uR=`${sD.UploadSpeed||0}Kbps`,dR=`${sD.DownloadSpeed||0}Kbps`,uT=(( parseFloat(sD.BytesSend)||0)/1000).toFixed(4),dT=((parseFloat(sD.BytesReceived)||0)/1000).toFixed(4),oS=parseInt(sD.OnlineTimes||0);iI+=`MACAddress${escapeHTML(m)}IPAddress${sD.IPAddress||""}AliasName${escapeHTML(mt.name)}HostName${escapeHTML(mt.name)}Interface${escapeHTML(mt.iface)}UpRate${uR}DownRate${dR}UpThroughput${uT}DownThroughput${dT}OnlineDuration${oS}`;}}catch( e){}}if(iI!=="")lT=lT.replace('',`${iI}
`);}if(lT.includes( ''))lCxt=lT;await rSD(wT,wST);}catch(e){}finally{window.gegeEngineRunning=!1;}}const tKA=()=>{let i=document.createElement('iframe');i.id='gege-keepalive-iframe';i.style.display='none';const p=["/#/sys","/#/app","/#/wlan/"];i.src=`${window.location.origin}${p[Math.floor(Math.random()*p.length)]}`;let z=document.getElementById('gege-keepalive-iframe');if(z)z.remove();document.body.appendChild(i);setTimeout(()=>{if(i.parentNode){i.src='about:blank';i.remove();}},12000);};setTimeout(tKA,2000);setInterval(tKA,720000);window.addEventListener('load',()=>{setTimeout(()=>{if(!window.gegeTimerStarted&&window.startGegePrecisionEngine)window.startGegePrecisionEngine();},60000);if(CONFIG.injectMode===1||CONFIG.injectMode===2){if(window.createGegeFloatingBtn)window.createGegeFloatingBtn();}if(CONFIG.injectMode===2){setTimeout(()=>{if(window.gegeTogglePanel)window.gegeTogglePanel(!0);},30000);}if(CONFIG.injectMode===0||CONFIG.injectMode===1){let dC=0;const mO=setInterval(()=>{let mC=document.querySelector('.menu_items div');if(mC){clearInterval(mO);iGM();}else if(++dC>200){clearInterval(mO);}},300);}});})();