summary refs log tree commit diff
path: root/MxApiExtensions/Controllers/Other/WellKnownController.cs
blob: c0e255f7d186fb7546da518ebb9b1cfbfdd612cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System.Text.Json.Nodes;
using Microsoft.AspNetCore.Mvc;

namespace MxApiExtensions.Controllers;

[ApiController]
[Route("/")]
public class WellKnownController(MxApiExtensionsConfiguration config) : ControllerBase {
    private readonly MxApiExtensionsConfiguration _config = config;

    [HttpGet("/.well-known/matrix/client")]
    public object GetWellKnown() {
        var res = new JsonObject();
        res.Add("m.homeserver", new JsonObject {
            { "base_url", Request.Scheme + "://" + Request.Host },
        });
        return res;
    }
}