mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-04 10:32:44 +00:00
feat(desktop): use healthchat:// deep-link scheme instead of element://
Switch the friendly deep-link / legacy SSO callback scheme from element:// to healthchat:// and stop registering element:// entirely. The reverse-DNS OIDC primary scheme (ch.healthchat.desktop://) is unchanged. Also rebrand the round-tripped SSO id param element-desktop-ssoid -> healthchat-desktop-ssoid on both the desktop and web sides.
This commit is contained in:
@@ -47,7 +47,7 @@ describe("ProtocolHandler", () => {
|
||||
expect(
|
||||
handler.getProfileFromDeeplink([
|
||||
"Element.app",
|
||||
`element://vector/webapp/?element-desktop-ssoid=${TEST_SESSION_ID}`,
|
||||
`healthchat://vector/webapp/?healthchat-desktop-ssoid=${TEST_SESSION_ID}`,
|
||||
]),
|
||||
).toBe(USER_DATA_DIR);
|
||||
});
|
||||
@@ -56,7 +56,7 @@ describe("ProtocolHandler", () => {
|
||||
expect(
|
||||
handler.getProfileFromDeeplink([
|
||||
"Element.app",
|
||||
`${TEST_PROTOCOL}:/vector/webapp/?no_universal_links=true&code=DEADBEEF&state=foobar:element-desktop-ssoid:${TEST_SESSION_ID}`,
|
||||
`${TEST_PROTOCOL}:/vector/webapp/?no_universal_links=true&code=DEADBEEF&state=foobar:healthchat-desktop-ssoid:${TEST_SESSION_ID}`,
|
||||
]),
|
||||
).toBe(USER_DATA_DIR);
|
||||
});
|
||||
@@ -65,7 +65,7 @@ describe("ProtocolHandler", () => {
|
||||
expect(
|
||||
handler.getProfileFromDeeplink([
|
||||
"Element.app",
|
||||
`${TEST_PROTOCOL}:/vector/webapp/?no_universal_links=true#code=DEADBEEF&state=foobar:element-desktop-ssoid:${TEST_SESSION_ID}`,
|
||||
`${TEST_PROTOCOL}:/vector/webapp/?no_universal_links=true#code=DEADBEEF&state=foobar:healthchat-desktop-ssoid:${TEST_SESSION_ID}`,
|
||||
]),
|
||||
).toBe(USER_DATA_DIR);
|
||||
});
|
||||
@@ -74,7 +74,7 @@ describe("ProtocolHandler", () => {
|
||||
expect(
|
||||
handler.getProfileFromDeeplink([
|
||||
"Element.app",
|
||||
`${TEST_PROTOCOL}:/vector/webapp/?no_universal_links=true#code=DEADBEEF:element-desktop-ssoid:${TEST_SESSION_ID}`,
|
||||
`${TEST_PROTOCOL}:/vector/webapp/?no_universal_links=true#code=DEADBEEF:healthchat-desktop-ssoid:${TEST_SESSION_ID}`,
|
||||
]),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -12,8 +12,8 @@ import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
const LEGACY_PROTOCOL = "element";
|
||||
const SEARCH_PARAM = "element-desktop-ssoid";
|
||||
const LEGACY_PROTOCOL = "healthchat";
|
||||
const SEARCH_PARAM = "healthchat-desktop-ssoid";
|
||||
const STORE_FILE_NAME = "sso-sessions.json";
|
||||
|
||||
// we getPath userData before electron-main changes it, so this is the default value
|
||||
@@ -130,8 +130,8 @@ export default class ProtocolHandler {
|
||||
const store = this.readStore();
|
||||
let sessionId = parsedUrl.searchParams.get(SEARCH_PARAM);
|
||||
if (!sessionId) {
|
||||
// In OIDC, we must shuttle the value in the `state` param rather than `element-desktop-ssoid`
|
||||
// We encode it as a suffix like `:element-desktop-ssoid:XXYYZZ`.
|
||||
// In OIDC, we must shuttle the value in the `state` param rather than `healthchat-desktop-ssoid`
|
||||
// We encode it as a suffix like `:healthchat-desktop-ssoid:XXYYZZ`.
|
||||
// The OIDC flow may have used response_mode=fragment or query, so we need to handle both cases.
|
||||
let searchParams = parsedUrl.searchParams;
|
||||
if (parsedUrl.hash.includes("=")) {
|
||||
|
||||
Reference in New Issue
Block a user