mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-21 04:53:14 -06:00
PR comment changes
This commit is contained in:
parent
37d557202f
commit
416e6465d9
|
|
@ -15,6 +15,7 @@
|
||||||
package base
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
@ -488,7 +489,7 @@ func (b *BaseDendrite) SetupAndServeHTTP(
|
||||||
|
|
||||||
//Redirect for Landing Page
|
//Redirect for Landing Page
|
||||||
externalRouter.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
externalRouter.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, httputil.PublicStaticPath, http.StatusSeeOther)
|
http.Redirect(w, r, httputil.PublicStaticPath, http.StatusFound)
|
||||||
})
|
})
|
||||||
|
|
||||||
internalRouter.PathPrefix(httputil.InternalPathPrefix).Handler(b.InternalAPIMux)
|
internalRouter.PathPrefix(httputil.InternalPathPrefix).Handler(b.InternalAPIMux)
|
||||||
|
|
@ -498,16 +499,17 @@ func (b *BaseDendrite) SetupAndServeHTTP(
|
||||||
|
|
||||||
b.ConfigureAdminEndpoints()
|
b.ConfigureAdminEndpoints()
|
||||||
|
|
||||||
|
// Parse and execute the landing page template
|
||||||
tmpl := template.Must(template.ParseFS(staticContent, "static/*.gotmpl"))
|
tmpl := template.Must(template.ParseFS(staticContent, "static/*.gotmpl"))
|
||||||
|
landingPage := &bytes.Buffer{}
|
||||||
|
if err := tmpl.ExecuteTemplate(landingPage, "index.gotmpl", map[string]string{
|
||||||
|
"Version": internal.VersionString(),
|
||||||
|
}); err != nil {
|
||||||
|
logrus.WithError(err).Fatal("failed to execute landing page template")
|
||||||
|
}
|
||||||
|
|
||||||
b.PublicStaticMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
b.PublicStaticMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if err := tmpl.ExecuteTemplate(w, "index.gotmpl", map[string]string{
|
_, _ = w.Write(landingPage.Bytes())
|
||||||
"Version": internal.VersionString(),
|
|
||||||
}); err != nil {
|
|
||||||
logrus.WithError(err).Error("failed to execute landing page template")
|
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
|
||||||
_, _ = w.Write([]byte("failed to execute template"))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
var clientHandler http.Handler
|
var clientHandler http.Handler
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue