feature: stylemods, for side by side buttons, and XL images (#634)

This commit is contained in:
James Read 2025-07-29 00:02:04 +01:00 committed by GitHub
parent 2d4a3fc048
commit a06299bd9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 2 deletions

View File

@ -150,6 +150,7 @@ type Config struct {
DefaultIconForBack string DefaultIconForBack string
AdditionalNavigationLinks []*NavigationLink AdditionalNavigationLinks []*NavigationLink
ServiceHostMode string ServiceHostMode string
StyleMods []string
usedConfigDir string usedConfigDir string
} }

View File

@ -32,6 +32,7 @@ type webUISettings struct {
EnableCustomJs bool EnableCustomJs bool
AuthLoginUrl string AuthLoginUrl string
AuthLocalLogin bool AuthLocalLogin bool
StyleMods []string
AuthOAuth2Providers []publicOAuth2Provider AuthOAuth2Providers []publicOAuth2Provider
AdditionalLinks []*config.NavigationLink AdditionalLinks []*config.NavigationLink
} }
@ -141,6 +142,7 @@ func generateWebUISettings(w http.ResponseWriter, r *http.Request) {
AuthLocalLogin: cfg.AuthLocalUsers.Enabled, AuthLocalLogin: cfg.AuthLocalUsers.Enabled,
AuthOAuth2Providers: buildPublicOAuth2ProvidersList(cfg), AuthOAuth2Providers: buildPublicOAuth2ProvidersList(cfg),
AdditionalLinks: cfg.AdditionalNavigationLinks, AdditionalLinks: cfg.AdditionalNavigationLinks,
StyleMods: cfg.StyleMods,
}) })
w.Header().Add("Content-Type", "application/json") w.Header().Add("Content-Type", "application/json")

View File

@ -92,6 +92,8 @@ function fetchGetLogs () {
} }
function processWebuiSettingsJson (settings) { function processWebuiSettingsJson (settings) {
window.settings = settings
setupSectionNavigation(settings.SectionNavigationStyle) setupSectionNavigation(settings.SectionNavigationStyle)
window.restBaseUrl = settings.Rest window.restBaseUrl = settings.Rest
@ -111,6 +113,12 @@ function processWebuiSettingsJson (settings) {
document.querySelector('footer[title="footer"]').style.display = 'none' document.querySelector('footer[title="footer"]').style.display = 'none'
} }
if (settings.StyleMods != null) {
for (const style of settings.StyleMods) {
document.body.classList.add(style)
}
}
if (settings.EnableCustomJs) { if (settings.EnableCustomJs) {
const script = document.createElement('script') const script = document.createElement('script')
script.src = './custom-webui/custom.js' script.src = './custom-webui/custom.js'
@ -136,8 +144,6 @@ function processWebuiSettingsJson (settings) {
loginForm.processLocalLogin(settings.AuthLocalLogin) loginForm.processLocalLogin(settings.AuthLocalLogin)
document.getElementsByTagName('main')[0].appendChild(loginForm) document.getElementsByTagName('main')[0].appendChild(loginForm)
window.settings = settings
} }
function processAdditionalLinks (links) { function processAdditionalLinks (links) {

View File

@ -599,6 +599,16 @@ label.input-with-icons button {
transition: color .3s ease; transition: color .3s ease;
} }
.sm-side-icons action-button button {
display: flex;
flex-direction: row;
align-items: center;
}
.sm-imageicons-fullwidth action-button button .icon img {
width: 100%;
}
label.input-with-icons button:disabled { label.input-with-icons button:disabled {
display: none; display: none;
} }