mirror of
https://github.com/RSSNext/Folo.git
synced 2026-10-29 03:46:58 +08:00
fix(updater): windows path seq
Enhanced logging in the updater module to provide more context during update checks and downloads. Updated path resolution logic for Windows to ensure correct handling of installation paths. Removed the outdated logger module to streamline the codebase. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -316,7 +316,7 @@ class WindowManagerStatic {
|
||||
} else {
|
||||
// Production entry
|
||||
const dynamicRenderEntry = loadDynamicRenderEntry()
|
||||
logger.info("load dynamic render entry", dynamicRenderEntry)
|
||||
if (dynamicRenderEntry) logger.info("load dynamic render entry", dynamicRenderEntry)
|
||||
const appLoadFileEntry =
|
||||
dynamicRenderEntry || path.resolve(__dirname, "../renderer/index.html")
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import path from "node:path"
|
||||
|
||||
import { DEV, MICROSOFT_STORE_BUILD, MODE, ModeEnum } from "@follow/shared/constants"
|
||||
import path from "pathe"
|
||||
|
||||
import { isWindows } from "../env"
|
||||
|
||||
@@ -13,7 +15,12 @@ export const appUpdaterConfig = {
|
||||
// If the process is not executed from the default installation path,
|
||||
// it is usually managed through a package manager like Scoop.
|
||||
// In this case, updates need to be disabled.
|
||||
!(isWindows && path.resolve(process.execPath, "../../") !== process.env.LOCALAPPDATA),
|
||||
!(
|
||||
isWindows &&
|
||||
process.env.LOCALAPPDATA &&
|
||||
// DO NOT USE pathe.resolve here, it will be resolved to a wrong path on Windows
|
||||
path.resolve(process.execPath, "../../") !== process.env.LOCALAPPDATA
|
||||
),
|
||||
// Disable app update will also disable renderer hot update and core update
|
||||
enableAppUpdate: !DEV,
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import { fileURLToPath } from "node:url"
|
||||
import { callWindowExpose } from "@follow/shared/bridge"
|
||||
import { DEV } from "@follow/shared/constants"
|
||||
import type { LatestReleasePayload, PlatformUpdate } from "@follow-app/client-sdk"
|
||||
import { mainHash } from "@pkg"
|
||||
import log from "electron-log"
|
||||
import type { AppUpdater } from "electron-updater"
|
||||
import { autoUpdater as defaultAutoUpdater } from "electron-updater"
|
||||
import { join } from "pathe"
|
||||
@@ -12,12 +14,12 @@ import type { RendererManifest } from "~/updater/hot-updater"
|
||||
import { RendererEligibilityStatus, rendererUpdater } from "~/updater/hot-updater"
|
||||
|
||||
import { channel, isWindows } from "../env"
|
||||
import { logger } from "../logger"
|
||||
import { getUpdateInfo } from "./api"
|
||||
import { appUpdaterConfig } from "./configs"
|
||||
import { FollowUpdateProvider } from "./follow-update-provider"
|
||||
import { WindowsUpdater } from "./windows-updater"
|
||||
|
||||
const logger = log.scope("app-updater")
|
||||
type UpdateCheckOptions = {
|
||||
refresh?: boolean
|
||||
}
|
||||
@@ -66,6 +68,7 @@ class FollowUpdater {
|
||||
this.registerAutoUpdaterEvents()
|
||||
|
||||
if (appUpdaterConfig.app.autoCheckUpdate) {
|
||||
logger.info("Initial update check, mainHash:", mainHash)
|
||||
void this.checkForUpdates().catch((error) =>
|
||||
logger.error("Initial update check failed", error),
|
||||
)
|
||||
@@ -324,9 +327,9 @@ class FollowUpdater {
|
||||
logger.info(`autoUpdater: download progress ${progress.percent.toFixed(2)}%`)
|
||||
})
|
||||
|
||||
this.autoUpdater.on("update-downloaded", () => {
|
||||
this.autoUpdater.on("update-downloaded", (ev) => {
|
||||
this.downloadingUpdate = false
|
||||
logger.info("autoUpdater: update downloaded")
|
||||
logger.info("autoUpdater: update downloaded", ev.downloadedFile, ev.version)
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow()
|
||||
if (!mainWindow) return
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import log from "electron-log"
|
||||
|
||||
/**
|
||||
* Logger for updater module with scoped prefix
|
||||
* All logs are prefixed with [Updater] for easy identification
|
||||
*/
|
||||
export const updaterLogger = log.scope("updater")
|
||||
|
||||
/**
|
||||
* Logger specifically for GitHub provider operations
|
||||
*/
|
||||
export const githubProviderLogger = log.scope("updater:github")
|
||||
|
||||
/**
|
||||
* Helper to log object properties in a formatted way
|
||||
*/
|
||||
export function logObject(logger: typeof updaterLogger, prefix: string, obj: Record<string, any>) {
|
||||
logger.info(`${prefix}:`)
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
logger.info(` ${key}: ${value}`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user