mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
feat: move tailscale device discovery and settings into a plugin
Adds plugins/tailscale/ with a devices sidebar tab, admin settings section, and re-auth dialog. Host Metrics tailscale manager card and SSH re-auth banner parsing stay in core.
This commit is contained in:
1 parent
5fbd5fb7e2
commit
8742c5d381
27 files changed
+850
-266
No files matched your search
@@ -1,4 +1,3 @@
|
||||
import axios from "axios";
|
||||
import { authApi, handleApiError, statsApi } from "@/main-axios";
|
||||
|
||||
// GLOBAL MONITORING SETTINGS
|
||||
@@ -128,73 +127,8 @@ export async function updateSessionTimeout(
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// TAILSCALE SETTINGS
|
||||
// ============================================================================
|
||||
|
||||
export async function getTailscaleSettings(): Promise<{
|
||||
apiKey: string;
|
||||
hasApiKey: boolean;
|
||||
apiBaseUrl: string;
|
||||
}> {
|
||||
try {
|
||||
const response = await authApi.get("/users/tailscale-settings");
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "fetch Tailscale settings");
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTailscaleSettings(
|
||||
apiKey: string,
|
||||
apiBaseUrl?: string,
|
||||
): Promise<{ hasApiKey: boolean }> {
|
||||
try {
|
||||
const response = await authApi.patch("/users/tailscale-settings", {
|
||||
apiKey,
|
||||
apiBaseUrl,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "update Tailscale settings");
|
||||
}
|
||||
}
|
||||
|
||||
export async function getTailscaleDevices(): Promise<{
|
||||
devices: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
hostname: string;
|
||||
addresses: string[];
|
||||
os: string;
|
||||
lastSeen: string;
|
||||
}>;
|
||||
hasApiKey: boolean;
|
||||
error?: string;
|
||||
}> {
|
||||
try {
|
||||
const response = await authApi.get("/tailscale/devices");
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error)) {
|
||||
const data = error.response?.data;
|
||||
if (
|
||||
data &&
|
||||
typeof data === "object" &&
|
||||
"hasApiKey" in data &&
|
||||
typeof data.hasApiKey === "boolean"
|
||||
) {
|
||||
return data as {
|
||||
devices: [];
|
||||
hasApiKey: boolean;
|
||||
error?: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
handleApiError(error, "fetch Tailscale devices");
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// Tailscale settings/device API wrappers moved to
|
||||
// plugins/tailscale/frontend/tailscale-api.ts.
|
||||
|
||||
// ============================================================================
|
||||
// GUACAMOLE SETTINGS
|
||||
|
||||
Reference in new issue
Block a user