v1.6.0 #221
@@ -204,10 +204,10 @@ ipcMain.handle('test-server-connection', async (event, serverUrl) => {
|
|||||||
const healthData = JSON.parse(data);
|
const healthData = JSON.parse(data);
|
||||||
// Check if it has the expected Termix health check structure
|
// Check if it has the expected Termix health check structure
|
||||||
if (healthData && (
|
if (healthData && (
|
||||||
|
healthData.status === 'ok' || // Termix returns {status: 'ok'}
|
||||||
healthData.status === 'healthy' ||
|
healthData.status === 'healthy' ||
|
||||||
healthData.healthy === true ||
|
healthData.healthy === true ||
|
||||||
healthData.database === 'connected' ||
|
healthData.database === 'connected'
|
||||||
(healthData.app && healthData.app.toLowerCase().includes('termix'))
|
|
||||||
)) {
|
)) {
|
||||||
return { success: true, status: response.status, testedUrl: healthUrl };
|
return { success: true, status: response.status, testedUrl: healthUrl };
|
||||||
}
|
}
|
||||||
@@ -239,11 +239,11 @@ ipcMain.handle('test-server-connection', async (event, serverUrl) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const versionData = JSON.parse(data);
|
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 && (
|
if (versionData && (
|
||||||
(versionData.app && versionData.app.toLowerCase().includes('termix')) ||
|
versionData.status === 'up_to_date' ||
|
||||||
(versionData.name && versionData.name.toLowerCase().includes('termix')) ||
|
versionData.status === 'requires_update' ||
|
||||||
(versionData.version && versionData.description && versionData.description.toLowerCase().includes('termix'))
|
(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' };
|
return { success: true, status: response.status, testedUrl: versionUrl, warning: 'Health endpoint not available, but server appears to be running' };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import {
|
import {
|
||||||
Computer,
|
ChevronUp, User2, HardDrive, Menu, ChevronRight
|
||||||
Server,
|
|
||||||
File,
|
|
||||||
Hammer, ChevronUp, User2, HardDrive, Trash2, Users, Shield, Settings, Menu, ChevronRight
|
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {getCookie, setCookie} from "@/ui/main-axios.ts";
|
import {getCookie, setCookie} from "@/ui/main-axios.ts";
|
||||||
@@ -12,7 +9,6 @@ import {
|
|||||||
Sidebar,
|
Sidebar,
|
||||||
SidebarContent, SidebarFooter,
|
SidebarContent, SidebarFooter,
|
||||||
SidebarGroup,
|
SidebarGroup,
|
||||||
SidebarGroupContent,
|
|
||||||
SidebarGroupLabel,
|
SidebarGroupLabel,
|
||||||
SidebarMenu,
|
SidebarMenu,
|
||||||
SidebarMenuButton,
|
SidebarMenuButton,
|
||||||
@@ -23,32 +19,11 @@ import {
|
|||||||
Separator,
|
Separator,
|
||||||
} from "@/components/ui/separator.tsx"
|
} from "@/components/ui/separator.tsx"
|
||||||
import {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger} from "@radix-ui/react-dropdown-menu";
|
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 {Input} from "@/components/ui/input.tsx";
|
||||||
import {PasswordInput} from "@/components/ui/password-input.tsx";
|
import {PasswordInput} from "@/components/ui/password-input.tsx";
|
||||||
import {Label} from "@/components/ui/label.tsx";
|
import {Label} from "@/components/ui/label.tsx";
|
||||||
import {Button} from "@/components/ui/button.tsx";
|
import {Button} from "@/components/ui/button.tsx";
|
||||||
import {Alert, AlertTitle, AlertDescription} from "@/components/ui/alert.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 {FolderCard} from "@/ui/Desktop/Navigation/Hosts/FolderCard.tsx";
|
||||||
import {getSSHHosts} from "@/ui/main-axios.ts";
|
import {getSSHHosts} from "@/ui/main-axios.ts";
|
||||||
import {useTabs} from "@/ui/Desktop/Navigation/Tabs/TabContext.tsx";
|
import {useTabs} from "@/ui/Desktop/Navigation/Tabs/TabContext.tsx";
|
||||||
@@ -86,11 +61,13 @@ interface SidebarProps {
|
|||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLogout() {
|
function isElectron() {
|
||||||
// Clear the JWT token using the proper cookie functions
|
|
||||||
const isElectron = (window as any).IS_ELECTRON === true || (window as any).electronAPI?.isElectron === true;
|
const isElectron = (window as any).IS_ELECTRON === true || (window as any).electronAPI?.isElectron === true;
|
||||||
|
return isElectron;
|
||||||
if (isElectron) {
|
}
|
||||||
|
|
||||||
|
function handleLogout() {
|
||||||
|
if (isElectron()) {
|
||||||
localStorage.removeItem('jwt');
|
localStorage.removeItem('jwt');
|
||||||
} else {
|
} else {
|
||||||
document.cookie = 'jwt=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
|
document.cookie = 'jwt=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
|
||||||
@@ -403,7 +380,7 @@ export function LeftSidebar({
|
|||||||
}}>
|
}}>
|
||||||
<span>{t('profile.title')}</span>
|
<span>{t('profile.title')}</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
{isAdmin && (
|
{isAdmin && isElectron() && (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="rounded px-2 py-1.5 hover:bg-white/15 hover:text-accent-foreground focus:bg-white/20 focus:text-accent-foreground cursor-pointer focus:outline-none"
|
className="rounded px-2 py-1.5 hover:bg-white/15 hover:text-accent-foreground focus:bg-white/20 focus:text-accent-foreground cursor-pointer focus:outline-none"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user