fix(desktop): microsoft store build check

- Introduce MICROSOFT_STORE_BUILD constant to determine if the app is running from the Microsoft Store
- Update appUpdaterConfig to conditionally enable core updates based on the new constant
- Modify header creation logic to use MICROSOFT_STORE_BUILD for Windows platform detection

This change enhances the application's compatibility with Microsoft Store by ensuring proper update handling and header configuration.
This commit is contained in:
DIYgod 2025-07-16 18:11:12 +08:00
parent be9506ac9c
commit 341fd63bf5
No known key found for this signature in database
3 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import { DEV, MODE, ModeEnum } from "@follow/shared/constants"
import { DEV, MICROSOFT_STORE_BUILD, MODE, ModeEnum } from "@follow/shared/constants"
import path from "pathe"
import { isWindows } from "../env"
@ -8,7 +8,7 @@ export const appUpdaterConfig = {
enableRenderHotUpdate: !DEV && MODE !== ModeEnum.staging,
enableCoreUpdate:
!process.mas &&
!process.windowsStore &&
!MICROSOFT_STORE_BUILD &&
// Disable core update if platfrom is windows and application is't executing from default installion path.
// If the process is not executed from the default installation path,
// it is usually managed through a package manager like Scoop.

View File

@ -37,3 +37,9 @@ declare const ELECTRON: boolean
*/
export const ELECTRON_BUILD = !!ELECTRON
export const WEB_BUILD = !ELECTRON
export const MICROSOFT_STORE_BUILD =
typeof process !== "undefined"
? process.platform === "win32" &&
(process.windowsStore || process.execPath.startsWith("C:\\Program Files\\WindowsApps"))
: false

View File

@ -1,4 +1,4 @@
import { DEV, WEB_BUILD } from "@follow/shared/constants"
import { DEV, MICROSOFT_STORE_BUILD, WEB_BUILD } from "@follow/shared/constants"
import { imageRefererMatches } from "./img-proxy"
@ -81,7 +81,7 @@ export const createDesktopAPIHeaders = ({ version }: { version: string }) => {
break
}
case "win32": {
if (process.windowsStore) {
if (MICROSOFT_STORE_BUILD) {
platform = DesktopPlatform.DesktopWindowsMS
} else {
platform = DesktopPlatform.DesktopWindowsEXE