diff --git a/internal/config/config.go b/internal/config/config.go index 5f812b0f..7af7e12d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -103,6 +103,7 @@ type Config struct { ShowFooter bool ShowNavigation bool ShowNewVersions bool + EnableCustomJs bool AuthJwtCookieName string AuthJwtAud string AuthJwtDomain string @@ -165,6 +166,7 @@ func DefaultConfigWithBasePort(basePort int) *Config { config.ShowFooter = true config.ShowNavigation = true config.ShowNewVersions = true + config.EnableCustomJs = false config.ExternalRestAddress = "." config.LogLevel = "INFO" config.CheckForUpdates = false diff --git a/internal/httpservers/webuiServer.go b/internal/httpservers/webuiServer.go index 9e553876..83b7bde3 100644 --- a/internal/httpservers/webuiServer.go +++ b/internal/httpservers/webuiServer.go @@ -31,6 +31,7 @@ type webUISettings struct { DefaultIconForBack string SshFoundKey string SshFoundConfig string + EnableCustomJs bool } func findWebuiDir() string { @@ -115,6 +116,7 @@ func generateWebUISettings(w http.ResponseWriter, r *http.Request) { DefaultIconForBack: cfg.DefaultIconForBack, SshFoundKey: installationinfo.Runtime.SshFoundKey, SshFoundConfig: installationinfo.Runtime.SshFoundConfig, + EnableCustomJs: cfg.EnableCustomJs, }) w.Header().Add("Content-Type", "application/json") diff --git a/webui.dev/main.js b/webui.dev/main.js index 66c34ff9..df3ad57e 100644 --- a/webui.dev/main.js +++ b/webui.dev/main.js @@ -105,6 +105,12 @@ function processWebuiSettingsJson (settings) { 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' if (settings.PageTitle) {