1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

include LICENSE in build, display in about tab

Also fixes last commit, user cache wasn't refreshed in ApplySettings, is
now.
This commit is contained in:
Harvey Tindall 2021-03-01 00:32:09 +00:00
parent fa7da1b23f
commit bd05a4b35a
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
4 changed files with 11 additions and 0 deletions

View File

@ -83,6 +83,7 @@ copy:
cp -r static/* data/web/ cp -r static/* data/web/
$(info copying language files) $(info copying language files)
cp -r lang data/ cp -r lang data/
cp LICENSE data/
internal-files: internal-files:
python3 scripts/embed.py internal python3 scripts/embed.py internal

1
api.go
View File

@ -1172,6 +1172,7 @@ func (app *appContext) ApplySettings(gc *gin.Context) {
policy = app.storage.profiles[req.Profile].Policy policy = app.storage.profiles[req.Profile].Policy
} else if req.From == "user" { } else if req.From == "user" {
applyingFrom = "user" applyingFrom = "user"
app.jf.CacheExpiry = time.Now()
user, status, err := app.jf.UserByID(req.ID, false) user, status, err := app.jf.UserByID(req.ID, false)
if !(status == 200 || status == 204) || err != nil { if !(status == 200 || status == 204) || err != nil {
app.err.Printf("Failed to get user from Jellyfin (%d): %s", status, err) app.err.Printf("Failed to get user from Jellyfin (%d): %s", status, err)

View File

@ -46,6 +46,7 @@
<p>{{ .strings.version }} <span class="code monospace">{{ .version }}</span></p> <p>{{ .strings.version }} <span class="code monospace">{{ .version }}</span></p>
<p>{{ .strings.commitNoun }} <span class="code monospace">{{ .commit }}</span></p> <p>{{ .strings.commitNoun }} <span class="code monospace">{{ .commit }}</span></p>
<p><a href="https://github.com/hrfee/jfa-go/blob/main/LICENSE">Available under the MIT License.</a></p> <p><a href="https://github.com/hrfee/jfa-go/blob/main/LICENSE">Available under the MIT License.</a></p>
<pre class="monospace">{{ .license }}</pre>
</div> </div>
</div> </div>
<div id="modal-modify-user" class="modal"> <div id="modal-modify-user" class="modal">

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"io/fs"
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
@ -68,6 +69,12 @@ func (app *appContext) AdminPage(gc *gin.Context) {
emailEnabled, _ := app.config.Section("invite_emails").Key("enabled").Bool() emailEnabled, _ := app.config.Section("invite_emails").Key("enabled").Bool()
notificationsEnabled, _ := app.config.Section("notifications").Key("enabled").Bool() notificationsEnabled, _ := app.config.Section("notifications").Key("enabled").Bool()
ombiEnabled := app.config.Section("ombi").Key("enabled").MustBool(false) ombiEnabled := app.config.Section("ombi").Key("enabled").MustBool(false)
var license string
l, err := fs.ReadFile(localFS, "LICENSE")
if err != nil {
license = ""
}
license = string(l)
gcHTML(gc, http.StatusOK, "admin.html", gin.H{ gcHTML(gc, http.StatusOK, "admin.html", gin.H{
"urlBase": app.getURLBase(gc), "urlBase": app.getURLBase(gc),
"cssClass": app.cssClass, "cssClass": app.cssClass,
@ -82,6 +89,7 @@ func (app *appContext) AdminPage(gc *gin.Context) {
"quantityStrings": app.storage.lang.Admin[lang].QuantityStrings, "quantityStrings": app.storage.lang.Admin[lang].QuantityStrings,
"language": app.storage.lang.Admin[lang].JSON, "language": app.storage.lang.Admin[lang].JSON,
"langName": lang, "langName": lang,
"license": license,
}) })
} }