Fix UI loading redirections. Should fix #906
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
@@ -19,6 +20,11 @@ import (
|
||||
func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
|
||||
policy := bluemonday.UGCPolicy()
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
base := path.Join(conf.Server.BaseURL, consts.URLPathUI)
|
||||
if r.URL.Path == base {
|
||||
http.Redirect(w, r, base+"/", 302)
|
||||
}
|
||||
|
||||
c, err := ds.User(r.Context()).CountAll()
|
||||
firstTime := c == 0 && err == nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user