fix(session-sharing): use the linked server for desktop meetings and links (#1507)

This commit is contained in:
ZacharyZcR authored and GitHub committed 2026-09-30 09:54:23 -05:00
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,