reduce bytes used on semrush

This commit is contained in:
Azareal 2020-03-14 12:09:18 +10:00
parent 4d8858b846
commit 8d19048c0d
4 changed files with 5 additions and 3 deletions

View File

@ -56,7 +56,7 @@ var ErrNoRows = sql.ErrNoRows
// TODO: Make this more customisable
var SpammyDomainBits = []string{"porn", "sex", "lesbian", "acup", "nude", "milf", "tits", "vape", "busty", "kink", "lingerie", "strapon", "problog", "fet", "xblog", "blogin", "blognetwork", "relayblog"}
var Chrome, Firefox int // ! Temporary Hack for http push
var Chrome, Firefox, Semrush int // ! Temporary Hack for http push and stopping semrush from wasting resources
type StringList []string

View File

@ -789,6 +789,7 @@ func init() {
co.SetReverseOSMapEnum(reverseOSMapEnum)
c.Chrome = agentMapEnum["chrome"]
c.Firefox = agentMapEnum["firefox"]
c.Semrush = agentMapEnum["semrush"]
}
type WriterIntercept struct {

View File

@ -470,6 +470,7 @@ func init() {
co.SetReverseOSMapEnum(reverseOSMapEnum)
c.Chrome = agentMapEnum["chrome"]
c.Firefox = agentMapEnum["firefox"]
c.Semrush = agentMapEnum["semrush"]
}
type WriterIntercept struct {

View File

@ -119,7 +119,7 @@ func FootHeaders(w http.ResponseWriter, header *c.Header) {
func renderTemplate3(tmplName, hookName string, w http.ResponseWriter, r *http.Request, h *c.Header, pi interface{}) error {
s := h.Stylesheets
h.Stylesheets = nil
if r.FormValue("i") != "1" {
if r.FormValue("i") != "1" && h.CurrentUser.LastAgent != c.Semrush {
c.PrepResources(&h.CurrentUser, h, h.Theme)
for _, ss := range s {
h.Stylesheets = append(h.Stylesheets, ss)
@ -131,7 +131,7 @@ func renderTemplate3(tmplName, hookName string, w http.ResponseWriter, r *http.R
h.CurrentUser.LastAgent = 0
}
if h.CurrentUser.Loggedin {
if h.CurrentUser.Loggedin || h.CurrentUser.LastAgent == c.Semrush {
h.MetaDesc = ""
h.OGDesc = ""
} else if h.MetaDesc != "" && h.OGDesc == "" {