From 7497235d7bf58965c425a62c7146f10a26f0bcb9 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Tue, 25 Nov 2025 22:35:23 +0100 Subject: [PATCH] Update terminal-panel.tsx --- AppImage/components/terminal-panel.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/AppImage/components/terminal-panel.tsx b/AppImage/components/terminal-panel.tsx index cc8f9f1..147bd65 100644 --- a/AppImage/components/terminal-panel.tsx +++ b/AppImage/components/terminal-panel.tsx @@ -53,14 +53,14 @@ function getWebSocketUrl(): string { } } -function getApiUrl(): string { +function getApiUrl(endpoint?: string): string { if (typeof window === "undefined") { return "http://localhost:8008" } const { protocol, hostname } = window.location const apiProtocol = protocol === "https:" ? "https:" : "http:" - return `${apiProtocol}//${hostname}:${API_PORT}` + return `${apiProtocol}//${hostname}:${API_PORT}${endpoint || ""}` } const proxmoxCommands = [ @@ -225,7 +225,8 @@ export const TerminalPanel: React.FC = ({ websocketUrl, onCl try { setIsSearching(true) - const apiUrl = getApiUrl() + const searchEndpoint = `/api/terminal/search-command?q=${encodeURIComponent(query)}` + const apiUrl = getApiUrl(searchEndpoint) const token = typeof window !== "undefined" ? localStorage.getItem("proxmenux-auth-token") : null const headers: Record = { @@ -236,7 +237,7 @@ export const TerminalPanel: React.FC = ({ websocketUrl, onCl headers["Authorization"] = `Bearer ${token}` } - const response = await fetch(`${apiUrl}/api/terminal/search-command?q=${encodeURIComponent(query)}`, { + const response = await fetch(apiUrl, { method: "GET", headers, signal: AbortSignal.timeout(10000),