Merge pull request #1 from luelista/custom-web-instances

Custom web instances
This commit was merged in pull request #1.
This commit is contained in:
Dome
2025-03-29 00:19:32 +01:00
committed by GitHub
4 changed files with 115 additions and 17 deletions
+4 -3
View File
@@ -56,8 +56,9 @@ export class Element {
get homepage() { return "https://element.io"; }
get author() { return "Element"; }
getMaturity(platform) { return Maturity.Stable; }
get supportsCustomInstances() { return true; }
getDeepLink(platform, link) {
getDeepLink(platform, link, preferredWebInstance) {
let fragmentPath;
switch (link.kind) {
case LinkKind.User:
@@ -83,8 +84,8 @@ export class Element {
let instanceHost = trustedWebInstances[0];
// we use app.element.io which iOS will intercept, but it likely won't intercept any other trusted instances
// so only use a preferred web instance for true web links.
if (isWebPlatform && trustedWebInstances.includes(link.webInstances[this.id])) {
instanceHost = link.webInstances[this.id];
if (isWebPlatform && preferredWebInstance) {
instanceHost = preferredWebInstance;
}
return `https://${instanceHost}/#/${fragmentPath}`;
} else if (platform === Platform.Linux || platform === Platform.Windows || platform === Platform.macOS) {