Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(desktop): add manual update check entry in About page (#11854)

Inneiec854d7d5512
diff --git a/apps/desktop/src/main/controllers/UpdaterCtr.ts b/apps/desktop/src/main/controllers/UpdaterCtr.ts
index 60738f24e26..8129a9c16ad 100644
--- a/apps/desktop/src/main/controllers/UpdaterCtr.ts
+++ b/apps/desktop/src/main/controllers/UpdaterCtr.ts
@@ -12,7 +12,7 @@ export default class UpdaterCtr extends ControllerModule {
@IpcMethod()
async checkForUpdates() {
logger.info('Check for updates requested');
- await this.app.updaterManager.checkForUpdates();
+ await this.app.updaterManager.checkForUpdates({ manual: true });
}
/**
diff --git a/locales/en-US/common.json b/locales/en-US/common.json
index 081cf90fc75..0ffd1dc0726 100644
--- a/locales/en-US/common.json
+++ b/locales/en-US/common.json
@@ -29,6 +29,7 @@
"branchingRequiresSavedTopic": "Current topic is not saved, please save it first to use subtopic feature",
"cancel": "Cancel",
"changelog": "Changelog",
+ "checkForUpdates": "Check for Updates",
"clientDB.autoInit.title": "Initializing PGlite Database",
"clientDB.error.desc": "PGlite failed to initialize. Retry first. If it helps, open Self-serve fixes and follow the steps. Still stuck after a few tries? Use Report issue to send us the error details.",
"clientDB.error.detail": "Error reason: [{{type}}] {{message}}. Details are as follows:",
diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json
index bb89bea6b3f..7ccc36d4734 100644
--- a/locales/zh-CN/common.json
+++ b/locales/zh-CN/common.json
@@ -29,6 +29,7 @@
"branchingRequiresSavedTopic": "当前话题未保存。保存后即可使用子话题",
"cancel": "取消",
"changelog": "更新日志",
+ "checkForUpdates": "检查更新",
"clientDB.autoInit.title": "初始化 PGlite 数据库",
"clientDB.error.desc": "PGlite 数据库初始化遇到了问题。你可以先点右侧「重试」;如果方便,也可以打开「自助解决」按提示处理。多次重试仍不行:欢迎通过「反馈问题」把错误信息发给我们,我们会尽快排查。",
"clientDB.error.detail": "原因:[{{type}}] {{message}},明细如下:",
diff --git a/src/app/[variants]/(main)/settings/about/features/Version.tsx b/src/app/[variants]/(main)/settings/about/features/Version.tsx
index 2a01929c316..13da31d8197 100644
--- a/src/app/[variants]/(main)/settings/about/features/Version.tsx
+++ b/src/app/[variants]/(main)/settings/about/features/Version.tsx
@@ -1,13 +1,15 @@
import { BRANDING_NAME } from '@lobechat/business-const';
+import { getElectronIpc } from '@lobechat/electron-client-ipc';
import { Block, Button, Flexbox, Tag } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
+import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { ProductLogo } from '@/components/Branding';
import { CHANGELOG_URL, MANUAL_UPGRADE_URL, OFFICIAL_SITE } from '@/const/url';
import { CURRENT_VERSION } from '@/const/version';
import { useNewVersion } from '@/features/User/UserPanel/useNewVersion';
+import { autoUpdateService } from '@/services/electron/autoUpdate';
import { useGlobalStore } from '@/store/global';
const styles = createStaticStyles(({ css, cssVar }) => ({
@@ -28,6 +30,7 @@ const Version = memo<{ mobile?: boolean }>(({ mobile }) => {
useCheckServerVersion();
const showServerVersion = serverVersion && serverVersion !== CURRENT_VERSION;
+ const isDesktop = useMemo(() => !!getElectronIpc(), []);
return (
<Flexbox
@@ -69,7 +72,12 @@ const Version = memo<{ mobile?: boolean }>(({ mobile }) => {
<a href={CHANGELOG_URL} rel="noreferrer" style={{ flex: 1 }} target="_blank">
<Button block={mobile}>{t('changelog')}</Button>
</a>
- {hasNewVersion && (
+ {isDesktop && !hasNewVersion && (
+ <Button block={mobile} onClick={() => void autoUpdateService.checkUpdate()}>
+ {t('checkForUpdates')}
+ </Button>
+ )}
+ {hasNewVersion && !isDesktop && (
<a href={MANUAL_UPGRADE_URL} rel="noreferrer" style={{ flex: 1 }} target="_blank">
<Button block={mobile} type={'primary'}>
{t('upgradeVersion.action')}
diff --git a/src/locales/default/common.ts b/src/locales/default/common.ts
index e654682b3ad..1f949362cc3 100644
--- a/src/locales/default/common.ts
+++ b/src/locales/default/common.ts
@@ -34,6 +34,7 @@ export default {
'Current topic is not saved, please save it first to use subtopic feature',
'cancel': 'Cancel',
'changelog': 'Changelog',
+ 'checkForUpdates': 'Check for Updates',
'clientDB.autoInit.title': 'Initializing PGlite Database',
'clientDB.error.desc':
'PGlite failed to initialize. Retry first. If it helps, open Self-serve fixes and follow the steps. Still stuck after a few tries? Use Report issue to send us the error details.',