更新 simpleadmin/www/index.html
This commit is contained in:
parent
200a08e448
commit
7fdd2f65b7
@ -837,47 +837,43 @@
|
|||||||
const plmn = lines
|
const plmn = lines
|
||||||
.find((line) => line.includes("+QSPN:"))
|
.find((line) => line.includes("+QSPN:"))
|
||||||
.split(",")[4]
|
.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
|
const network_provider = lines
|
||||||
.find((line) => line.includes("+QSPN:"))
|
.find((line) => line.includes("+QSPN:"))
|
||||||
.split(",")[0]
|
.split(",")[0]
|
||||||
.replace("+QSPN: ", "")
|
.replace("+QSPN: ", "")
|
||||||
.replace(/"/g, "")
|
.replace(/"/g, "")
|
||||||
.replace(/ /g, "");
|
.trim();
|
||||||
|
|
||||||
// 处理运营商名称显示 | Process operator name display
|
|
||||||
if (operatorMap[plmn]) {
|
if (operatorMap[plmn]) {
|
||||||
// 如果在映射表中找到对应的运营商名称,直接使用
|
|
||||||
// If found in mapping table, use the mapped operator name
|
|
||||||
this.networkProvider = operatorMap[plmn];
|
this.networkProvider = operatorMap[plmn];
|
||||||
} else if (network_provider.length === 24 && /^[0-9A-F]+$/i.test(network_provider)) {
|
} else if (network_provider.match(/^[0-9A-Fa-f]+$/) != null) {
|
||||||
// 如果是24位十六进制编码,进行解码
|
// 处理16进制编码的运营商名称
|
||||||
// If it's a 24-bit hexadecimal encoding, decode it
|
// Process operator names encoded in hexadecimal
|
||||||
this.networkProvider = hexToAscii(network_provider);
|
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) {
|
} else if (network_provider.match(/^[0-9]+$/) != null) {
|
||||||
// 如果是纯数字,使用 plmn_name
|
|
||||||
// If it's pure numbers, use plmn_name
|
|
||||||
this.networkProvider = lines
|
this.networkProvider = lines
|
||||||
.find((line) => line.includes("+QSPN:"))
|
.find((line) => line.includes("+QSPN:"))
|
||||||
.split(",")[2]
|
.split(",")[2]
|
||||||
.replace(/"/g, "");
|
.replace(/"/g, "")
|
||||||
|
.trim();
|
||||||
} else {
|
} else {
|
||||||
// 其他情况直接使用原始名称
|
|
||||||
// For other cases, use the original name
|
|
||||||
this.networkProvider = network_provider;
|
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 ---
|
// --- MCCMNC ---
|
||||||
this.mccmnc = lines
|
this.mccmnc = lines
|
||||||
.find((line) => line.includes("+QSPN:"))
|
.find((line) => line.includes("+QSPN:"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user