更新 simpleadmin/www/index.html
This commit is contained in:
parent
200a08e448
commit
7fdd2f65b7
@ -837,47 +837,43 @@
|
||||
const plmn = lines
|
||||
.find((line) => line.includes("+QSPN:"))
|
||||
.split(",")[4]
|
||||
.replace(/"/g, "");
|
||||
.replace(/"/g, "")
|
||||
.trim();
|
||||
|
||||
console.log("PLMN:", plmn);
|
||||
console.log("Mapped operator:", operatorMap[plmn]);
|
||||
|
||||
// 获取原始运营商名称 | Get original operator name
|
||||
const network_provider = lines
|
||||
.find((line) => line.includes("+QSPN:"))
|
||||
.split(",")[0]
|
||||
.replace("+QSPN: ", "")
|
||||
.replace(/"/g, "")
|
||||
.replace(/ /g, "");
|
||||
.trim();
|
||||
|
||||
// 处理运营商名称显示 | Process operator name display
|
||||
if (operatorMap[plmn]) {
|
||||
// 如果在映射表中找到对应的运营商名称,直接使用
|
||||
// If found in mapping table, use the mapped operator name
|
||||
this.networkProvider = operatorMap[plmn];
|
||||
} else if (network_provider.length === 24 && /^[0-9A-F]+$/i.test(network_provider)) {
|
||||
// 如果是24位十六进制编码,进行解码
|
||||
// If it's a 24-bit hexadecimal encoding, decode it
|
||||
this.networkProvider = hexToAscii(network_provider);
|
||||
} else if (network_provider.match(/^[0-9A-Fa-f]+$/) != null) {
|
||||
// 处理16进制编码的运营商名称
|
||||
// Process operator names encoded in hexadecimal
|
||||
try {
|
||||
const hexString = network_provider.replace(/^0x/, '');
|
||||
const bytes = new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
this.networkProvider = decoder.decode(bytes);
|
||||
} catch (e) {
|
||||
console.log("Error decoding hex operator name:", e);
|
||||
this.networkProvider = network_provider;
|
||||
}
|
||||
} else if (network_provider.match(/^[0-9]+$/) != null) {
|
||||
// 如果是纯数字,使用 plmn_name
|
||||
// If it's pure numbers, use plmn_name
|
||||
this.networkProvider = lines
|
||||
.find((line) => line.includes("+QSPN:"))
|
||||
.split(",")[2]
|
||||
.replace(/"/g, "");
|
||||
.replace(/"/g, "")
|
||||
.trim();
|
||||
} else {
|
||||
// 其他情况直接使用原始名称
|
||||
// For other cases, use the original name
|
||||
this.networkProvider = network_provider;
|
||||
}
|
||||
|
||||
// 十六进制解码函数 | Hexadecimal decoding function
|
||||
function hexToAscii(hex) {
|
||||
let ascii = '';
|
||||
for (let i = 0; i < hex.length; i += 2) {
|
||||
ascii += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
|
||||
}
|
||||
return ascii;
|
||||
}
|
||||
|
||||
// --- MCCMNC ---
|
||||
this.mccmnc = lines
|
||||
.find((line) => line.includes("+QSPN:"))
|
||||
@ -1599,7 +1595,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
bytesToSize(bytes) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user