feat: serve matrix .well-known endpoints directly from Node server.js

This commit is contained in:
Kroonk
2026-05-22 12:30:23 +02:00
parent 9927d57755
commit 88627711be

View File

@@ -1059,6 +1059,27 @@ async function serveStatic(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.method !== 'GET') {
json(res, 405, { error: 'Method not allowed' });