From 748af7172ce96f0b66c394e88839bd57c194ffc7 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Thu, 28 Dec 2023 10:52:40 +0200 Subject: [PATCH] feat: allow setting theme via cli (#2881) --- cmd/config.go | 2 ++ cmd/config_init.go | 1 + cmd/config_set.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/cmd/config.go b/cmd/config.go index 4287f3c2..ed3cc772 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -42,6 +42,7 @@ func addConfigFlags(flags *pflag.FlagSet) { flags.String("recaptcha.secret", "", "ReCaptcha secret") flags.String("branding.name", "", "replace 'File Browser' by this name") + flags.String("branding.theme", "", "set the theme") flags.String("branding.color", "", "set the theme color") flags.String("branding.files", "", "path to directory with images and custom styles") flags.Bool("branding.disableExternal", false, "disable external links such as GitHub links") @@ -150,6 +151,7 @@ func printSettings(ser *settings.Server, set *settings.Settings, auther auth.Aut fmt.Fprintf(w, "\tDisable external links:\t%t\n", set.Branding.DisableExternal) fmt.Fprintf(w, "\tDisable used disk percentage graph:\t%t\n", set.Branding.DisableUsedPercentage) fmt.Fprintf(w, "\tColor:\t%s\n", set.Branding.Color) + fmt.Fprintf(w, "\tTheme:\t%s\n", set.Branding.Theme) fmt.Fprintln(w, "\nServer:") fmt.Fprintf(w, "\tLog:\t%s\n", ser.Log) fmt.Fprintf(w, "\tPort:\t%s\n", ser.Port) diff --git a/cmd/config_init.go b/cmd/config_init.go index 22d628a1..7d183368 100644 --- a/cmd/config_init.go +++ b/cmd/config_init.go @@ -38,6 +38,7 @@ override the options.`, Name: mustGetString(flags, "branding.name"), DisableExternal: mustGetBool(flags, "branding.disableExternal"), DisableUsedPercentage: mustGetBool(flags, "branding.disableUsedPercentage"), + Theme: mustGetString(flags, "branding.theme"), Files: mustGetString(flags, "branding.files"), }, } diff --git a/cmd/config_set.go b/cmd/config_set.go index 5a02288f..ba800adb 100644 --- a/cmd/config_set.go +++ b/cmd/config_set.go @@ -53,6 +53,8 @@ you want to change. Other options will remain unchanged.`, set.Branding.Name = mustGetString(flags, flag.Name) case "branding.color": set.Branding.Color = mustGetString(flags, flag.Name) + case "branding.theme": + set.Branding.Theme = mustGetString(flags, flag.Name) case "branding.disableExternal": set.Branding.DisableExternal = mustGetBool(flags, flag.Name) case "branding.disableUsedPercentage":