mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-02-04 14:12:22 +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 { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@/components/ui/alert-dialog";
|
||||||
import { Progress } from "@/components/ui/progress";
|
import { Progress } from "@/components/ui/progress";
|
||||||
import useAppUpdater from "@/helpers/use-app-updater";
|
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() {
|
export function AppSidebar() {
|
||||||
const downloadStates = useDownloadStatesStore(state => state.downloadStates);
|
const downloadStates = useDownloadStatesStore(state => state.downloadStates);
|
||||||
@@ -25,11 +27,13 @@ export function AppSidebar() {
|
|||||||
const appUpdate = useSettingsPageStatesStore(state => state.appUpdate);
|
const appUpdate = useSettingsPageStatesStore(state => state.appUpdate);
|
||||||
const isUpdatingApp = useSettingsPageStatesStore(state => state.isUpdatingApp);
|
const isUpdatingApp = useSettingsPageStatesStore(state => state.isUpdatingApp);
|
||||||
const appUpdateDownloadProgress = useSettingsPageStatesStore(state => state.appUpdateDownloadProgress);
|
const appUpdateDownloadProgress = useSettingsPageStatesStore(state => state.appUpdateDownloadProgress);
|
||||||
|
const currentPlatform = platform();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { open } = useSidebar();
|
const { open } = useSidebar();
|
||||||
const { downloadAndInstallAppUpdate } = useAppUpdater();
|
const { downloadAndInstallAppUpdate } = useAppUpdater();
|
||||||
const [showBadge, setShowBadge] = useState(false);
|
const [showBadge, setShowBadge] = useState(false);
|
||||||
const [showUpdateCard, setShowUpdateCard] = useState(false);
|
const [showUpdateCard, setShowUpdateCard] = useState(false);
|
||||||
|
const [isNativeLinuxApp, setIsNativeLinuxApp] = useState(false);
|
||||||
|
|
||||||
const topItems: Array<RoutesObj> = [
|
const topItems: Array<RoutesObj> = [
|
||||||
{
|
{
|
||||||
@@ -69,6 +73,15 @@ export function AppSidebar() {
|
|||||||
};
|
};
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
(async () => {
|
||||||
|
if (currentPlatform === 'linux') {
|
||||||
|
const neoDlpExists = await fs.exists('/usr/bin/neodlp');
|
||||||
|
setIsNativeLinuxApp(neoDlpExists);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}, [currentPlatform]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sidebar collapsible="icon">
|
<Sidebar collapsible="icon">
|
||||||
<SidebarHeader>
|
<SidebarHeader>
|
||||||
@@ -160,9 +173,19 @@ export function AppSidebar() {
|
|||||||
<CardDescription>
|
<CardDescription>
|
||||||
A newer version of {config.appName} is available. Please update to the latest version for the best experience.
|
A newer version of {config.appName} is available. Please update to the latest version for the best experience.
|
||||||
</CardDescription>
|
</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>
|
</CardHeader>
|
||||||
<CardContent className="grid gap-2.5 p-4">
|
<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>
|
<AlertDialog>
|
||||||
<AlertDialogTrigger asChild>
|
<AlertDialogTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
@@ -184,6 +207,7 @@ export function AppSidebar() {
|
|||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
@@ -223,5 +247,5 @@ export function AppSidebar() {
|
|||||||
</SidebarMenu>
|
</SidebarMenu>
|
||||||
</SidebarFooter>
|
</SidebarFooter>
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user