mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
WebUI branding: remove unused login_image_path from config
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
d1e0560d28
commit
6c94173ca1
5 changed files with 2 additions and 23 deletions
|
@ -1650,12 +1650,6 @@ func getHTTPDUIBrandingFromEnv(prefix string, branding httpd.UIBranding) (httpd.
|
||||||
isSet = true
|
isSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
loginImagePath, ok := os.LookupEnv(fmt.Sprintf("%s__LOGIN_IMAGE_PATH", prefix))
|
|
||||||
if ok {
|
|
||||||
branding.LoginImagePath = loginImagePath
|
|
||||||
isSet = true
|
|
||||||
}
|
|
||||||
|
|
||||||
disclaimerName, ok := os.LookupEnv(fmt.Sprintf("%s__DISCLAIMER_NAME", prefix))
|
disclaimerName, ok := os.LookupEnv(fmt.Sprintf("%s__DISCLAIMER_NAME", prefix))
|
||||||
if ok {
|
if ok {
|
||||||
branding.DisclaimerName = disclaimerName
|
branding.DisclaimerName = disclaimerName
|
||||||
|
|
|
@ -1207,7 +1207,6 @@ func TestHTTPDBindingsFromEnv(t *testing.T) {
|
||||||
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__EXTRA_CSS__1__PATH", "path2")
|
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__EXTRA_CSS__1__PATH", "path2")
|
||||||
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__FAVICON_PATH", "favicon.ico")
|
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__FAVICON_PATH", "favicon.ico")
|
||||||
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__LOGO_PATH", "logo.png")
|
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__LOGO_PATH", "logo.png")
|
||||||
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__LOGIN_IMAGE_PATH", "login_image.png")
|
|
||||||
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DISCLAIMER_NAME", "disclaimer")
|
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DISCLAIMER_NAME", "disclaimer")
|
||||||
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__DISCLAIMER_PATH", "disclaimer.html")
|
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__DISCLAIMER_PATH", "disclaimer.html")
|
||||||
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DEFAULT_CSS", "default.css")
|
os.Setenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DEFAULT_CSS", "default.css")
|
||||||
|
@ -1272,7 +1271,6 @@ func TestHTTPDBindingsFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__EXTRA_CSS__1__PATH")
|
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__EXTRA_CSS__1__PATH")
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__FAVICON_PATH")
|
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__FAVICON_PATH")
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__LOGO_PATH")
|
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__LOGO_PATH")
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__LOGIN_IMAGE_PATH")
|
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DISCLAIMER_NAME")
|
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DISCLAIMER_NAME")
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__DISCLAIMER_PATH")
|
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_ADMIN__DISCLAIMER_PATH")
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DEFAULT_CSS")
|
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__BRANDING__WEB_CLIENT__DEFAULT_CSS")
|
||||||
|
@ -1380,7 +1378,6 @@ func TestHTTPDBindingsFromEnv(t *testing.T) {
|
||||||
require.Equal(t, "same-origin", bindings[2].Security.CrossOriginOpenerPolicy)
|
require.Equal(t, "same-origin", bindings[2].Security.CrossOriginOpenerPolicy)
|
||||||
require.Equal(t, "favicon.ico", bindings[2].Branding.WebAdmin.FaviconPath)
|
require.Equal(t, "favicon.ico", bindings[2].Branding.WebAdmin.FaviconPath)
|
||||||
require.Equal(t, "logo.png", bindings[2].Branding.WebClient.LogoPath)
|
require.Equal(t, "logo.png", bindings[2].Branding.WebClient.LogoPath)
|
||||||
require.Equal(t, "login_image.png", bindings[2].Branding.WebAdmin.LoginImagePath)
|
|
||||||
require.Equal(t, "disclaimer", bindings[2].Branding.WebClient.DisclaimerName)
|
require.Equal(t, "disclaimer", bindings[2].Branding.WebClient.DisclaimerName)
|
||||||
require.Equal(t, "disclaimer.html", bindings[2].Branding.WebAdmin.DisclaimerPath)
|
require.Equal(t, "disclaimer.html", bindings[2].Branding.WebAdmin.DisclaimerPath)
|
||||||
require.Equal(t, []string{"default.css"}, bindings[2].Branding.WebClient.DefaultCSS)
|
require.Equal(t, []string{"default.css"}, bindings[2].Branding.WebClient.DefaultCSS)
|
||||||
|
|
|
@ -398,8 +398,6 @@ type UIBranding struct {
|
||||||
// For example, if you create a directory named "branding" inside the static dir and
|
// For example, if you create a directory named "branding" inside the static dir and
|
||||||
// put the "mylogo.png" file in it, you must set "/branding/mylogo.png" as logo path.
|
// put the "mylogo.png" file in it, you must set "/branding/mylogo.png" as logo path.
|
||||||
LogoPath string `json:"logo_path" mapstructure:"logo_path"`
|
LogoPath string `json:"logo_path" mapstructure:"logo_path"`
|
||||||
// Path to the image to show on the login screen relative to "static_files_path"
|
|
||||||
LoginImagePath string `json:"login_image_path" mapstructure:"login_image_path"`
|
|
||||||
// Path to your favicon relative to "static_files_path"
|
// Path to your favicon relative to "static_files_path"
|
||||||
FaviconPath string `json:"favicon_path" mapstructure:"favicon_path"`
|
FaviconPath string `json:"favicon_path" mapstructure:"favicon_path"`
|
||||||
// DisclaimerName defines the name for the link to your optional disclaimer
|
// DisclaimerName defines the name for the link to your optional disclaimer
|
||||||
|
@ -420,11 +418,6 @@ func (b *UIBranding) check() {
|
||||||
} else {
|
} else {
|
||||||
b.LogoPath = "/img/logo.png"
|
b.LogoPath = "/img/logo.png"
|
||||||
}
|
}
|
||||||
if b.LoginImagePath != "" {
|
|
||||||
b.LoginImagePath = util.CleanPath(b.LoginImagePath)
|
|
||||||
} else {
|
|
||||||
b.LoginImagePath = "/img/login_image.png"
|
|
||||||
}
|
|
||||||
if b.FaviconPath != "" {
|
if b.FaviconPath != "" {
|
||||||
b.FaviconPath = util.CleanPath(b.FaviconPath)
|
b.FaviconPath = util.CleanPath(b.FaviconPath)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -331,7 +331,6 @@ func TestBrandingValidation(t *testing.T) {
|
||||||
Branding: Branding{
|
Branding: Branding{
|
||||||
WebAdmin: UIBranding{
|
WebAdmin: UIBranding{
|
||||||
LogoPath: "path1",
|
LogoPath: "path1",
|
||||||
LoginImagePath: "login1.png",
|
|
||||||
DefaultCSS: []string{"my.css"},
|
DefaultCSS: []string{"my.css"},
|
||||||
},
|
},
|
||||||
WebClient: UIBranding{
|
WebClient: UIBranding{
|
||||||
|
@ -344,12 +343,10 @@ func TestBrandingValidation(t *testing.T) {
|
||||||
b.checkBranding()
|
b.checkBranding()
|
||||||
assert.Equal(t, "/favicon.ico", b.Branding.WebAdmin.FaviconPath)
|
assert.Equal(t, "/favicon.ico", b.Branding.WebAdmin.FaviconPath)
|
||||||
assert.Equal(t, "/path1", b.Branding.WebAdmin.LogoPath)
|
assert.Equal(t, "/path1", b.Branding.WebAdmin.LogoPath)
|
||||||
assert.Equal(t, "/login1.png", b.Branding.WebAdmin.LoginImagePath)
|
|
||||||
assert.Equal(t, []string{"/my.css"}, b.Branding.WebAdmin.DefaultCSS)
|
assert.Equal(t, []string{"/my.css"}, b.Branding.WebAdmin.DefaultCSS)
|
||||||
assert.Len(t, b.Branding.WebAdmin.ExtraCSS, 0)
|
assert.Len(t, b.Branding.WebAdmin.ExtraCSS, 0)
|
||||||
assert.Equal(t, "/favicon1.ico", b.Branding.WebClient.FaviconPath)
|
assert.Equal(t, "/favicon1.ico", b.Branding.WebClient.FaviconPath)
|
||||||
assert.Equal(t, path.Join(webStaticFilesPath, "/path2"), b.Branding.WebClient.DisclaimerPath)
|
assert.Equal(t, path.Join(webStaticFilesPath, "/path2"), b.Branding.WebClient.DisclaimerPath)
|
||||||
assert.Equal(t, "/img/login_image.png", b.Branding.WebClient.LoginImagePath)
|
|
||||||
if assert.Len(t, b.Branding.WebClient.ExtraCSS, 1) {
|
if assert.Len(t, b.Branding.WebClient.ExtraCSS, 1) {
|
||||||
assert.Equal(t, "/1.css", b.Branding.WebClient.ExtraCSS[0])
|
assert.Equal(t, "/1.css", b.Branding.WebClient.ExtraCSS[0])
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,6 @@
|
||||||
"short_name": "",
|
"short_name": "",
|
||||||
"favicon_path": "",
|
"favicon_path": "",
|
||||||
"logo_path": "",
|
"logo_path": "",
|
||||||
"login_image_path": "",
|
|
||||||
"disclaimer_name": "",
|
"disclaimer_name": "",
|
||||||
"disclaimer_path": "",
|
"disclaimer_path": "",
|
||||||
"default_css": [],
|
"default_css": [],
|
||||||
|
@ -330,7 +329,6 @@
|
||||||
"short_name": "",
|
"short_name": "",
|
||||||
"favicon_path": "",
|
"favicon_path": "",
|
||||||
"logo_path": "",
|
"logo_path": "",
|
||||||
"login_image_path": "",
|
|
||||||
"disclaimer_name": "",
|
"disclaimer_name": "",
|
||||||
"disclaimer_path": "",
|
"disclaimer_path": "",
|
||||||
"default_css": [],
|
"default_css": [],
|
||||||
|
|
Loading…
Reference in a new issue