fix: waf page

This commit is contained in:
naiba
2024-11-30 21:31:55 +08:00
parent 7463bbe3a6
commit 3dc6da8ea9
9 changed files with 52 additions and 23 deletions

View File

@@ -141,8 +141,18 @@ export function joinIP(p?: ModelIP) {
return '';
}
export function ip16Str(p: number[]) {
const buf = new Uint8Array(p);
function base64toUint8Array(base64str: string) {
const binary = atob(base64str);
const len = binary.length;
const buf = new Uint8Array(len);
for (let i = 0; i < len; i++) {
buf[i] = binary.charCodeAt(i);
}
return buf;
}
export function ip16Str(base64str: string) {
const buf = base64toUint8Array(base64str);
const ip4 = buf.slice(-6);
if (ip4[0] === 255 && ip4[1] === 255) {
return ip4.slice(2).join('.');