fix 10.7.0 compatibility, simplify scss

Hyphens are added to user IDs from 10.7.0, so if the server is running
it, emails.json will be modified to include them. The existing file is
backed up. Also, scss files have been simplified since bs4-jf and bs5-jf share
much of the same content.
This commit is contained in:
Harvey Tindall
2020-11-29 18:01:10 +00:00
parent 9dbf60e3df
commit 3c952d21f7
7 changed files with 211 additions and 289 deletions
+21
View File
@@ -5,6 +5,7 @@ import (
"io/ioutil"
"log"
"strconv"
"strings"
"time"
)
@@ -190,3 +191,23 @@ func storeJSON(path string, obj interface{}) error {
}
return err
}
// JF 10.7.0 added hyphens to user IDs like this and we need to upgrade email storage to match it:
// [8 chars]-[4]-[4]-[4]-[12]
// This seems consistent, but we'll grab IDs from jellyfin just in case theres some variation.
func (app *appContext) upgradeEmailStorage(old map[string]interface{}) (map[string]interface{}, int, error) {
jfUsers, status, err := app.jf.GetUsers(false)
if status != 200 || err != nil {
return nil, status, err
}
newEmails := map[string]interface{}{}
for _, user := range jfUsers {
unstripped := user["Id"].(string)
stripped := strings.ReplaceAll(unstripped, "-", "")
email, ok := old[stripped]
if ok {
newEmails[unstripped] = email
}
}
return newEmails, status, err
}