From 6fdd0e2d0fb4d92ca1b0996e3ddf83b58a65e107 Mon Sep 17 00:00:00 2001 From: zimplexing Date: Wed, 13 Aug 2025 20:10:16 +0800 Subject: [PATCH] feat(update): implement platform-specific download URL generation for APKs --- constants/UpdateConfig.ts | 10 +++++++++- services/updateService.ts | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/constants/UpdateConfig.ts b/constants/UpdateConfig.ts index b224af3..ded2062 100644 --- a/constants/UpdateConfig.ts +++ b/constants/UpdateConfig.ts @@ -1,3 +1,5 @@ +import { DeviceUtils } from '@/utils/DeviceUtils'; + export const UPDATE_CONFIG = { // 自动检查更新 AUTO_CHECK: true, @@ -7,7 +9,13 @@ export const UPDATE_CONFIG = { // GitHub相关URL GITHUB_RAW_URL: 'https://ghfast.top/https://raw.githubusercontent.com/zimplexing/OrionTV/refs/heads/master/package.json', - GITHUB_RELEASE_URL_TEMPLATE: 'https://ghfast.top/https://github.com/zimplexing/OrionTV/releases/download/v{version}/orionTV.{version}.apk', + + // 获取平台特定的下载URL + getDownloadUrl(version: string): string { + const isTV = DeviceUtils.isTV(); + const platform = isTV ? 'tv' : 'mobile'; + return `https://ghfast.top/https://github.com/zimplexing/OrionTV/releases/download/v${version}/orionTV-${platform}.${version}.apk`; + }, // 是否显示更新日志 SHOW_RELEASE_NOTES: true, diff --git a/services/updateService.ts b/services/updateService.ts index c9a629d..df8454f 100644 --- a/services/updateService.ts +++ b/services/updateService.ts @@ -43,7 +43,7 @@ class UpdateService { return { version: remoteVersion, - downloadUrl: UPDATE_CONFIG.GITHUB_RELEASE_URL_TEMPLATE.replace(/{version}/g, remoteVersion), + downloadUrl: UPDATE_CONFIG.getDownloadUrl(remoteVersion), }; } catch (error) { retries++;