diff --git a/apps/desktop/layer/main/src/ipc/services/app.ts b/apps/desktop/layer/main/src/ipc/services/app.ts
index edd57ebbe..7aea4c05b 100644
--- a/apps/desktop/layer/main/src/ipc/services/app.ts
+++ b/apps/desktop/layer/main/src/ipc/services/app.ts
@@ -44,8 +44,8 @@ export class AppService extends IpcService {
}
@IpcMethod()
- checkForUpdates(): void {
- checkForAppUpdates()
+ async checkForUpdates(): Promise<{ hasUpdate: boolean; error?: string }> {
+ return checkForAppUpdates()
}
@IpcMethod()
diff --git a/apps/desktop/layer/main/src/updater/index.ts b/apps/desktop/layer/main/src/updater/index.ts
index dac662978..6d122e527 100644
--- a/apps/desktop/layer/main/src/updater/index.ts
+++ b/apps/desktop/layer/main/src/updater/index.ts
@@ -32,35 +32,56 @@ export const quitAndInstall = () => {
let downloading = false
let checkingUpdate = false
-const upgradeRenderIfNeeded = async () => {
+const checkRenderUpdateAvailable = async () => {
const [state, manifest] = await canUpdateRender()
- if (state === CanUpdateRenderState.NO_NEEDED) {
- return true
- }
if (state === CanUpdateRenderState.NEEDED && manifest) {
- await hotUpdateRender(manifest)
return true
}
return false
}
-export const checkForAppUpdates = async () => {
+
+const upgradeRenderIfNeeded = async () => {
+ const [state, manifest] = await canUpdateRender()
+ if (state === CanUpdateRenderState.NO_NEEDED) {
+ return { upgraded: false }
+ }
+ if (state === CanUpdateRenderState.NEEDED && manifest) {
+ await hotUpdateRender(manifest)
+ return { upgraded: true }
+ }
+ return { upgraded: false }
+}
+export const checkForAppUpdates = async (): Promise<{ hasUpdate: boolean; error?: string }> => {
if (disabled || checkingUpdate) {
- return
+ return { hasUpdate: false }
}
checkingUpdate = true
try {
+ let hasUpdate = false
+
if (appUpdaterConfig.enableRenderHotUpdate) {
- const isRenderUpgraded = await upgradeRenderIfNeeded()
- if (isRenderUpgraded) {
- return
+ const hasRenderUpdate = await checkRenderUpdateAvailable()
+ if (hasRenderUpdate) {
+ hasUpdate = true
+
+ // Auto upgrade renderer
+ upgradeRenderIfNeeded()
}
}
+
+ // Check for core app updates
if (appUpdaterConfig.enableCoreUpdate) {
- return autoUpdater.checkForUpdates()
+ const result = await autoUpdater.checkForUpdates()
+ if (result !== null && result.updateInfo !== null) {
+ hasUpdate = true
+ }
}
+
+ return { hasUpdate }
} catch (e) {
logger.error("Error checking for updates", e)
+ return { hasUpdate: false, error: e instanceof Error ? e.message : "Unknown error" }
} finally {
checkingUpdate = false
}
@@ -119,8 +140,8 @@ export const registerUpdater = async () => {
// Determine whether the app should be updated in full or only the renderer layer based on the version number.
// https://www.notion.so/rss3/Follow-Hotfix-Electron-Renderer-layer-RFC-fe2444b9ac194c2cb38f9fa0bb1ef3c1?pvs=4#12e35ea049b480f1b268f1e605d86a62
if (appUpdaterConfig.enableRenderHotUpdate) {
- const isRenderUpgraded = await upgradeRenderIfNeeded()
- if (isRenderUpgraded) {
+ const renderResult = await upgradeRenderIfNeeded()
+ if (renderResult.upgraded) {
return
}
}
diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx
index 92fa8ce04..186d14a0c 100644
--- a/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx
+++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx
@@ -1,148 +1,260 @@
+import { Folo } from "@follow/components/icons/folo.js"
import { Logo } from "@follow/components/icons/logo.jsx"
-import { Button } from "@follow/components/ui/button/index.js"
-import { styledButtonVariant } from "@follow/components/ui/button/variants.js"
-import { Divider } from "@follow/components/ui/divider/index.js"
+import { Divider } from "@follow/components/ui/divider/Divider.js"
import { SocialMediaLinks } from "@follow/constants"
+import { legalHtml } from "@follow/legal"
import { IN_ELECTRON, MODE, ModeEnum } from "@follow/shared/constants"
+import { stopPropagation } from "@follow/utils/dom"
import { getCurrentEnvironment } from "@follow/utils/environment"
+import { cn } from "@follow/utils/utils"
import PKG, { repository } from "@pkg"
import { useQuery } from "@tanstack/react-query"
+import { m } from "motion/react"
+import { useState } from "react"
import { Trans, useTranslation } from "react-i18next"
+import { toast } from "sonner"
-import { CopyButton } from "~/components/ui/button/CopyButton"
+import { useModalStack } from "~/components/ui/modal/stacked/hooks"
import { ipcServices } from "~/lib/client"
import { getNewIssueUrl } from "~/lib/issues"
export const SettingAbout = () => {
const { t } = useTranslation("settings")
+ const [isCheckingUpdate, setIsCheckingUpdate] = useState(false)
const currentEnvironment = getCurrentEnvironment().join("\n")
const { data: appVersion } = useQuery({
queryKey: ["appVersion"],
queryFn: () => ipcServices?.app.getAppVersion(),
})
+ const { present } = useModalStack()
const rendererVersion = PKG.version
- const handleCheckForUpdates = () => {
- ipcServices?.app.checkForUpdates()
+ const handleCheckForUpdates = async () => {
+ if (isCheckingUpdate) return
+
+ setIsCheckingUpdate(true)
+ const toastId = toast.loading(t("about.checkingForUpdates"))
+
+ try {
+ const result = await ipcServices?.app.checkForUpdates()
+
+ if (result?.error) {
+ toast.error(t("about.updateCheckFailed"), { id: toastId })
+ } else if (result?.hasUpdate) {
+ toast.success(t("about.updateAvailable"), { id: toastId })
+ } else {
+ toast.info(t("about.noUpdateAvailable"), { id: toastId })
+ }
+ } catch {
+ toast.error(t("about.updateCheckFailed"), { id: toastId })
+ } finally {
+ setIsCheckingUpdate(false)
+ }
+ }
+
+ const handleOpenLegal = (type: "privacy" | "tos") => {
+ present({
+ id: `legal-${type}`,
+ title: type === "privacy" ? t("about.privacyPolicy") : t("about.termsOfService"),
+ content: () => ,
+ resizeable: true,
+ clickOutsideToDismiss: true,
+ max: true,
+ })
}
return (
-
-
-
-
-
-
-
- {APP_NAME} {MODE !== ModeEnum.production ? `(${MODE})` : ""}
-
-
- {appVersion && (
-
- app: {appVersion}
-
- )}
- {rendererVersion && (
-
- renderer: {rendererVersion}
-
- )}
-
-
-
-
-
- {IN_ELECTRON && (
-
- )}
-
-
+
+ {/* Header Section */}
+
+
+
-
-
+
+
+
+ {MODE !== ModeEnum.production && (
+
+ {MODE}
+
+ )}
+
{t("about.licenseInfo", { appName: APP_NAME, currentYear: new Date().getFullYear() })}
-
-
- https://mgc.mingcute.com/
-
- ),
- ExternalLinkIcon: ,
+
+
+ {appVersion && (
+
+ App
+ {appVersion}
+
+ )}
+ {rendererVersion && (
+
+ Renderer
+ {rendererVersion}
+
+ )}
+
+
+
-
-
- open an issue
-
-
- ),
- ExternalLinkIcon: ,
- }}
- />
-
+ {/* Quick Actions */}
+
+ {IN_ELECTRON && (
+
+ )}
+
+
-
+ {/* Legal Section */}
+
+
+
+
+
-
{t("about.socialMedia")}
-
+ {/* Resources Section */}
+
+
{t("about.resources")}
+
+
+
+ open an issue
+
+ ),
+ }}
+ />
+
+
+ {t("about.projectLicense", { appName: APP_NAME })}
+
+
+
+ MingCute Icons
+
+ ),
+ }}
+ />
+
+
+
+
+ {/* Social Links */}
+
+
{t("about.socialMedia")}
+
-
+
)
}
+
+type LegalModalProps = {
+ type: "privacy" | "tos"
+}
+
+const LegalModalContent: React.FC
= ({ type }) => {
+ const content = type === "privacy" ? legalHtml.privacy : legalHtml.tos
+
+ return (
+
+
+
+
+
+ )
+}
diff --git a/locales/settings/en.json b/locales/settings/en.json
index de92d8baf..4fd1264a7 100644
--- a/locales/settings/en.json
+++ b/locales/settings/en.json
@@ -1,11 +1,26 @@
{
"about.changelog": "Changelog",
+ "about.changelogDescription": "See what's new in each version",
"about.checkForUpdates": "Check for Updates",
- "about.feedbackInfo": "{{appName}} ({{commitSha}}) is open-source and actively developed on GitHub. If you have any feedback or suggestions, please feel free to open an issue on our GitHub.",
- "about.iconLibrary": "The icon library used is copyrighted by and cannot be redistributed.",
+ "about.checkNow": "Check now",
+ "about.checkingForUpdates": "Checking for updates...",
+ "about.copyEnvironment": "Copy environment",
+ "about.environmentCopied": "Environment info copied",
+ "about.feedbackInfo": "{{appName}} ({{commitSha}}) is open-source and actively developed on GitHub. If you have any feedback or suggestions, please feel free to open an issue on our GitHub.",
+ "about.iconLibrary": "The icon library used is copyrighted by and cannot be redistributed.",
+ "about.legal": "Legal",
"about.licenseInfo": "Copyright © {{currentYear}} {{appName}}. All rights reserved.",
+ "about.noUpdateAvailable": "You're on the latest version",
+ "about.privacyPolicy": "Privacy Policy",
+ "about.projectLicense": "{{appName}} is licensed under the GNU General Public License version 3 with additional exceptions.",
+ "about.resources": "Resources & Contributions",
"about.sidebar_title": "About",
"about.socialMedia": "Social Media",
+ "about.termsOfService": "Terms of Service",
+ "about.updateAvailable": "Update available!",
+ "about.updateCheckFailed": "Failed to check for updates",
+ "about.updateDescription": "Keep your app up to date with the latest features and improvements",
+ "about.viewChangelog": "View changelog",
"actions.actionName": "Action {{number}}",
"actions.action_card.add": "Add",
"actions.action_card.all": "All",
diff --git a/locales/settings/ja.json b/locales/settings/ja.json
index 853738474..ab4a46c1c 100644
--- a/locales/settings/ja.json
+++ b/locales/settings/ja.json
@@ -1,11 +1,26 @@
{
"about.changelog": "変更履歴",
+ "about.changelogDescription": "各バージョンの新機能を確認",
"about.checkForUpdates": "アップデートを確認",
- "about.feedbackInfo": "{{appName}} ({{commitSha}}) は開発の初期段階にあります。フィードバックや提案があれば、気軽に GitHub で課題を報告してください 。",
- "about.iconLibrary": "使用されているアイコンライブラリは によって著作権が保護されており、再配布できません。",
+ "about.checkNow": "今すぐ確認",
+ "about.checkingForUpdates": "アップデートを確認中...",
+ "about.copyEnvironment": "環境をコピー",
+ "about.environmentCopied": "環境情報をコピーしました",
+ "about.feedbackInfo": "{{appName}} ({{commitSha}}) は開発の初期段階にあります。フィードバックや提案があれば、気軽に GitHub で課題を報告してください 。",
+ "about.iconLibrary": "使用されているアイコンライブラリは によって著作権が保護されており、再配布できません。",
+ "about.legal": "法的情報",
"about.licenseInfo": "Copyright © {{currentYear}} {{appName}}. All rights reserved.",
+ "about.noUpdateAvailable": "最新版を使用しています",
+ "about.privacyPolicy": "プライバシーポリシー",
+ "about.projectLicense": "{{appName}} は GNU General Public License バージョン3に追加の例外条項を加えたライセンスで提供されています。",
+ "about.resources": "リソースと貢献",
"about.sidebar_title": "About",
"about.socialMedia": "ソーシャルメディア",
+ "about.termsOfService": "利用規約",
+ "about.updateAvailable": "アップデートがあります!",
+ "about.updateCheckFailed": "アップデートの確認に失敗しました",
+ "about.updateDescription": "最新の機能と改善を取得するため、アプリを最新の状態に保ちましょう",
+ "about.viewChangelog": "変更履歴を表示",
"actions.actionName": "アクション {{number}}",
"actions.action_card.add": "追加",
"actions.action_card.all": "すべて",
diff --git a/locales/settings/zh-CN.json b/locales/settings/zh-CN.json
index 75075ba54..845c58246 100644
--- a/locales/settings/zh-CN.json
+++ b/locales/settings/zh-CN.json
@@ -1,11 +1,26 @@
{
"about.changelog": "更新日志",
+ "about.changelogDescription": "查看每个版本的新功能",
"about.checkForUpdates": "检查更新",
- "about.feedbackInfo": "{{appName}}({{commitSha}})正处于开发的早期阶段。如果你有任何反馈或建议,请随时在我们的 GitHub 上提出 。",
- "about.iconLibrary": "使用的图标库受版权保护,版权所有者为 ,不得重新分发。",
+ "about.checkNow": "立即检查",
+ "about.checkingForUpdates": "正在检查更新...",
+ "about.copyEnvironment": "复制环境",
+ "about.environmentCopied": "环境信息已复制",
+ "about.feedbackInfo": "{{appName}}({{commitSha}})正处于开发的早期阶段。如果你有任何反馈或建议,请随时在我们的 GitHub 上提出 。",
+ "about.iconLibrary": "使用的图标库受版权保护,版权所有者为 ,不得重新分发。",
+ "about.legal": "法律信息",
"about.licenseInfo": "Copyright © {{currentYear}} {{appName}}. 保留所有权利。",
+ "about.noUpdateAvailable": "已是最新版本",
+ "about.privacyPolicy": "隐私政策",
+ "about.projectLicense": "{{appName}} 采用 GNU 通用公共许可证第3版授权,并附有额外的例外条款。",
+ "about.resources": "资源与贡献",
"about.sidebar_title": "关于",
"about.socialMedia": "社交媒体",
+ "about.termsOfService": "服务条款",
+ "about.updateAvailable": "有可用更新!",
+ "about.updateCheckFailed": "检查更新失败",
+ "about.updateDescription": "保持应用程序更新以获得最新功能和改进",
+ "about.viewChangelog": "查看更新日志",
"actions.actionName": "规则 {{number}}",
"actions.action_card.add": "添加",
"actions.action_card.all": "全部",
diff --git a/locales/settings/zh-TW.json b/locales/settings/zh-TW.json
index 89e8bb111..902ea5a50 100644
--- a/locales/settings/zh-TW.json
+++ b/locales/settings/zh-TW.json
@@ -1,11 +1,26 @@
{
"about.changelog": "更新日誌",
+ "about.changelogDescription": "查看每個版本的新功能",
"about.checkForUpdates": "檢查更新",
- "about.feedbackInfo": "{{appName}} ({{commitSha}}) 正處於開發早期階段。如果您有任何回饋或建議,請隨時在我們的 GitHub 上 提交問題 。",
- "about.iconLibrary": "所使用的圖標庫版權由 所有,不得重新分發。",
+ "about.checkNow": "立即檢查",
+ "about.checkingForUpdates": "正在檢查更新...",
+ "about.copyEnvironment": "複製環境",
+ "about.environmentCopied": "環境資訊已複製",
+ "about.feedbackInfo": "{{appName}} ({{commitSha}}) 正處於開發早期階段。如果您有任何回饋或建議,請隨時在我們的 GitHub 上 提交問題 。",
+ "about.iconLibrary": "所使用的圖標庫版權由 所有,不得重新分發。",
+ "about.legal": "法律資訊",
"about.licenseInfo": "版權所有 © {{currentYear}} {{appName}}。保留所有權利。",
+ "about.noUpdateAvailable": "已是最新版本",
+ "about.privacyPolicy": "隱私政策",
+ "about.projectLicense": "{{appName}} 採用 GNU 通用公共授權條款第3版授權,並附有額外的例外條款。",
+ "about.resources": "資源與貢獻",
"about.sidebar_title": "關於",
"about.socialMedia": "社群媒體",
+ "about.termsOfService": "服務條款",
+ "about.updateAvailable": "有可用更新!",
+ "about.updateCheckFailed": "檢查更新失敗",
+ "about.updateDescription": "保持應用程式更新以獲得最新功能和改進",
+ "about.viewChangelog": "查看更新日誌",
"actions.actionName": "規則 {{number}}",
"actions.action_card.add": "新增",
"actions.action_card.all": "全部",