Skip to content

Commit

Permalink
Add well-known for Matrix clients
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Jan 14, 2023
1 parent 157cd45 commit dd9b5c8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
3 changes: 3 additions & 0 deletions config/config.beta.json
Expand Up @@ -51,6 +51,9 @@
},
"matrix": {
"wellKnownServer": "gitter-beta.ems.host:443",
"wellKnownClient": {
"homeserverBaseUrl": "https://gitter-beta.ems.host"
},
"bridge": {
"homeserverUrl": "https://gitter-beta.ems.host",
"serverName": "beta.gitter.im",
Expand Down
12 changes: 5 additions & 7 deletions config/config.prod.json
Expand Up @@ -48,6 +48,9 @@
},
"matrix": {
"wellKnownServer": "gitter.ems.host:443",
"wellKnownClient": {
"homeserverBaseUrl": "https://gitter.ems.host"
},
"bridge": {
"homeserverUrl": "https://gitter.ems.host",
"serverName": "gitter.im",
Expand All @@ -56,9 +59,7 @@
"gitterBridgeBackingUsername": "matrixbot",
"gitterBridgeProfileUsername": "gitter-badger",
"gitterLogoMxc": "mxc://gitter.im/5ca06a9ec041815b7bfe089ec2733507753aa43c",
"extraPowerLevelUserList": [
["@moderation:gitter.im", 100]
]
"extraPowerLevelUserList": [["@moderation:gitter.im", 100]]
}
},
"virtualUsers": {
Expand All @@ -67,10 +68,7 @@
}
},
"spam-detection": {
"ethereum-dirty-group-list": [
"57542c12c43b8c601976fa66",
"57542beec43b8c601976e3c5"
]
"ethereum-dirty-group-list": ["57542c12c43b8c601976fa66", "57542beec43b8c601976e3c5"]
},
"notifications": {
"notificationsSender": "support@gitter.im",
Expand Down
5 changes: 5 additions & 0 deletions public/templates/wellknown-matrix-client.hbs
@@ -0,0 +1,5 @@
{
"m.homeserver": {
"base_url": "{{ matrixWellKnownClient.homeserverBaseUrl }}"
}
}
File renamed without changes.
18 changes: 16 additions & 2 deletions server/handlers/root.js
Expand Up @@ -121,17 +121,31 @@ router.get(
if (nconf.get('matrix:wellKnownServer')) {
router.get(
'/.well-known/matrix/server',
identifyRoute('well-known-matrix'),
identifyRoute('well-known-matrix-server'),
preventClickjackingMiddleware,
function(req, res) {
res.set('Content-Type', 'application/manifest+json');
res.render('wellknown-matrix', {
res.render('wellknown-matrix-server', {
matrixWellKnownServer: nconf.get('matrix:wellKnownServer')
});
}
);
}

if (nconf.get('matrix:wellKnownClient')) {
router.get(
'/.well-known/matrix/client',
identifyRoute('well-known-matrix-client'),
preventClickjackingMiddleware,
function(req, res) {
res.set('Content-Type', 'application/manifest+json');
res.render('wellknown-matrix-client', {
matrixWellKnownClient: nconf.get('matrix:wellKnownClient')
});
}
);
}

router.get('/robots.txt', identifyRoute('homepage-robots'), preventClickjackingMiddleware, function(
req,
res
Expand Down

0 comments on commit dd9b5c8

Please sign in to comment.