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.
This commit is contained in:
Azareal 2019-05-18 11:18:19 +10:00
parent b44f7bc157
commit bf0adeb8c6
4 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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
}

View File

@ -344,7 +344,7 @@
transform: translate(-100%) rotate(-45deg);
white-space: nowrap;
}*/
.timeRangeSelector {
.analytics .colstack_head select {
margin-top: -5px;
}
.colstack_graph_holder + .rowlist {

View File

@ -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;