matrix-wellknowns/main.go
2024-04-13 16:27:35 -04:00

40 lines
748 B
Go

package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.GET(".well-known/matrix/client", clientHandler)
e.GET(".well-known/matrix/server", serverHandler)
e.Logger.Fatal(e.Start(":3000"))
}
func clientHandler(e echo.Context) error {
return e.String(http.StatusOK, `{
"m.homeserver": {
"base_url": "https://matrix.cycore.io"
},
"m.identity_server": {
"base_url": "https://vector.im"
},
"org.matrix.msc3575.proxy": {
"url": "https://slidingsync.cycore.io"
}
}`)
}
func serverHandler(e echo.Context) error {
return e.String(http.StatusOK, `{
"m.server": "matrix.cycore.io:443"
}`)
}