option to substitute "Jellyfin" in form.html

setting is jellyfin/substitute_jellyfin_strings.
This commit is contained in:
Harvey Tindall
2021-01-10 16:10:03 +00:00
committed by Harvey Tindall
parent f5602f1e96
commit 8d0dc232d7
7 changed files with 37 additions and 64 deletions
+15
View File
@@ -58,6 +58,21 @@ func (st *Storage) storeInvites() error {
}
func (st *Storage) loadLang() error {
if substituteStrings != "" {
var file []byte
var err error
file, err = ioutil.ReadFile(st.lang.FormPath)
if err != nil {
file = []byte("{}")
}
// Replace Jellyfin with emby on form
file = []byte(strings.ReplaceAll(string(file), "Jellyfin", substituteStrings))
err = json.Unmarshal(file, &st.lang.Form)
if err != nil {
log.Printf("ERROR: Failed to read \"%s\": %s", st.lang.FormPath, err)
}
return err
}
err := loadJSON(st.lang.FormPath, &st.lang.Form)
if err != nil {
return err