增加兼容低版本内核的页面

This commit is contained in:
eafonyang
2026-06-02 19:55:09 +08:00
parent ccbafdd720
commit 28aa90296f
17 changed files with 1038 additions and 37 deletions
+9
View File
@@ -28,6 +28,15 @@ export function decodeCustomBase64(encoded: string): string {
const index = ALPHABET_CUSTOM.indexOf(char);
translated += index !== -1 ? ALPHABET_STANDARD.charAt(index) : char;
}
// Strip whitespace / newlines that may be present in API responses.
// Chrome 91 atob() is stricter than modern browsers and rejects these.
translated = translated.replace(/\s/g, "");
// Ensure correct Base64 padding (=). Modern atob() tolerates missing padding,
// but Chrome 91 throws "The string to be decoded is not correctly encoded".
const padNeeded = (4 - (translated.length % 4)) % 4;
if (padNeeded > 0) {
translated += "=".repeat(padNeeded);
}
const decoded = atob(translated);
const bytes = new Uint8Array(decoded.length);
for (let i = 0; i < decoded.length; i++) {