mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-02-04 11:52:23 +05:30
fix: downloading appimage update on native deb/rpm installation
This commit is contained in:
@@ -14,6 +14,8 @@ import { Button } from "@/components/ui/button";
|
||||
import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@/components/ui/alert-dialog";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import useAppUpdater from "@/helpers/use-app-updater";
|
||||
import { platform } from "@tauri-apps/plugin-os";
|
||||
import * as fs from "@tauri-apps/plugin-fs";
|
||||
|
||||
export function AppSidebar() {
|
||||
const downloadStates = useDownloadStatesStore(state => state.downloadStates);
|
||||
@@ -25,11 +27,13 @@ export function AppSidebar() {
|
||||
const appUpdate = useSettingsPageStatesStore(state => state.appUpdate);
|
||||
const isUpdatingApp = useSettingsPageStatesStore(state => state.isUpdatingApp);
|
||||
const appUpdateDownloadProgress = useSettingsPageStatesStore(state => state.appUpdateDownloadProgress);
|
||||
const currentPlatform = platform();
|
||||
const location = useLocation();
|
||||
const { open } = useSidebar();
|
||||
const { downloadAndInstallAppUpdate } = useAppUpdater();
|
||||
const [showBadge, setShowBadge] = useState(false);
|
||||
const [showUpdateCard, setShowUpdateCard] = useState(false);
|
||||
const [isNativeLinuxApp, setIsNativeLinuxApp] = useState(false);
|
||||
|
||||
const topItems: Array<RoutesObj> = [
|
||||
{
|
||||
@@ -69,6 +73,15 @@ export function AppSidebar() {
|
||||
};
|
||||
}, [open]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (currentPlatform === 'linux') {
|
||||
const neoDlpExists = await fs.exists('/usr/bin/neodlp');
|
||||
setIsNativeLinuxApp(neoDlpExists);
|
||||
}
|
||||
})();
|
||||
}, [currentPlatform]);
|
||||
|
||||
return (
|
||||
<Sidebar collapsible="icon">
|
||||
<SidebarHeader>
|
||||
@@ -160,9 +173,19 @@ export function AppSidebar() {
|
||||
<CardDescription>
|
||||
A newer version of {config.appName} is available. Please update to the latest version for the best experience.
|
||||
</CardDescription>
|
||||
<a className="text-xs font-semibold cursor-pointer mt-1" href={`https://github.com/neosubhamoy/neodlp/releases/tag/v${appUpdate?.version || '0.0.0'}`} target="_blank">✨ Read Changelog</a>
|
||||
<a className="text-xs font-semibold cursor-pointer mt-1" href={`https://github.com/${config.appRepo}/releases/tag/v${appUpdate?.version || '0.0.0'}`} target="_blank">✨ Read Changelog</a>
|
||||
</CardHeader>
|
||||
<CardContent className="grid gap-2.5 p-4">
|
||||
{isNativeLinuxApp ? (
|
||||
<Button
|
||||
className="w-full"
|
||||
size="sm"
|
||||
disabled={ongoingDownloads.length > 0 || isUpdatingApp}
|
||||
asChild
|
||||
>
|
||||
<a href={`https://github.com/${config.appRepo}/releases/tag/v${appUpdate?.version || '0.0.0'}`} target="_blank">Download Now</a>
|
||||
</Button>
|
||||
) : (
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button
|
||||
@@ -184,6 +207,7 @@ export function AppSidebar() {
|
||||
</AlertDialogHeader>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
@@ -223,5 +247,5 @@ export function AppSidebar() {
|
||||
</SidebarMenu>
|
||||
</SidebarFooter>
|
||||
</Sidebar>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user