patreon ad

This commit is contained in:
2020-06-10 18:11:00 +02:00
parent 2b06087bcc
commit 9d3af28162
2 changed files with 28 additions and 7 deletions

View File

@@ -132,6 +132,21 @@
<a class="sponsors_banner" style="display: inline-block; width: 576px; height: 96px;" href="/click/DtZ3hHT9?target=https%3A%2F%2Fwww.amarula-electronics.com/?v=79cba1185463">
<img src="/res/img/misc/banner_as.png" style="width: 100%; height: 100%" />
</a>
{{else if eq .Other.AdType 2}}
<div style="text-align: center; line-height: 22px; font-size: 18px;">
<div style="margin: 4px 8px; display: inline-block; vertical-align: middle;">
Pixeldrain needs money to survive!<br/>
<a href="https://www.patreon.com/pixeldrain" class="button button_highlight">
Support me on Patreon and get some neat perks
</a>
</div>
<div style="margin: 4px 8px; display: inline-block; vertical-align: middle; text-align: left;">
No ads when viewing files<br/>
No ads on your uploaded files<br/>
Longer file retention<br/>
</div>
<div>
{{end}}
</div>
{{end}}

View File

@@ -3,6 +3,7 @@ package webcontroller
import (
"fmt"
"io/ioutil"
"math/rand"
"mime"
"net/http"
"strconv"
@@ -32,14 +33,19 @@ func adType() (i int) {
// Intn returns a number up to n, but never n itself. So it 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
// i = rand.Intn(2)
i = rand.Intn(2)
// switch {
// case i == 1: // 50% of the traffic
return 1 // Amarula
// default:
// return 0 // A-Ads
// }
// The return value correstonds to the type of ad shown:
// 0: A-ads
// 1: Amarulasolutions
// 2: Patreon
switch i {
case 0: // 50% of the traffic
return 1
default:
return 2
}
}
type viewerData struct {