From cddc0c568ccd456806e081928183785607631744 Mon Sep 17 00:00:00 2001 From: Charles-Antoine Mathieu Date: Wed, 18 Nov 2020 10:15:42 +0100 Subject: [PATCH 1/2] Abuse contact footer #341 --- server/common/config.go | 1 + server/plikd.cfg | 1 + webapp/css/style.css | 10 ++++++++++ webapp/index.html | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/server/common/config.go b/server/common/config.go index 62104f76..c5758b0d 100644 --- a/server/common/config.go +++ b/server/common/config.go @@ -42,6 +42,7 @@ type Configuration struct { NoWebInterface bool `json:"-"` DownloadDomain string `json:"downloadDomain"` EnhancedWebSecurity bool `json:"-"` + AbuseContact string `json:"abuseContact"` SourceIPHeader string `json:"-"` UploadWhitelist []string `json:"-"` diff --git a/server/plikd.cfg b/server/plikd.cfg index 812b2fcb..c621310f 100644 --- a/server/plikd.cfg +++ b/server/plikd.cfg @@ -25,6 +25,7 @@ SslKey = "plik.key" # Path to your certificate private key file NoWebInterface = false # Disable web user interface DownloadDomain = "" # Enforce download domain ( ex : https://dl.plik.root.gg ) ( necessary for quick upload to work ) EnhancedWebSecurity = false # Enable additional security headers ( X-Content-Type-Options, X-XSS-Protection, X-Frame-Options, Content-Security-Policy, Secure Cookies, ... ) +AbuseContact = "" # Abuse contact to be displayed in the footer of the webapp ( email address ) SourceIpHeader = "" # If behind reverse proxy ( ex : X-FORWARDED-FOR ) UploadWhitelist = [] # Restrict upload ans user creation to one or more IP range ( CIDR notation, /32 can be omitted ) diff --git a/webapp/css/style.css b/webapp/css/style.css index 26210708..005629ca 100644 --- a/webapp/css/style.css +++ b/webapp/css/style.css @@ -89,6 +89,16 @@ header a:hover, header a:visited, header a:link, header a:active { text-decoration: none; } +footer { + position: absolute; + bottom: 0; + width: 100%; + /* Set the fixed height of the footer here */ + height: 50px; + color: #FFFFFF; + font-family: 'Courgette', sans-serif; +} + .header-right { margin-right: 20px; } diff --git a/webapp/index.html b/webapp/index.html index d69ac0e9..69cf8160 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -50,6 +50,12 @@

Plik

+ + From dd6f177611a74042fd4a97400a305d2b1cc93b5d Mon Sep 17 00:00:00 2001 From: Charles-Antoine Mathieu Date: Wed, 18 Nov 2020 10:34:31 +0100 Subject: [PATCH 2/2] Fix MaxTTL config check and missing exit on invalid config #342 --- server/cmd/root.go | 1 + server/common/config.go | 2 +- server/common/config_test.go | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/server/cmd/root.go b/server/cmd/root.go index 7bdc450a..28198064 100644 --- a/server/cmd/root.go +++ b/server/cmd/root.go @@ -97,6 +97,7 @@ func initConfig() { config, err = common.LoadConfiguration(configPath) if err != nil { fmt.Printf("Unable to load config : %s\n", err) + os.Exit(1) } } diff --git a/server/common/config.go b/server/common/config.go index c5758b0d..4b89ca7f 100644 --- a/server/common/config.go +++ b/server/common/config.go @@ -183,7 +183,7 @@ func (config *Configuration) Initialize() (err error) { } } - if config.DefaultTTL > config.MaxTTL { + if config.MaxTTL > 0 && config.DefaultTTL > 0 && config.MaxTTL < config.DefaultTTL { return fmt.Errorf("DefaultTTL should not be more than MaxTTL") } diff --git a/server/common/config_test.go b/server/common/config_test.go index 482b2adc..618469d0 100644 --- a/server/common/config_test.go +++ b/server/common/config_test.go @@ -103,6 +103,15 @@ func TestInitializeInvalidDefaultTTL(t *testing.T) { require.Error(t, err, "able to initialize invalid config") } +func TestInitializeInfiniteMaxTTL(t *testing.T) { + config := NewConfiguration() + config.DefaultTTL = 10 * 86400 + config.MaxTTL = -1 + + err := config.Initialize() + require.NoError(t, err, "unable to initialize valid config") +} + func TestDisableAutoClean(t *testing.T) { config := NewConfiguration() require.True(t, config.IsAutoClean(), "invalid auto clean status")