diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html index 366e101..ae1c433 100644 --- a/res/template/file_viewer.html +++ b/res/template/file_viewer.html @@ -154,6 +154,10 @@ + {{ else if eq .Other.AdType 6}} +
+ {{ else if eq .Other.AdType 7}} + {{end}} {{end}} @@ -248,9 +252,25 @@ {{template "analytics"}} - {{ if .Other.ShowAds }}{{ if eq .Other.AdType 5 }} + {{ if .Other.ShowAds }} + {{ if eq .Other.AdType 5 }} - {{ end }}{{ end }} + {{ else if eq .Other.AdType 6}} + + + + {{ end }} + {{ end }} {{end}} diff --git a/res/template/fragments/revenuehits.html b/res/template/fragments/revenuehits.html new file mode 100644 index 0000000..db8a768 --- /dev/null +++ b/res/template/fragments/revenuehits.html @@ -0,0 +1,16 @@ +{{ define "revenuehits" }} + + + Ad Banner + + + + + + +{{ end }} diff --git a/webcontroller/file_viewer.go b/webcontroller/file_viewer.go index 4c3297d..4a3d7ad 100644 --- a/webcontroller/file_viewer.go +++ b/webcontroller/file_viewer.go @@ -33,25 +33,31 @@ 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(8) + i = rand.Intn(5) - // The return value corresponds to the type of ad shown: - // 0: A-ads - // 1: Amarula Electronics - // 2: Patreon - // 3: Soul Studio Yoga - // 4: Amarula Solutions - // 5: Ad-Maven + const ( + aAds = 0 + amarulaElectronics = 1 + patreon = 2 + soulStudio = 3 + amarulaSolutions = 4 + adMaven = 5 + mediaNet = 6 + revenueHits = 7 + ) switch i { - case 0, 1, 2: // 3/8 of the traffic - return 4 // Amarula solutions + case 0, 1: + return amarulaSolutions - case 3, 4, 5, 6: // 4/8 of the traffic - return 5 // Ad-Maven + case 2: + return adMaven - case 7: // 1/8 of traffic - return 2 // Patreon + case 3: + return mediaNet + + case 4: + return revenueHits default: panic(fmt.Errorf( diff --git a/webcontroller/web_controller.go b/webcontroller/web_controller.go index 3e7f4e3..5afcae6 100644 --- a/webcontroller/web_controller.go +++ b/webcontroller/web_controller.go @@ -149,8 +149,9 @@ func New( {PST, "admin/abuse" /* */, wc.serveForm(wc.adminAbuseForm, true)}, // Advertising related - {GET, "click/:id" /* */, wc.serveAdClick}, - {GET, "campaign/:id" /**/, wc.serveCampaignPartner}, + {GET, "click/:id" /* */, wc.serveAdClick}, + {GET, "campaign/:id" /* */, wc.serveCampaignPartner}, + {GET, "ad/revenuehits" /**/, wc.serveTemplate("revenuehits", false)}, } { r.Handle(h.method, prefix+"/"+h.path, h.handler) }