feature: `enableCustomJs` toggle to allow loading ./custom-webui/custom.js (#379)
This commit is contained in:
parent
fab0264d9b
commit
5b5fca0837
|
|
@ -103,6 +103,7 @@ type Config struct {
|
||||||
ShowFooter bool
|
ShowFooter bool
|
||||||
ShowNavigation bool
|
ShowNavigation bool
|
||||||
ShowNewVersions bool
|
ShowNewVersions bool
|
||||||
|
EnableCustomJs bool
|
||||||
AuthJwtCookieName string
|
AuthJwtCookieName string
|
||||||
AuthJwtAud string
|
AuthJwtAud string
|
||||||
AuthJwtDomain string
|
AuthJwtDomain string
|
||||||
|
|
@ -165,6 +166,7 @@ func DefaultConfigWithBasePort(basePort int) *Config {
|
||||||
config.ShowFooter = true
|
config.ShowFooter = true
|
||||||
config.ShowNavigation = true
|
config.ShowNavigation = true
|
||||||
config.ShowNewVersions = true
|
config.ShowNewVersions = true
|
||||||
|
config.EnableCustomJs = false
|
||||||
config.ExternalRestAddress = "."
|
config.ExternalRestAddress = "."
|
||||||
config.LogLevel = "INFO"
|
config.LogLevel = "INFO"
|
||||||
config.CheckForUpdates = false
|
config.CheckForUpdates = false
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ type webUISettings struct {
|
||||||
DefaultIconForBack string
|
DefaultIconForBack string
|
||||||
SshFoundKey string
|
SshFoundKey string
|
||||||
SshFoundConfig string
|
SshFoundConfig string
|
||||||
|
EnableCustomJs bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func findWebuiDir() string {
|
func findWebuiDir() string {
|
||||||
|
|
@ -115,6 +116,7 @@ func generateWebUISettings(w http.ResponseWriter, r *http.Request) {
|
||||||
DefaultIconForBack: cfg.DefaultIconForBack,
|
DefaultIconForBack: cfg.DefaultIconForBack,
|
||||||
SshFoundKey: installationinfo.Runtime.SshFoundKey,
|
SshFoundKey: installationinfo.Runtime.SshFoundKey,
|
||||||
SshFoundConfig: installationinfo.Runtime.SshFoundConfig,
|
SshFoundConfig: installationinfo.Runtime.SshFoundConfig,
|
||||||
|
EnableCustomJs: cfg.EnableCustomJs,
|
||||||
})
|
})
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,12 @@ function processWebuiSettingsJson (settings) {
|
||||||
document.querySelector('footer[title="footer"]').style.display = 'none'
|
document.querySelector('footer[title="footer"]').style.display = 'none'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.EnableCustomJs) {
|
||||||
|
const script = document.createElement('script')
|
||||||
|
script.src = './custom-webui/custom.js'
|
||||||
|
document.head.appendChild(script)
|
||||||
|
}
|
||||||
|
|
||||||
window.pageTitle = 'OliveTin'
|
window.pageTitle = 'OliveTin'
|
||||||
|
|
||||||
if (settings.PageTitle) {
|
if (settings.PageTitle) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue