MCPcopy Index your code
hub / github.com/Moli-X/Resources / SubFlow

Function SubFlow

Script/Parser.js:417–439  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415
416//响应头流量处理部分
417function SubFlow() {
418 if (Pinfo == 1 && subinfo) {
419 var sinfo = subinfo.replace(/ /g, "").toLowerCase();
420 var total = "总流量: " + (parseFloat(sinfo.split("total=")[1].split(",")[0]) / (1024 ** 3)).toFixed(2) + "GB";
421 var usd = "已用流量: " + ((parseFloat(sinfo.indexOf("upload")!=-1?sinfo.split("upload=")[1].split(",")[0]:"0") + parseFloat(sinfo.split("download=")[1].split(",")[0])) / (1024 ** 3)).toFixed(2) + "GB"
422 var left = "剩余流量: " + ((parseFloat(sinfo.split("total=")[1].split(",")[0]) / (1024 ** 3)) - ((parseFloat(sinfo.indexOf("upload")!=-1?sinfo.split("upload=")[1].split(",")[0]:"0") + parseFloat(sinfo.split("download=")[1].split(",")[0])) / (1024 ** 3))).toFixed(2) + "GB"
423 if (sinfo.indexOf("expire=") != -1) {
424 var epr = new Date(parseFloat(sinfo.split("expire=")[1].split(",")[0]) * 1000);
425 var year = epr.getFullYear(); // 获取完整的年份(4位,1970)
426 var mth = epr.getMonth() + 1 < 10 ? '0' + (epr.getMonth() + 1) : (epr.getMonth() + 1); // 获取月份(0-11,0代表1月,用的时候记得加上1)
427 var day = epr.getDate() < 10 ? "0" + (epr.getDate()) : epr.getDate();
428 epr = "过期时间: " + year + "-" + mth + "-" + day
429 } else {
430 epr = ""; //"过期时间: ✈️ 未提供該信息" //没过期时间的显示订阅链接
431 }
432 var message = total + "\n" + usd + ", " + left;
433 ntf_flow = 1;
434 $notify("流量信息: ⟦" + subtag + "⟧", epr, message, subinfo_link)
435 }
436// } else if (Pinfo ==1){
437// $notify("流量信息: ⟦" + subtag + "⟧", "", "⚠️ 该订阅链接未返回任何流量信息", subinfo_link)
438// }
439}
440
441//flowcheck-fake-server
442function flowcheck(cnt) {

Callers 1

Parser.jsFile · 0.85

Calls 2

$notifyFunction · 0.70
indexOfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…