diff --git a/electron/main.cjs b/electron/main.cjs index 5fb0b348..32f13f71 100644 --- a/electron/main.cjs +++ b/electron/main.cjs @@ -204,10 +204,10 @@ ipcMain.handle('test-server-connection', async (event, serverUrl) => { const healthData = JSON.parse(data); // Check if it has the expected Termix health check structure if (healthData && ( + healthData.status === 'ok' || // Termix returns {status: 'ok'} healthData.status === 'healthy' || healthData.healthy === true || - healthData.database === 'connected' || - (healthData.app && healthData.app.toLowerCase().includes('termix')) + healthData.database === 'connected' )) { return { success: true, status: response.status, testedUrl: healthUrl }; } @@ -239,11 +239,11 @@ ipcMain.handle('test-server-connection', async (event, serverUrl) => { try { const versionData = JSON.parse(data); - // Check if it looks like a Termix version response - must be JSON and contain Termix-specific fields + // Check if it looks like a Termix version response - must be JSON and contain version-specific fields if (versionData && ( - (versionData.app && versionData.app.toLowerCase().includes('termix')) || - (versionData.name && versionData.name.toLowerCase().includes('termix')) || - (versionData.version && versionData.description && versionData.description.toLowerCase().includes('termix')) + versionData.status === 'up_to_date' || + versionData.status === 'requires_update' || + (versionData.localVersion && versionData.version && versionData.latest_release) )) { return { success: true, status: response.status, testedUrl: versionUrl, warning: 'Health endpoint not available, but server appears to be running' }; } diff --git a/src/ui/Desktop/Navigation/LeftSidebar.tsx b/src/ui/Desktop/Navigation/LeftSidebar.tsx index 7f54867a..eeb79697 100644 --- a/src/ui/Desktop/Navigation/LeftSidebar.tsx +++ b/src/ui/Desktop/Navigation/LeftSidebar.tsx @@ -1,9 +1,6 @@ import React, {useState} from 'react'; import { - Computer, - Server, - File, - Hammer, ChevronUp, User2, HardDrive, Trash2, Users, Shield, Settings, Menu, ChevronRight + ChevronUp, User2, HardDrive, Menu, ChevronRight } from "lucide-react"; import { useTranslation } from 'react-i18next'; import {getCookie, setCookie} from "@/ui/main-axios.ts"; @@ -12,7 +9,6 @@ import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, - SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, @@ -23,32 +19,11 @@ import { Separator, } from "@/components/ui/separator.tsx" import {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger} from "@radix-ui/react-dropdown-menu"; -import { - Sheet, - SheetContent, - SheetDescription, - SheetFooter, - SheetHeader, - SheetTitle, - SheetTrigger, - SheetClose -} from "@/components/ui/sheet.tsx"; -import {Checkbox} from "@/components/ui/checkbox.tsx"; import {Input} from "@/components/ui/input.tsx"; import {PasswordInput} from "@/components/ui/password-input.tsx"; import {Label} from "@/components/ui/label.tsx"; import {Button} from "@/components/ui/button.tsx"; import {Alert, AlertTitle, AlertDescription} from "@/components/ui/alert.tsx"; -import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs.tsx"; -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from "@/components/ui/table.tsx"; -import {Card} from "@/components/ui/card.tsx"; import {FolderCard} from "@/ui/Desktop/Navigation/Hosts/FolderCard.tsx"; import {getSSHHosts} from "@/ui/main-axios.ts"; import {useTabs} from "@/ui/Desktop/Navigation/Tabs/TabContext.tsx"; @@ -86,11 +61,13 @@ interface SidebarProps { children?: React.ReactNode; } -function handleLogout() { - // Clear the JWT token using the proper cookie functions +function isElectron() { const isElectron = (window as any).IS_ELECTRON === true || (window as any).electronAPI?.isElectron === true; - - if (isElectron) { + return isElectron; +} + +function handleLogout() { + if (isElectron()) { localStorage.removeItem('jwt'); } else { document.cookie = 'jwt=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; @@ -403,7 +380,7 @@ export function LeftSidebar({ }}> {t('profile.title')} - {isAdmin && ( + {isAdmin && isElectron() && ( {