Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abuse contact footer #341 #343

Merged
merged 2 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
3 changes: 2 additions & 1 deletion server/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"-"`
Expand Down Expand Up @@ -182,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")
}

Expand Down
9 changes: 9 additions & 0 deletions server/common/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions server/plikd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
10 changes: 10 additions & 0 deletions webapp/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ <h1><a href="#/_">Plik</a></h1>

<!-- ANGULARJS VIEW -->
<div ng-view class="container-fluid"></div>

<footer class="footer" ng-controller="MenuCtrl">
<div ng-if="config.abuseContact" class="container text-center">
<p>For abuse contact {{config.abuseContact}}</p>
</div>
</footer>
</div>
</div>

Expand Down