feat: serve matrix .well-known endpoints directly from Node server.js
This commit is contained in:
21
server.js
21
server.js
@@ -1059,6 +1059,27 @@ async function serveStatic(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const server = http.createServer(async (req, res) => {
|
const server = http.createServer(async (req, res) => {
|
||||||
|
if (req.url?.startsWith('/.well-known/matrix/server')) {
|
||||||
|
res.writeHead(200, {
|
||||||
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Access-Control-Allow-Origin': '*'
|
||||||
|
});
|
||||||
|
res.end(JSON.stringify({ "m.server": "matrix.mischlabs.de:443" }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.url?.startsWith('/.well-known/matrix/client')) {
|
||||||
|
res.writeHead(200, {
|
||||||
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Access-Control-Allow-Origin': '*'
|
||||||
|
});
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
"m.homeserver": { "base_url": "https://matrix.mischlabs.de" },
|
||||||
|
"org.matrix.msc3575.proxy": { "url": "https://matrix.mischlabs.de" }
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (req.url?.startsWith('/api/auth/config')) {
|
if (req.url?.startsWith('/api/auth/config')) {
|
||||||
if (req.method !== 'GET') {
|
if (req.method !== 'GET') {
|
||||||
json(res, 405, { error: 'Method not allowed' });
|
json(res, 405, { error: 'Method not allowed' });
|
||||||
|
|||||||
Reference in New Issue
Block a user