You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#2524
This PR addresses the issues expressed in #2524, in that it:
* checks if a server has advertised a FQDN it can be reached at and if that FQDN hosts Matrix's client APIs
* uses room aliases instead of room IDs, in order to avoid a badge being impossible to generate if the server that created the room leaves it
This includes a breaking change to the badge endpoint.
Copy file name to clipboardexpand all lines: services/matrix/matrix.service.js
+97-25
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,20 @@
2
2
3
3
constJoi=require('joi')
4
4
constBaseJsonService=require('../base-json')
5
+
consterrors=require('../errors')
6
+
7
+
constqueryParamSchema=Joi.object({
8
+
server_fqdn: Joi.string().hostname(),
9
+
}).required()
5
10
6
11
constmatrixRegisterSchema=Joi.object({
7
12
access_token: Joi.string().required(),
8
13
}).required()
9
14
15
+
constmatrixAliasLookupSchema=Joi.object({
16
+
room_id: Joi.string().required(),
17
+
})
18
+
10
19
constmatrixStateSchema=Joi.array()
11
20
.items(
12
21
Joi.object({
@@ -31,15 +40,36 @@ const documentation = `
31
40
<ul>
32
41
<li>Select the desired room inside the Riot.im client</li>
33
42
<li>Click on the room settings button (gear icon) located near the top right of the client</li>
34
-
<li>Scroll to the very bottom of the settings page and look under the <code>Advanced</code> tab</li>
35
-
<li>You should see the <code>Internal room ID</code> with your rooms ID next to it (ex: <code>!ltIjvaLydYAWZyihee:matrix.org</code>)</li>
36
-
<li>Replace the IDs <code>:</code> with <code>/</code></li>
37
-
<li>The final badge URL should look something like this <code>/matrix/!ltIjvaLydYAWZyihee/matrix.org.svg</code></li>
43
+
<li>Scroll to the very bottom of the settings page and look under the <code>Addresses</code> section</li>
44
+
<li>You should see one or more <code>room addresses (or aliases)</code>, which can be easily identified with their starting hash (<code>#</code>) character (ex: <code>#twim:matrix.org</code>)</li>
45
+
<li>If there is no address for this room, add one under <code>Local addresses for this room</code></li>
46
+
<li>Remove the starting hash character (<code>#</code>)</li>
47
+
<li>The final badge URL should look something like this <code>/matrix/twim:matrix.org.svg</code></li>
38
48
</ul>
49
+
</br>
50
+
Some Matrix homeservers don't hold a server name matching where they live (e.g. if the homeserver <code>example.com</code> that created the room alias <code>#mysuperroom:example.com</code> lives at <code>matrix.example.com</code>).
51
+
</br>
52
+
If that is the case of the homeserver that created the room alias used for generating the badge, you will need to add the server's FQDN (fully qualified domain name) as a query parameter.
53
+
</br>
54
+
The final badge URL should then look something like this <code>/matrix/mysuperroom:example.com.svg?server_fqdn=matrix.example.com</code>.
0 commit comments