mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
feat: move the terminal fully into the ssh-terminal plugin (B9)
This commit is contained in:
1 parent
535126fd1b
commit
79d77678c9
309 files changed
+41789
-14958
No files matched your search
@@ -47,6 +47,8 @@ export interface CollabRoomDetail {
|
||||
stage: CollabStage;
|
||||
controllerUserId: string | null;
|
||||
controlRequests: CollabControlRequest[];
|
||||
/** Where live room events are served, as /plugin-ws/<id>/<path>. */
|
||||
eventsWsPath: string;
|
||||
}
|
||||
|
||||
export interface CollabControlRequest {
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
import { authApi, handleApiError } from "@/main-axios";
|
||||
|
||||
// COMMAND HISTORY API
|
||||
// ============================================================================
|
||||
|
||||
export async function saveCommandToHistory(
|
||||
hostId: number,
|
||||
command: string,
|
||||
): Promise<{ id: number; command: string; executedAt: string }> {
|
||||
try {
|
||||
const response = await authApi.post("/terminal/command_history", {
|
||||
hostId,
|
||||
command,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw handleApiError(error, "save command to history");
|
||||
}
|
||||
}
|
||||
|
||||
export async function getCommandHistory(
|
||||
hostId: number,
|
||||
limit: number = 100,
|
||||
): Promise<string[]> {
|
||||
try {
|
||||
const response = await authApi.get(`/terminal/command_history/${hostId}`, {
|
||||
params: { limit },
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw handleApiError(error, "fetch command history");
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteCommandFromHistory(
|
||||
hostId: number,
|
||||
command: string,
|
||||
): Promise<{ success: boolean }> {
|
||||
try {
|
||||
const response = await authApi.post("/terminal/command_history/delete", {
|
||||
hostId,
|
||||
command,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw handleApiError(error, "delete command from history");
|
||||
}
|
||||
}
|
||||
|
||||
export async function clearCommandHistory(
|
||||
hostId: number,
|
||||
): Promise<{ success: boolean }> {
|
||||
try {
|
||||
const response = await authApi.delete(
|
||||
`/terminal/command_history/${hostId}`,
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw handleApiError(error, "clear command history");
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -91,6 +91,12 @@ export async function getActiveSessions(): Promise<ActiveSessionInfo[]> {
|
||||
});
|
||||
}
|
||||
|
||||
/** How long a detached terminal session is kept, in minutes. */
|
||||
export async function getSessionTimeoutMinutes(): Promise<number> {
|
||||
const response = await authApi.get("/open-tabs/session-timeout");
|
||||
return Number(response.data?.minutes) || 30;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// USER PREFERENCES API
|
||||
// ============================================================================
|
||||
|
||||
@@ -60,30 +60,6 @@ export async function getSessionTimeout(): Promise<{ timeoutHours: number }> {
|
||||
}
|
||||
}
|
||||
|
||||
// How long a detached terminal session is kept alive server-side.
|
||||
export async function getTerminalSessionSettings(): Promise<{
|
||||
timeoutMinutes: number;
|
||||
enabled: boolean;
|
||||
}> {
|
||||
try {
|
||||
const response = await authApi.get("/terminal/session_settings");
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "fetch terminal session settings");
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTerminalSessionSettings(input: {
|
||||
timeoutMinutes?: number;
|
||||
enabled?: boolean;
|
||||
}): Promise<void> {
|
||||
try {
|
||||
await authApi.patch("/terminal/session_settings", input);
|
||||
} catch (error) {
|
||||
handleApiError(error, "update terminal session settings");
|
||||
}
|
||||
}
|
||||
|
||||
export interface StepCaSettings {
|
||||
configured: boolean;
|
||||
caUrl: string;
|
||||
@@ -190,79 +166,6 @@ export async function updateAnalyticsEnabled(
|
||||
// TERMINAL IMAGE STORAGE SETTINGS
|
||||
// ============================================================================
|
||||
|
||||
export type TerminalImageStorageMode = "auto" | "local" | "remote-sftp";
|
||||
|
||||
/** Public settings shape: the backend-internal localDir is never returned. */
|
||||
export interface TerminalImageStorageSettings {
|
||||
mode: TerminalImageStorageMode;
|
||||
hostPath: string;
|
||||
ttlMs: number;
|
||||
maxCount: number;
|
||||
maxBytes: number;
|
||||
localMappingConfigured: boolean;
|
||||
}
|
||||
|
||||
export interface TerminalImageStorageSettingsUpdate {
|
||||
mode?: TerminalImageStorageMode;
|
||||
localDir?: string;
|
||||
hostPath?: string;
|
||||
ttlMs?: number;
|
||||
maxCount?: number;
|
||||
maxBytes?: number;
|
||||
}
|
||||
|
||||
export interface TerminalImageStorageTestResult {
|
||||
mode: TerminalImageStorageMode;
|
||||
connected: boolean;
|
||||
remoteSftpAvailable: boolean;
|
||||
localHostVisible: boolean | null;
|
||||
selectedMode: "local" | "remote-sftp" | "unavailable";
|
||||
localMappingConfigured: boolean;
|
||||
}
|
||||
|
||||
export async function getTerminalImageStorageSettings(): Promise<TerminalImageStorageSettings> {
|
||||
try {
|
||||
const response = await authApi.get(
|
||||
"/users/terminal-image-storage-settings",
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "fetch terminal image storage settings");
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTerminalImageStorageSettings(
|
||||
settings: TerminalImageStorageSettingsUpdate,
|
||||
): Promise<TerminalImageStorageSettings> {
|
||||
try {
|
||||
const response = await authApi.patch(
|
||||
"/users/terminal-image-storage-settings",
|
||||
settings,
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "update terminal image storage settings");
|
||||
}
|
||||
}
|
||||
|
||||
export async function testTerminalImageStorage(
|
||||
instanceId: string,
|
||||
): Promise<TerminalImageStorageTestResult> {
|
||||
try {
|
||||
const response = await authApi.post(
|
||||
"/users/terminal-image-storage-settings/test",
|
||||
{ instanceId },
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "test terminal image storage");
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// WHITE LABEL BRANDING
|
||||
// ============================================================================
|
||||
|
||||
export interface BrandingSettings {
|
||||
appName: string;
|
||||
tagline: string;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import { authApi, handleApiError } from "@/main-axios";
|
||||
import {
|
||||
normalizeTouchInputSettings,
|
||||
type TouchInputSettings,
|
||||
} from "@/types/touch-input-settings";
|
||||
|
||||
export async function getTouchInputSettings(): Promise<TouchInputSettings> {
|
||||
try {
|
||||
const response = await authApi.get("/users/touch-input-settings");
|
||||
return normalizeTouchInputSettings(response.data);
|
||||
} catch (error) {
|
||||
handleApiError(error, "fetch touch input settings");
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTouchInputSettings(
|
||||
settings: TouchInputSettings,
|
||||
): Promise<TouchInputSettings> {
|
||||
try {
|
||||
const response = await authApi.patch(
|
||||
"/users/touch-input-settings",
|
||||
settings,
|
||||
);
|
||||
return normalizeTouchInputSettings(response.data);
|
||||
} catch (error) {
|
||||
handleApiError(error, "update touch input settings");
|
||||
}
|
||||
}
|
||||
@@ -343,30 +343,6 @@ export async function updatePasswordResetAllowed(
|
||||
}
|
||||
}
|
||||
|
||||
export async function getCommandHistoryEnabled(): Promise<{
|
||||
enabled: boolean;
|
||||
}> {
|
||||
try {
|
||||
const response = await authApi.get("/users/command-history-enabled");
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "get command history enabled");
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateCommandHistoryEnabled(
|
||||
enabled: boolean,
|
||||
): Promise<{ enabled: boolean }> {
|
||||
try {
|
||||
const response = await authApi.patch("/users/command-history-enabled", {
|
||||
enabled,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
handleApiError(error, "update command history enabled");
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateOIDCConfig(
|
||||
config: Record<string, unknown>,
|
||||
): Promise<Record<string, unknown>> {
|
||||
|
||||
Reference in new issue
Block a user