fast skip announce from rejected domains
This commit is contained in:
parent
50fb0d5e09
commit
eb3ea156a6
10
activity.go
10
activity.go
|
@ -241,14 +241,20 @@ func needxonk(user *WhatAbout, x *Honk) bool {
|
||||||
}
|
}
|
||||||
return needxonkid(user, x.XID)
|
return needxonkid(user, x.XID)
|
||||||
}
|
}
|
||||||
|
func needbonkid(user *WhatAbout, xid string) bool {
|
||||||
|
return needxonkidX(user, xid, true)
|
||||||
|
}
|
||||||
func needxonkid(user *WhatAbout, xid string) bool {
|
func needxonkid(user *WhatAbout, xid string) bool {
|
||||||
|
return needxonkidX(user, xid, false)
|
||||||
|
}
|
||||||
|
func needxonkidX(user *WhatAbout, xid string, isannounce bool) bool {
|
||||||
if !strings.HasPrefix(xid, "https://") {
|
if !strings.HasPrefix(xid, "https://") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(xid, user.URL+"/") {
|
if strings.HasPrefix(xid, user.URL+"/") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if rejectorigin(user.ID, xid) {
|
if rejectorigin(user.ID, xid, isannounce) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if iszonked(user.ID, xid) {
|
if iszonked(user.ID, xid) {
|
||||||
|
@ -504,7 +510,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
} else {
|
} else {
|
||||||
xid, _ = item.GetString("object")
|
xid, _ = item.GetString("object")
|
||||||
}
|
}
|
||||||
if !needxonkid(user, xid) {
|
if !needbonkid(user, xid) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
log.Printf("getting bonk: %s", xid)
|
log.Printf("getting bonk: %s", xid)
|
||||||
|
|
15
hfcs.go
15
hfcs.go
|
@ -169,15 +169,24 @@ func getfilters(userid int64, scope filtType) []*Filter {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func rejectorigin(userid int64, origin string) bool {
|
func rejectorigin(userid int64, origin string, isannounce bool) bool {
|
||||||
if o := originate(origin); o != "" {
|
if o := originate(origin); o != "" {
|
||||||
origin = o
|
origin = o
|
||||||
}
|
}
|
||||||
filts := getfilters(userid, filtReject)
|
filts := getfilters(userid, filtReject)
|
||||||
for _, f := range filts {
|
for _, f := range filts {
|
||||||
if f.IsAnnounce || f.Text != "" {
|
if f.Text != "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if f.IsAnnounce {
|
||||||
|
if !isannounce {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if f.AnnounceOf == origin {
|
||||||
|
log.Printf("rejecting announce: %s", origin)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
if f.Actor == origin {
|
if f.Actor == origin {
|
||||||
log.Printf("rejecting origin: %s", origin)
|
log.Printf("rejecting origin: %s", origin)
|
||||||
return true
|
return true
|
||||||
|
@ -205,7 +214,7 @@ func stealthmode(userid int64, r *http.Request) bool {
|
||||||
agent := r.UserAgent()
|
agent := r.UserAgent()
|
||||||
agent = originate(agent)
|
agent = originate(agent)
|
||||||
if agent != "" {
|
if agent != "" {
|
||||||
fake := rejectorigin(userid, agent)
|
fake := rejectorigin(userid, agent, false)
|
||||||
if fake {
|
if fake {
|
||||||
log.Printf("faking 404 for %s", agent)
|
log.Printf("faking 404 for %s", agent)
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue