Link brave directly to referral link

This commit is contained in:
2021-06-29 12:08:31 +02:00
parent 4d140ad5a2
commit 887f055d67
4 changed files with 7 additions and 6 deletions

View File

@@ -51,7 +51,7 @@
</script> </script>
</div> </div>
{{ else if eq .Other.AdBannerType 7 }} {{ else if eq .Other.AdBannerType 7 }}
<a class="sponsors_banner" style="display: inline-block; width: 728px; height: 90px;" href="/brave"> <a class="sponsors_banner" style="display: inline-block; width: 728px; height: 90px;" href="/click/MdUXxSov?target=https%3A%2F%2Fbrave.com%2Fpix009">
<img src="/res/img/misc/brave-728x90.png" style="width: 100%; height: 100%" /> <img src="/res/img/misc/brave-728x90.png" style="width: 100%; height: 100%" />
</a> </a>
{{ else if eq .Other.AdBannerType 8 }} {{ else if eq .Other.AdBannerType 8 }}

View File

@@ -78,10 +78,10 @@ func (vd *viewerData) adType(files []pixelapi.ListFile) {
// Intn returns a number up to n, but never n itself. So to get a random 0 // 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 // or 1 we need to give it n=2. We can use this function to make other
// splits like 1/3 1/4, etc // splits like 1/3 1/4, etc
switch i := rand.Intn(4); i { switch i := rand.Intn(8); i {
case 0: // 25% case 0: // 12.5%
vd.AdBannerType = brave vd.AdBannerType = brave
case 1, 2, 3: // 75% case 1, 2, 3, 4, 5, 6, 7: // 87.5%
vd.AdBannerType = aAds vd.AdBannerType = aAds
default: default:
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i)) panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))

View File

@@ -174,11 +174,12 @@ func (tm *TemplateManager) ParseTemplates(silent bool) {
} else if strings.HasSuffix(path, ".gif") { } else if strings.HasSuffix(path, ".gif") {
file = []byte("data:image/gif;base64," + base64.StdEncoding.EncodeToString(file)) file = []byte("data:image/gif;base64," + base64.StdEncoding.EncodeToString(file))
} }
// Wrap the resources in a template definition // Wrap the resources in a template definition
if _, err = tpl.Parse( if _, err = tpl.Parse(
`{{define "` + f.Name() + `"}}` + string(file) + `{{end}}`, `{{define "` + f.Name() + `"}}` + string(file) + `{{end}}`,
); err != nil { ); err != nil {
return err return fmt.Errorf("failed to parse '%s': %w", path, err)
} }
if !silent { if !silent {

View File

@@ -74,7 +74,7 @@ func New(
wc.templates.ParseTemplates(false) wc.templates.ParseTemplates(false)
if wc.hostname, err = os.Hostname(); err != nil { if wc.hostname, err = os.Hostname(); err != nil {
panic(fmt.Errorf("Could not get hostname: %s", err)) panic(fmt.Errorf("could not get hostname: %s", err))
} }
// Serve static files // Serve static files