mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
fix: build desktop session share links on the linked server (#1350)
This commit is contained in:
1 parent
d30875483d
commit
ab43563247
11 files changed
+153
-29
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { TermixApp } from "@termix/plugin-sdk/frontend";
|
||||
import {
|
||||
guestViewUrl,
|
||||
sessionPublicUrl,
|
||||
} from "../../src/frontend/meeting-backend";
|
||||
|
||||
function desktop(url: string | null): TermixApp {
|
||||
return {
|
||||
desktop: { available: true, remoteServerUrl: async () => url },
|
||||
} as unknown as TermixApp;
|
||||
}
|
||||
|
||||
describe("session share links", () => {
|
||||
it("builds the link on the linked server for a remote session", async () => {
|
||||
const base = await sessionPublicUrl(
|
||||
desktop("https://termix.example/"),
|
||||
"remote",
|
||||
);
|
||||
expect(guestViewUrl(base, "shared", "tok")).toBe(
|
||||
"https://termix.example/?view=shared&token=tok",
|
||||
);
|
||||
});
|
||||
|
||||
it("gives no link for a session on the desktop's own backend", async () => {
|
||||
expect(
|
||||
await sessionPublicUrl(desktop("https://termix.example/"), "local"),
|
||||
).toBeNull();
|
||||
expect(
|
||||
guestViewUrl("file:///C:/app/index.html", "shared", "tok"),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("uses the page address in a browser", async () => {
|
||||
const app = { desktop: { available: false } } as unknown as TermixApp;
|
||||
expect(await sessionPublicUrl(app, undefined)).toBe(window.location.href);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user