兼容低内核版本的浏览器

This commit is contained in:
eafonyang
2026-06-03 15:42:58 +08:00
parent e17c096f0b
commit 56da3e0d1f
29 changed files with 1246 additions and 82 deletions
+5 -5
View File
@@ -1,8 +1,8 @@
/** Centered phone-style shell width (desktop / ultrawide). */
export const APP_SHELL_MAX_PX = 1180;
/** Inner column inside horizontal gutters — use with a flex/grid centering parent. */
export const appShellColumnClass =
"w-full min-w-0 max-w-[min(1180px,100%)]";
export const appShellGutterClass = "px-4 sm:px-6";
/** Responsive rules live in `.x9-app-shell-*` (index.css + index.legacy.css). */
export const appShellOuterClass = "x9-app-shell-outer";
export const appShellColumnClass = "x9-app-shell-column";
export const bottomNavOuterClass = "x9-bottom-nav-outer";
export const bottomNavInnerClass = "x9-bottom-nav-inner";
+24
View File
@@ -0,0 +1,24 @@
/**
* Minimal shims for Chrome 91 WebView (and similar legacy Chromium).
* Import once from main.legacy.tsx before the app mounts.
*/
if (typeof Object.hasOwn !== "function") {
Object.hasOwn = (obj, prop) =>
Object.prototype.hasOwnProperty.call(obj, prop);
}
if (!Array.prototype.at) {
// eslint-disable-next-line no-extend-native
Array.prototype.at = function at(index) {
const len = this.length;
const k = index >= 0 ? index : len + index;
if (k < 0 || k >= len) return undefined;
return this[k];
};
}
if (typeof globalThis.structuredClone !== "function") {
globalThis.structuredClone = <T>(value: T): T =>
JSON.parse(JSON.stringify(value)) as T;
}
+7 -1
View File
@@ -28,6 +28,12 @@ export function decodeCustomBase64(encoded: string): string {
const index = ALPHABET_CUSTOM.indexOf(char);
translated += index !== -1 ? ALPHABET_STANDARD.charAt(index) : char;
}
// Chrome 91 atob() is stricter than modern browsers.
translated = translated.replace(/\s/g, "");
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++) {
@@ -168,7 +174,7 @@ export interface PeqApplyPayload {
// ============================================================
// Input/Output Labels
// ============================================================
export const INPUT_LABELS = ["USB", "USB-C", "Coaxial", "Optical", "Bluetooth", "IIS", "RCA"];
export const INPUT_LABELS = ["USB", "USB-C", "Coaxial", "Optical", "Bluetooth", "HDMI-EARC", "RCA"];
export const OUTPUT_LABELS = ["XLR", "RCA", "Headset", "XLR/RCA"];
/** Device `input` index for Bluetooth source. */