Skip to content

Commit 302b689

Browse files
committed
fix: update permission
1 parent 4d80435 commit 302b689

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src-tauri/capabilities/deafult.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
},
3131
"clipboard-manager:default",
3232
"notification:default",
33-
"global-shortcut:default"
33+
"global-shortcut:default",
34+
"core:app:default",
35+
"core:app:allow-version",
36+
"updater:default",
37+
"updater:allow-check",
38+
"updater:allow-download",
39+
"updater:allow-download-and-install",
40+
"updater:allow-install"
3441
]
35-
}
42+
}

src/components/InfoPage.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { invoke } from "@tauri-apps/api/core";
2+
import { getVersion } from "@tauri-apps/api/app";
23
import { useEffect, useState } from "react";
34
import { backendFormatToShortcut, Shortcut } from "../utils/keyboardUtils";
45
import { updateManager, UpdateInfo } from "../utils/updater";
@@ -11,6 +12,8 @@ export function InfoPage() {
1112
const [isCheckingUpdate, setIsCheckingUpdate] = useState(false);
1213
const [isDownloading, setIsDownloading] = useState(false);
1314
const [downloadProgress, setDownloadProgress] = useState(0);
15+
const [statusMessage, setStatusMessage] = useState<string | null>(null);
16+
const [currentVersion, setCurrentVersion] = useState<string>("");
1417

1518
// Load initial settings and check for updates
1619
useEffect(() => {
@@ -50,6 +53,9 @@ export function InfoPage() {
5053
};
5154

5255
loadSettings();
56+
getVersion().then(setCurrentVersion).catch((error) => {
57+
console.error("❌ Failed to get app version:", error);
58+
});
5359
// Check for updates 2 seconds after loading to avoid blocking UI
5460
setTimeout(checkForUpdatesOnLaunch, 2000);
5561
}, []);
@@ -62,9 +68,13 @@ export function InfoPage() {
6268
if (!update) {
6369
// Show a message that no updates are available
6470
console.log('No updates available');
71+
setStatusMessage(currentVersion ? `Milo v${currentVersion} is up to date!` : 'Milo is up to date!');
72+
} else {
73+
setStatusMessage(null);
6574
}
6675
} catch (error) {
6776
console.error('Failed to check for updates:', error);
77+
setStatusMessage('Failed to check for updates. Please try again.');
6878
} finally {
6979
setIsCheckingUpdate(false);
7080
}
@@ -196,6 +206,12 @@ export function InfoPage() {
196206
</p>
197207
</div>
198208
)}
209+
210+
{statusMessage && !updateInfo && !isDownloading && (
211+
<div className="p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg text-xs text-green-800 dark:text-green-200">
212+
{statusMessage}
213+
</div>
214+
)}
199215
</div>
200216
</div>
201217
</div>

0 commit comments

Comments
 (0)