mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
feat(session): add recording and replay (#1049)
This commit is contained in:
@@ -11,6 +11,9 @@ export type SessionLogRecord = {
|
||||
hostName: string | null;
|
||||
hostIp: string | null;
|
||||
sizeBytes: number | null;
|
||||
protocol: "ssh" | "rdp" | "vnc" | "telnet";
|
||||
format: "text" | "asciicast" | "guacamole";
|
||||
username: string | null;
|
||||
};
|
||||
|
||||
export async function getSessionLogs(): Promise<SessionLogRecord[]> {
|
||||
@@ -22,6 +25,36 @@ export async function getSessionLogs(): Promise<SessionLogRecord[]> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSessionLogBlob(id: number): Promise<Blob> {
|
||||
try {
|
||||
const response = await authApi.get(`/session_logs/${id}/content`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw handleApiError(error, "fetch session recording");
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSessionRecordingRetention(): Promise<number> {
|
||||
try {
|
||||
const response = await authApi.get("/session_logs/retention");
|
||||
return response.data.retentionDays;
|
||||
} catch (error) {
|
||||
throw handleApiError(error, "fetch session recording retention");
|
||||
}
|
||||
}
|
||||
|
||||
export async function setSessionRecordingRetention(
|
||||
retentionDays: number,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await authApi.put("/session_logs/retention", { retentionDays });
|
||||
} catch (error) {
|
||||
throw handleApiError(error, "update session recording retention");
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSessionLogContent(id: number): Promise<string> {
|
||||
try {
|
||||
const response = await authApi.get(`/session_logs/${id}/content`, {
|
||||
|
||||
Reference in New Issue
Block a user