diff --git a/res/template/advertisements.html b/res/template/advertisements.html
index 28c6a7c..782c331 100644
--- a/res/template/advertisements.html
+++ b/res/template/advertisements.html
@@ -113,7 +113,20 @@
{{ end }}
- {{ if eq .Other.AdUnderType 1}}
+ {{ if eq .Other.AdPopupType 1 }}
+ {{ else if eq .Other.AdPopupType 2 }}
+
{{ end }}
{{ end }}
diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html
index 1b9a35f..d111209 100644
--- a/res/template/file_viewer.html
+++ b/res/template/file_viewer.html
@@ -143,13 +143,13 @@
{{ if and .Other.FileAdsEnabled .Other.UserAdsEnabled }}
{{ template "banner_ads" . }}
{{ else if not .Other.UserAdsEnabled }}
-
- Thank you for supporting pixeldrain!
-
+
+ Thank you for supporting pixeldrain!
+
{{ else if not .Other.FileAdsEnabled }}
-
- The uploader of this file disabled advertisements. You can do the same for
only €2 per month!
-
+
+ The uploader of this file disabled advertisements. You can do the same for
only €2 per month!
+
{{ end }}
diff --git a/webcontroller/file_viewer.go b/webcontroller/file_viewer.go
index 2c50265..069a983 100644
--- a/webcontroller/file_viewer.go
+++ b/webcontroller/file_viewer.go
@@ -30,7 +30,7 @@ type viewerData struct {
ViewToken string
AdBannerType int
AdFloaterType int
- AdUnderType int
+ AdPopupType int
FileAdsEnabled bool
UserAdsEnabled bool
Embedded bool
@@ -38,6 +38,10 @@ type viewerData struct {
}
func (vd *viewerData) adType(files []pixelapi.ListFile) {
+ if len(files) == 0 {
+ return
+ }
+
var avgSize int64
for _, v := range files {
avgSize += v.Size
@@ -67,31 +71,31 @@ func (vd *viewerData) adType(files []pixelapi.ListFile) {
adMavenFloat = 3
// Popunders
- clickAduPopunder = 1
+ clickAduPopup = 1
+ propellerPopup = 2
)
// Intn returns a number up to n, but never n itself. So to get a random 0
// or 1 we need to give it n=2. We can use this function to make other
// splits like 1/3 1/4, etc
- switch i := rand.Intn(3); i {
- case 0: // 33%
+ switch i := rand.Intn(4); i {
+ case 0: // 25%
vd.AdBannerType = clickAduBanner
- case 1: // 33%
+ case 1: // 25%
vd.AdBannerType = brave
- case 2: // 33%
+ case 2, 3: // 50%
vd.AdBannerType = aAds
default:
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))
}
- // If the file is larger than 10 MB we enable popups
+ // If the file is larger than 10 MB we enable floating popups
if avgSize > 10e6 {
vd.AdFloaterType = propellerFloat
}
- // If the file is larger than 250 MB we enable popunders
if avgSize > 250e6 {
- vd.AdUnderType = clickAduPopunder
+ vd.AdPopupType = clickAduPopup
}
}
diff --git a/webcontroller/web_controller.go b/webcontroller/web_controller.go
index 7b187aa..756657c 100644
--- a/webcontroller/web_controller.go
+++ b/webcontroller/web_controller.go
@@ -181,6 +181,7 @@ func New(
// Admin settings
{GET, "admin" /* */, wc.serveTemplate("admin", handlerOpts{Auth: true})},
+ {GET, "admin/status" /* */, wc.serveTemplate("admin", handlerOpts{Auth: true})},
{GET, "admin/abuse_reporters" /**/, wc.serveTemplate("admin", handlerOpts{Auth: true})},
{GET, "admin/abuse_reports" /* */, wc.serveTemplate("admin", handlerOpts{Auth: true})},
{GET, "admin/ip_bans" /* */, wc.serveTemplate("admin", handlerOpts{Auth: true})},