Custom localization (#2837)

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
HijackHornet
2022-09-22 11:49:35 +02:00
committed by GitHub
parent c10d53ba8e
commit 74191c73ed
13 changed files with 155 additions and 4 deletions

View File

@@ -179,6 +179,21 @@ func Start() error {
http.ServeFile(w, r, fn)
})
r.HandleFunc("/customlocales", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
if !c.GetCustomLocalesEnabled() {
return
}
// search for custom-locales.json in current directory, then $HOME/.stash
fn := c.GetCustomLocalesPath()
exists, _ := fsutil.FileExists(fn)
if !exists {
return
}
http.ServeFile(w, r, fn)
})
r.HandleFunc("/login*", func(w http.ResponseWriter, r *http.Request) {
ext := path.Ext(r.URL.Path)