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

namespace MxApiExtensions.Controllers;

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

    public WellKnownController(MxApiExtensionsConfiguration config) {
        _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;
    }
}