mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 15:15:24 +00:00
feat: turn session recording into a plugin (B13)
This commit is contained in:
1 parent
a276f6898c
commit
0af2c94983
147 files changed
+25915
-2074
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import type { PluginApiClient } from "@termix/plugin-sdk/frontend";
|
||||
|
||||
export type SessionLogRecord = {
|
||||
id: number;
|
||||
hostId: number;
|
||||
userId: string | null;
|
||||
startedAt: string;
|
||||
endedAt: string | null;
|
||||
duration: number | null;
|
||||
recordingPath: string | null;
|
||||
hostName: string | null;
|
||||
hostIp: string | null;
|
||||
sizeBytes: number | null;
|
||||
protocol: "ssh" | "rdp" | "vnc" | "telnet";
|
||||
format: "text" | "asciicast" | "guacamole";
|
||||
username: string | null;
|
||||
};
|
||||
|
||||
export function createSessionRecordingApi(api: PluginApiClient) {
|
||||
return {
|
||||
async list(): Promise<SessionLogRecord[]> {
|
||||
const response = await api.get<{ logs: SessionLogRecord[] }>("/");
|
||||
return response.data.logs;
|
||||
},
|
||||
|
||||
async getBlob(id: number): Promise<Blob> {
|
||||
const response = await api.get<Blob>(`/${id}/content`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async getContent(id: number): Promise<string> {
|
||||
const response = await api.get<string>(`/${id}/content`, {
|
||||
responseType: "text",
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async delete(id: number): Promise<void> {
|
||||
await api.delete(`/${id}`);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user