Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/ui/features/guacamole/GuacamoleApp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useCallback } from "react";
import { GuacamoleDisplay } from "@/features/guacamole/GuacamoleDisplay.tsx";
import { FullScreenAppWrapper } from "@/features/FullScreenAppWrapper.tsx";
import { getGuacamoleTokenFromHost } from "@/main-axios.ts";
import { getGuacamoleTokenFromHost, getGuacdStatus } from "@/main-axios.ts";
import { useTranslation } from "react-i18next";
import { AlertCircle, RefreshCw } from "lucide-react";
import { Button } from "@/components/button.tsx";
Expand Down Expand Up @@ -75,8 +75,19 @@ const GuacamoleAppInner: React.FC<GuacamoleAppInnerProps> = ({
useEffect(() => {
setToken(null);
setError(null);
getGuacamoleTokenFromHost(hostId)
.then((result) => setToken(result.token))
getGuacdStatus()
.then((status) => {
if (status.guacd.status !== "connected") {
setError(
"Remote desktop service (guacd) is not available. Please ensure guacd is running and accessible.",
);
return;
}
return getGuacamoleTokenFromHost(hostId);
})
.then((result) => {
if (result) setToken(result.token);
})
.catch((err) => setError(err?.message || t("guacamole.failedToConnect")));
}, [hostId, retryCount]);

Expand Down
7 changes: 7 additions & 0 deletions src/ui/main-axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4501,6 +4501,13 @@ export async function getGuacamoleTokenFromHost(
}
}

export async function getGuacdStatus(): Promise<{
guacd: { status: string };
}> {
const response = await authApi.get("/guacamole/status");
return response.data;
}

// ============================================================================
// RBAC MANAGEMENT
// ============================================================================
Expand Down
Loading