MCPcopy Create free account
hub / github.com/VirtualHotBar/NetMount / checkForUpdate

Function checkForUpdate

src/controller/update/tauriUpdater.ts:32–67  ·  view source on GitHub ↗
(silent: boolean = true)

Source from the content-addressed store, hash-verified

30 * @returns 是否发现新版本
31 */
32export async function checkForUpdate(silent: boolean = true): Promise<boolean> {
33 // 避免重复检查
34 if (isUpdating) {
35 return false
36 }
37
38 try {
39 const update = await check()
40
41 if (!update) {
42 // 无更新
43 if (!silent) {
44 Modal.success({
45 title: t('update_check_complete'),
46 content: t('already_latest_version'),
47 okText: t('ok'),
48 })
49 }
50 return false
51 }
52
53 // 有新版本,显示更新对话框
54 showUpdateDialog(update)
55 return true
56 } catch (error) {
57 console.error('Check update failed:', error)
58 if (!silent) {
59 Modal.error({
60 title: t('check_update_failed'),
61 content: String(error),
62 okText: t('ok'),
63 })
64 }
65 return false
66 }
67}
68
69function showUpdateDialog(update: UpdateInfo) {
70 let downloaded = 0

Callers 1

initFunction · 0.90

Calls 1

showUpdateDialogFunction · 0.85

Tested by

no test coverage detected