@@ -56,6 +56,8 @@ The matrix.to URL scheme is
|
|||||||
The #/ component is mandatory and exists to avoid leaking the target URL to the
|
The #/ component is mandatory and exists to avoid leaking the target URL to the
|
||||||
server hosting matrix.to.
|
server hosting matrix.to.
|
||||||
|
|
||||||
|
There is no _Entity type_ for **Spaces**, as they are technically just rooms.
|
||||||
|
|
||||||
Note that linking to rooms by ID should only be used for rooms to which the
|
Note that linking to rooms by ID should only be used for rooms to which the
|
||||||
target user has been invited: these links cannot be assumed to work for all
|
target user has been invited: these links cannot be assumed to work for all
|
||||||
visitors.
|
visitors.
|
||||||
|
|||||||
+10
-3
@@ -18,7 +18,7 @@ import {createEnum} from "./utils/enum.js";
|
|||||||
import {orderedUnique} from "./utils/unique.js";
|
import {orderedUnique} from "./utils/unique.js";
|
||||||
|
|
||||||
const ROOMALIAS_PATTERN = /^#([^:]*):(.+)$/;
|
const ROOMALIAS_PATTERN = /^#([^:]*):(.+)$/;
|
||||||
const ROOMID_PATTERN = /^!([^:]*):(.+)$/;
|
const ROOMID_PATTERN = /^!([^:]*)(:(.+))?$/; // As of room version 12, room IDs don't have domains
|
||||||
const USERID_PATTERN = /^@([^:]+):(.+)$/;
|
const USERID_PATTERN = /^@([^:]+):(.+)$/;
|
||||||
const EVENTID_PATTERN = /^$([^:]+):(.+)$/;
|
const EVENTID_PATTERN = /^$([^:]+):(.+)$/;
|
||||||
const GROUPID_PATTERN = /^\+([^:]+):(.+)$/;
|
const GROUPID_PATTERN = /^\+([^:]+):(.+)$/;
|
||||||
@@ -152,7 +152,7 @@ export class Link {
|
|||||||
}
|
}
|
||||||
matches = ROOMID_PATTERN.exec(identifier);
|
matches = ROOMID_PATTERN.exec(identifier);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
const server = matches[2];
|
const server = matches[3]; // group 2 is an optional over `:domain`, group 3 is just `domain`
|
||||||
const localPart = matches[1];
|
const localPart = matches[1];
|
||||||
return new Link(clientId, viaServers, IdentifierKind.RoomId, localPart, server, webInstances, eventId);
|
return new Link(clientId, viaServers, IdentifierKind.RoomId, localPart, server, webInstances, eventId);
|
||||||
}
|
}
|
||||||
@@ -166,12 +166,19 @@ export class Link {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(clientId, viaServers, identifierKind, localPart, server, webInstances, eventId) {
|
constructor(clientId, viaServers, identifierKind, localPart, server, webInstances, eventId) {
|
||||||
const servers = [server];
|
const servers = [];
|
||||||
|
if (server !== undefined) {
|
||||||
|
servers.push(server); // v12 rooms don't have domains, and therefore no server
|
||||||
|
}
|
||||||
servers.push(...viaServers);
|
servers.push(...viaServers);
|
||||||
this.webInstances = webInstances;
|
this.webInstances = webInstances;
|
||||||
this.servers = orderedUnique(servers);
|
this.servers = orderedUnique(servers);
|
||||||
this.identifierKind = identifierKind;
|
this.identifierKind = identifierKind;
|
||||||
|
if (identifierKind === IdentifierKind.RoomId && !server) {
|
||||||
|
this.identifier = `${asPrefix(identifierKind)}${localPart}`;
|
||||||
|
} else {
|
||||||
this.identifier = `${asPrefix(identifierKind)}${localPart}:${server}`;
|
this.identifier = `${asPrefix(identifierKind)}${localPart}:${server}`;
|
||||||
|
}
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const trustedWebInstances = [
|
|||||||
"chat.mozilla.org",
|
"chat.mozilla.org",
|
||||||
"webchat.kde.org",
|
"webchat.kde.org",
|
||||||
"app.gitter.im",
|
"app.gitter.im",
|
||||||
|
"chat.blender.org",
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user