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

remove custom css and bootstrap related options

i may reimplement custom css later as an additive version where their
file is loaded on top of a17t.css later, but for now its not a priority.
This commit is contained in:
Harvey Tindall 2021-01-03 21:13:37 +00:00
parent 75d12b4a5c
commit 29fafba035
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
6 changed files with 19 additions and 39 deletions

View File

@ -81,9 +81,8 @@
"requires_restart": true,
"type": "select",
"options": [
"Bootstrap (Light)",
"Jellyfin (Dark)",
"Custom CSS"
"Default (Light)"
],
"value": "Jellyfin (Dark)",
"description": "Default appearance for all users."
@ -179,14 +178,6 @@
"value": "Your account has been created. Click below to continue to Jellyfin.",
"description": "Displayed when a user creates an account"
},
"bs5": {
"name": "Use Bootstrap 5",
"required": false,
"requires_restart": true,
"type": "bool",
"value": false,
"description": "Use the Bootstrap 5 Alpha. Looks better and removes the need for jQuery, so the page should load faster."
},
"url_base": {
"name": "URL Base",
"required": false,
@ -685,14 +676,6 @@
"value": "",
"description": "Location of stored user profiles (encompasses template and configuration and displayprefs) (json)"
},
"custom_css": {
"name": "Custom CSS",
"required": false,
"requires_restart": true,
"type": "text",
"value": "",
"description": "Location of custom bootstrap CSS."
},
"html_templates": {
"name": "Custom HTML Template Directory",
"required": false,

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" class="light-theme">
<html lang="en" class="{{ .cssClass }}">
<head>
<link rel="stylesheet" type="text/css" href="css/base.css">

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" class="light-theme">
<html lang="en" class="{{ .cssClass }}">
<head>
<link rel="stylesheet" type="text/css" href="css/base.css">
{{ template "header.html" . }}

22
main.go
View File

@ -51,8 +51,7 @@ type appContext struct {
configBase settings
dataPath string
localPath string
cssFile string
bsVersion int
cssClass string
jellyfinLogin bool
users []User
invalidTokens []string
@ -362,14 +361,6 @@ func start(asDaemon, firstCall bool) {
app.debug.Printf("Loaded config file \"%s\"", app.configPath)
if app.config.Section("ui").Key("bs5").MustBool(false) {
app.cssFile = "bs5-jf.css"
app.bsVersion = 5
} else {
app.cssFile = "bs4-jf.css"
app.bsVersion = 4
}
app.debug.Println("Loading storage")
app.storage.invite_path = app.config.Section("files").Key("invites").String()
@ -420,14 +411,15 @@ func start(asDaemon, firstCall bool) {
json.Unmarshal(configBase, &app.configBase)
themes := map[string]string{
"Jellyfin (Dark)": fmt.Sprintf("bs%d-jf.css", app.bsVersion),
"Bootstrap (Light)": fmt.Sprintf("bs%d.css", app.bsVersion),
"Custom CSS": "",
"Jellyfin (Dark)": "dark-theme",
"Default (Light)": "light-theme",
}
if app.config.Section("ui").Key("theme").String() == "Bootstrap (Light)" {
app.config.Section("ui").Key("theme").SetValue("Default (Light)")
}
if val, ok := themes[app.config.Section("ui").Key("theme").String()]; ok {
app.cssFile = val
app.cssClass = val
}
app.debug.Printf("Using css file \"%s\"", app.cssFile)
secret, err := generateSecret(16)
if err != nil {
app.err.Fatal(err)

View File

@ -5,8 +5,12 @@ export function toggleTheme() {
}
export function loadTheme() {
if (localStorage.getItem('theme') == "dark") {
const theme = localStorage.getItem("theme");
if (theme == "dark") {
document.documentElement.classList.add('dark-theme');
document.documentElement.classList.remove('light-theme');
} else if (theme == "light") {
document.documentElement.classList.add('light-theme');
document.documentElement.classList.remove('dark-theme');
}
}

View File

@ -18,6 +18,7 @@ func (app *appContext) AdminPage(gc *gin.Context) {
ombiEnabled := app.config.Section("ombi").Key("enabled").MustBool(false)
gcHTML(gc, http.StatusOK, "admin.html", gin.H{
"urlBase": app.URLBase,
"cssClass": app.cssClass,
"contactMessage": "",
"email_enabled": emailEnabled,
"notifications": notificationsEnabled,
@ -39,6 +40,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
}
gcHTML(gc, http.StatusOK, "form-loader.html", gin.H{
"urlBase": app.URLBase,
"cssClass": app.cssClass,
"contactMessage": app.config.Section("ui").Key("contact_message").String(),
"helpMessage": app.config.Section("ui").Key("help_message").String(),
"successMessage": app.config.Section("ui").Key("success_message").String(),
@ -46,14 +48,13 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
"validate": app.config.Section("password_validation").Key("enabled").MustBool(false),
"requirements": app.validator.getCriteria(),
"email": email,
"bs5": app.config.Section("ui").Key("bs5").MustBool(false),
"username": !app.config.Section("email").Key("no_username").MustBool(false),
"lang": app.storage.lang.Form["strings"],
})
} else {
gcHTML(gc, 404, "invalidCode.html", gin.H{
"bs5": app.config.Section("ui").Key("bs5").MustBool(false),
"cssFile": app.cssFile,
"cssFile": app.cssClass,
"contactMessage": app.config.Section("ui").Key("contact_message").String(),
})
}
@ -62,7 +63,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
func (app *appContext) NoRouteHandler(gc *gin.Context) {
gcHTML(gc, 404, "404.html", gin.H{
"bs5": app.config.Section("ui").Key("bs5").MustBool(false),
"cssFile": app.cssFile,
"cssFile": app.cssClass,
"contactMessage": app.config.Section("ui").Key("contact_message").String(),
})
}