From b79e3a0569956ea1a855bdeef2daeff2062bcf6e Mon Sep 17 00:00:00 2001 From: sijie-Z <1683039482@qq.com> Date: Tue, 9 Jun 2026 13:11:58 +0800 Subject: [PATCH] fix: replace toSorted with slice().sort() for macOS 12 compatibility (#7247) * fix: replace toSorted with slice().sort() for macOS 12 compatibility Array.prototype.toSorted() is ES2023 and not supported in WebKit < 16 (bundled with macOS 12 Monterey). Using slice().sort() is functionally identical and works on all platforms. Fixes #7216 * chore: update Changelog --------- Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com> --- Changelog.md | 1 + src/services/api.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index adf6f2430..b47fd7c7b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ - 修复订阅 URL 使用空密码 Basic Auth 时未发送认证信息的问题 - Linux 托盘可能与其他 tauri 程序托盘冲突导致图标异常 - 修复前端连接页面导致的内存泄漏 +- macOS 12(Monterey) 首页 IP 卡兼容性
✨ 新增功能 diff --git a/src/services/api.ts b/src/services/api.ts index 526161ba4..966b7fe76 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -145,7 +145,7 @@ export const getIpInfo = async (): Promise< const maxRetries = 2 const serviceTimeout = 5000 - const shuffledServices = IP_CHECK_SERVICES.toSorted(() => Math.random() - 0.5) + const shuffledServices = IP_CHECK_SERVICES.slice().sort(() => Math.random() - 0.5) let lastError: unknown | null = null const userAgent = await getUserAgentPromise() console.debug('User-Agent for IP detection:', userAgent)