From bf0adeb8c6d05f6f9b795a65971910c2752ebe16 Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 18 May 2019 11:18:19 +1000 Subject: [PATCH] Move SpammyDomainBits into common.go Fix the little UI issues from adding the adjacent select in the referrer pane. Add a few more spammy domain bits. --- common/common.go | 3 +++ routes/panel/analytics.go | 4 +--- themes/cosora/public/panel.css | 2 +- themes/shadow/public/panel.css | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/common.go b/common/common.go index 718e2de3..ec995ae7 100644 --- a/common/common.go +++ b/common/common.go @@ -48,6 +48,9 @@ var ExternalSites = map[string]string{ "YT": "https://www.youtube.com/", } +// TODO: Make this more customisable +var SpammyDomainBits = []string{"porn", "sexy", "lesbian", "acup"} + type StringList []string // ? - Should we allow users to upload .php or .go files? It could cause security issues. We could store them with a mangled extension to render them inert diff --git a/routes/panel/analytics.go b/routes/panel/analytics.go index cd495dfa..7dc1bbd6 100644 --- a/routes/panel/analytics.go +++ b/routes/panel/analytics.go @@ -1037,8 +1037,6 @@ func AnalyticsLanguages(w http.ResponseWriter, r *http.Request, user c.User) c.R return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage, "panel_analytics_right", "analytics", "panel_analytics_langs", pi}) } -var spamDomains = []string{"porn", "sexy"} - func AnalyticsReferrers(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError { basePage, ferr := buildBasePage(w, r, &user, "analytics", "analytics") if ferr != nil { @@ -1060,7 +1058,7 @@ func AnalyticsReferrers(w http.ResponseWriter, r *http.Request, user c.User) c.R showSpam := r.FormValue("spam") == "1" var isSpammy = func(domain string) bool { - for _, substr := range spamDomains { + for _, substr := range c.SpammyDomainBits { if strings.Contains(domain, substr) { return true } diff --git a/themes/cosora/public/panel.css b/themes/cosora/public/panel.css index 44a1eda8..3bd98d30 100644 --- a/themes/cosora/public/panel.css +++ b/themes/cosora/public/panel.css @@ -344,7 +344,7 @@ transform: translate(-100%) rotate(-45deg); white-space: nowrap; }*/ -.timeRangeSelector { +.analytics .colstack_head select { margin-top: -5px; } .colstack_graph_holder + .rowlist { diff --git a/themes/shadow/public/panel.css b/themes/shadow/public/panel.css index 47725998..d972beb1 100644 --- a/themes/shadow/public/panel.css +++ b/themes/shadow/public/panel.css @@ -23,7 +23,7 @@ .analytics .colstack_head:first-child { padding-bottom: 4px; } -.timeRangeSelector { +.analytics .colstack_head select { padding: 2px; margin-top: -3px; margin-bottom: -3px;