mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
fix(session-sharing): use the linked server for desktop meetings and links (#1507)
This commit is contained in:
1 parent
9801cc7fc7
commit
ec7c2c2835
15 files changed
+621
-210
No files matched your search
@@ -520,6 +520,17 @@ export function createDirectory(
|
||||
return !!rows[0]?.isAdmin;
|
||||
},
|
||||
|
||||
async hostIdsBySyncId(syncId: string): Promise<number[]> {
|
||||
const { hosts } = await refs();
|
||||
const rows = await (
|
||||
await client()
|
||||
)
|
||||
.select({ id: hosts.id })
|
||||
.from(hosts)
|
||||
.where(eq(hosts.syncId, syncId));
|
||||
return rows.map((row: { id: number }) => row.id);
|
||||
},
|
||||
|
||||
async hostExists(hostId: number): Promise<boolean> {
|
||||
const { hosts } = await refs();
|
||||
const rows = await (
|
||||
|
||||
@@ -200,6 +200,32 @@ export function registerRoomRoutes(
|
||||
} = actions;
|
||||
const requireUse = ctx.rbac.require("use") as never;
|
||||
|
||||
router.get(
|
||||
"/meeting-host/:syncId",
|
||||
requireUse,
|
||||
async (req: Request, res: Response) => {
|
||||
if (!ctx.currentActor())
|
||||
return res.status(401).json({ error: "Authentication required" });
|
||||
try {
|
||||
for (const id of await directory.hostIdsBySyncId(
|
||||
String(req.params.syncId),
|
||||
)) {
|
||||
if ((await ctx.hosts.checkAccess(id, "connect")).hasAccess) {
|
||||
return res.json({ id });
|
||||
}
|
||||
}
|
||||
return res.status(404).json({
|
||||
error:
|
||||
"The host must be synced to the meeting server before presenting",
|
||||
});
|
||||
} catch {
|
||||
return res
|
||||
.status(500)
|
||||
.json({ error: "Failed to resolve meeting host" });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const audit = (
|
||||
req: Request,
|
||||
action: string,
|
||||
|
||||
Reference in new issue
Block a user