rename all instances of "hvnc" to "backstage"
This commit is contained in:
@@ -11,12 +11,12 @@ import {
|
||||
getRdSessionsByClient,
|
||||
getRdSessionCount,
|
||||
hasRdSessionsForClient,
|
||||
addHvncSession,
|
||||
getHvncSession,
|
||||
deleteHvncSession,
|
||||
getHvncSessionsByClient,
|
||||
hasHvncSessionsForClient,
|
||||
getHvncSessionCount,
|
||||
addbackstageSession,
|
||||
getbackstageSession,
|
||||
deletebackstageSession,
|
||||
getbackstageSessionsByClient,
|
||||
hasbackstageSessionsForClient,
|
||||
getbackstageSessionCount,
|
||||
addFileBrowserSession,
|
||||
getFileBrowserSession,
|
||||
deleteFileBrowserSession,
|
||||
@@ -135,18 +135,18 @@ describe("sessionManager - remote desktop sessions", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("sessionManager - HVNC sessions", () => {
|
||||
test("add, get, and delete HVNC session", () => {
|
||||
describe("sessionManager - backstage sessions", () => {
|
||||
test("add, get, and delete backstage session", () => {
|
||||
const ws = mockWs();
|
||||
addHvncSession({ id: "hvnc-1", clientId: "c-hvnc", viewer: ws, createdAt: Date.now() });
|
||||
addbackstageSession({ id: "backstage-1", clientId: "c-backstage", viewer: ws, createdAt: Date.now() });
|
||||
|
||||
expect(getHvncSession("hvnc-1")).toBeDefined();
|
||||
expect(hasHvncSessionsForClient("c-hvnc")).toBe(true);
|
||||
expect(getHvncSessionsByClient("c-hvnc").length).toBe(1);
|
||||
expect(getHvncSessionCount()).toBeGreaterThanOrEqual(1);
|
||||
expect(getbackstageSession("backstage-1")).toBeDefined();
|
||||
expect(hasbackstageSessionsForClient("c-backstage")).toBe(true);
|
||||
expect(getbackstageSessionsByClient("c-backstage").length).toBe(1);
|
||||
expect(getbackstageSessionCount()).toBeGreaterThanOrEqual(1);
|
||||
|
||||
expect(deleteHvncSession("hvnc-1")).toBe(true);
|
||||
expect(getHvncSession("hvnc-1")).toBeUndefined();
|
||||
expect(deletebackstageSession("backstage-1")).toBe(true);
|
||||
expect(getbackstageSession("backstage-1")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ export type DashboardViewer = {
|
||||
const consoleSessions = new Map<string, ConsoleSession>();
|
||||
const rdSessions = new Map<string, RemoteDesktopViewer>();
|
||||
const webcamSessions = new Map<string, RemoteDesktopViewer>();
|
||||
const hvncSessions = new Map<string, RemoteDesktopViewer>(); // HVNC uses same structure as RD
|
||||
const backstageSessions = new Map<string, RemoteDesktopViewer>(); // backstage uses same structure as RD
|
||||
const consoleSessionsByClient = new Map<string, Set<string>>();
|
||||
const rdSessionsByClient = new Map<string, Set<string>>();
|
||||
const webcamSessionsByClient = new Map<string, Set<string>>();
|
||||
const hvncSessionsByClient = new Map<string, Set<string>>();
|
||||
const backstageSessionsByClient = new Map<string, Set<string>>();
|
||||
const fileBrowserSessions = new Map<string, FileBrowserViewer>();
|
||||
const processSessions = new Map<string, ProcessViewer>();
|
||||
const fileBrowserSessionsByClient = new Map<string, Set<string>>();
|
||||
@@ -196,53 +196,53 @@ export function getAllRdSessions(): Map<string, RemoteDesktopViewer> {
|
||||
return rdSessions;
|
||||
}
|
||||
|
||||
// ==================== HVNC SESSION MANAGEMENT ====================
|
||||
// ==================== backstage SESSION MANAGEMENT ====================
|
||||
|
||||
export function addHvncSession(session: RemoteDesktopViewer): void {
|
||||
hvncSessions.set(session.id, session);
|
||||
addSessionToClientIndex(hvncSessionsByClient, session.clientId, session.id);
|
||||
export function addbackstageSession(session: RemoteDesktopViewer): void {
|
||||
backstageSessions.set(session.id, session);
|
||||
addSessionToClientIndex(backstageSessionsByClient, session.clientId, session.id);
|
||||
}
|
||||
|
||||
export function getHvncSession(
|
||||
export function getbackstageSession(
|
||||
sessionId: string,
|
||||
): RemoteDesktopViewer | undefined {
|
||||
return hvncSessions.get(sessionId);
|
||||
return backstageSessions.get(sessionId);
|
||||
}
|
||||
|
||||
export function deleteHvncSession(sessionId: string): boolean {
|
||||
const existing = hvncSessions.get(sessionId);
|
||||
export function deletebackstageSession(sessionId: string): boolean {
|
||||
const existing = backstageSessions.get(sessionId);
|
||||
if (!existing) return false;
|
||||
hvncSessions.delete(sessionId);
|
||||
removeSessionFromClientIndex(hvncSessionsByClient, existing.clientId, sessionId);
|
||||
backstageSessions.delete(sessionId);
|
||||
removeSessionFromClientIndex(backstageSessionsByClient, existing.clientId, sessionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getHvncSessionsByClient(clientId: string): RemoteDesktopViewer[] {
|
||||
return getHvncSessionsForClient(clientId);
|
||||
export function getbackstageSessionsByClient(clientId: string): RemoteDesktopViewer[] {
|
||||
return getbackstageSessionsForClient(clientId);
|
||||
}
|
||||
|
||||
export function getHvncSessionsForClient(clientId: string): RemoteDesktopViewer[] {
|
||||
const ids = hvncSessionsByClient.get(clientId);
|
||||
export function getbackstageSessionsForClient(clientId: string): RemoteDesktopViewer[] {
|
||||
const ids = backstageSessionsByClient.get(clientId);
|
||||
if (!ids || ids.size === 0) return [];
|
||||
const sessions: RemoteDesktopViewer[] = [];
|
||||
for (const id of ids) {
|
||||
const session = hvncSessions.get(id);
|
||||
const session = backstageSessions.get(id);
|
||||
if (session) sessions.push(session);
|
||||
}
|
||||
return sessions;
|
||||
}
|
||||
|
||||
export function hasHvncSessionsForClient(clientId: string): boolean {
|
||||
const ids = hvncSessionsByClient.get(clientId);
|
||||
export function hasbackstageSessionsForClient(clientId: string): boolean {
|
||||
const ids = backstageSessionsByClient.get(clientId);
|
||||
return Boolean(ids && ids.size > 0);
|
||||
}
|
||||
|
||||
export function getAllHvncSessions(): Map<string, RemoteDesktopViewer> {
|
||||
return hvncSessions;
|
||||
export function getAllbackstageSessions(): Map<string, RemoteDesktopViewer> {
|
||||
return backstageSessions;
|
||||
}
|
||||
|
||||
export function getHvncSessionCount(): number {
|
||||
return hvncSessions.size;
|
||||
export function getbackstageSessionCount(): number {
|
||||
return backstageSessions.size;
|
||||
}
|
||||
|
||||
// ==================== FILE BROWSER SESSION MANAGEMENT ====================
|
||||
|
||||
@@ -5,7 +5,7 @@ export type SocketRole =
|
||||
| ClientRole
|
||||
| "console_viewer"
|
||||
| "rd_viewer"
|
||||
| "hvnc_viewer"
|
||||
| "backstage_viewer"
|
||||
| "webcam_viewer"
|
||||
| "file_browser_viewer"
|
||||
| "process_viewer"
|
||||
|
||||
Reference in New Issue
Block a user