[WIP] Fix ban by software version, some other under-hood changes

- Use updated version of upstream go-xmpp + fixes on client-side
- Still waiting for https://github.com/xmppo/go-xmpp/pull/215
- Introduce golangci-lint v2 + fixes
This commit is contained in:
eleksir
2025-11-30 14:19:01 +03:00
parent a128b473ff
commit 7dbd246a5c
51 changed files with 3868 additions and 13145 deletions

View File

@@ -9,7 +9,7 @@ import (
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/eleksir/go-xmpp"
"github.com/xmppo/go-xmpp"
)
// BunyPresense производит проверку по бело-чёрным спискам. Если presence пришёл от злодея (из чёрного списка), то
@@ -419,21 +419,22 @@ func (j *Jabber) BunySoftwareVersion(v xmpp.IQ, ver IqResultSoftwareVersion) err
_ = json.Unmarshal([]byte(presenceJSONString), &p)
if p.Affiliation == "admin" || p.Affiliation == "owner" {
log.Infof("Skipping useragent blacklist check for %s because his affiliation is %s", v.From, p.Affiliation)
continue
}
// На всякий случай.
if p.Role == "moderator" {
log.Infof("Skipping useragent blacklist check for %s because his role is %s", v.From, p.Role)
continue
}
if v.From == p.From {
log.Errorf("Found jid of %s in presence db: %s", v.From, p.JID)
log.Infof("Found jid of %s in presence db: %s", v.From, p.JID)
if p.Affiliation == "admin" || p.Affiliation == "owner" {
log.Infof("Skipping useragent blacklist check for %s because his affiliation is %s", v.From, p.Affiliation)
continue
}
// На всякий случай.
if p.Role == "moderator" {
log.Infof("Skipping useragent blacklist check for %s because his role is %s", v.From, p.Role)
continue
}
// Lookup in global blacklist.
for _, cRoom := range j.RoomsConnected {