mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 12:52:24 +03:00
Add login fallback (#3302)
Part of https://github.com/matrix-org/dendrite/issues/3216 The files are basically copied from Synapse, with minor changes to the called endpoints. We never seem to have had the `/_matrix/static/client/login/` endpoint, this adds it.
This commit is contained in:
parent
dae1ef2e46
commit
bebf701dce
6 changed files with 430 additions and 0 deletions
|
@ -50,6 +50,9 @@ import (
|
|||
//go:embed static/*.gotmpl
|
||||
var staticContent embed.FS
|
||||
|
||||
//go:embed static/client/login
|
||||
var loginFallback embed.FS
|
||||
|
||||
const HTTPServerTimeout = time.Minute * 5
|
||||
|
||||
// CreateClient creates a new client (normally used for media fetch requests).
|
||||
|
@ -158,6 +161,14 @@ func SetupAndServeHTTP(
|
|||
_, _ = w.Write(landingPage.Bytes())
|
||||
})
|
||||
|
||||
// We only need the files beneath the static/client/login folder.
|
||||
sub, err := fs.Sub(loginFallback, "static/client/login")
|
||||
if err != nil {
|
||||
logrus.Panicf("unable to read embedded files, this should never happen: %s", err)
|
||||
}
|
||||
// Serve a static page for login fallback
|
||||
routers.Static.PathPrefix("/client/login/").Handler(http.StripPrefix("/_matrix/static/client/login/", http.FileServer(http.FS(sub))))
|
||||
|
||||
var clientHandler http.Handler
|
||||
clientHandler = routers.Client
|
||||
if cfg.Global.Sentry.Enabled {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue