Using latest fayec which only sends events to the explicit user with matching token
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Brandon Watson 2023-09-21 11:58:36 -05:00
parent 5e71ad974c
commit d4e7152dde
4 changed files with 22 additions and 24 deletions

4
go.mod
View File

@ -14,8 +14,8 @@ require (
require go.mau.fi/util v0.0.0-20230805171708-199bf3eec776
require (
gitea.watsonlabs.net/watsonb8/fayec v0.0.3 // indirect
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.3 // indirect
gitea.watsonlabs.net/watsonb8/fayec v0.0.4 // indirect
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect

6
go.sum
View File

@ -8,6 +8,8 @@ gitea.watsonlabs.net/watsonb8/fayec v0.0.2 h1:tqbgr1vRZ6Wq4W81xBg+FTOywSv3EJpK26
gitea.watsonlabs.net/watsonb8/fayec v0.0.2/go.mod h1:gv8CWMq6dFJQhH30u8bO3u4k2irKlclZktLNYDebQ/0=
gitea.watsonlabs.net/watsonb8/fayec v0.0.3 h1:YpaZBIee8Ix6uGm1UoEtBix1dEU1TURChAsJGJ3pVRo=
gitea.watsonlabs.net/watsonb8/fayec v0.0.3/go.mod h1:gv8CWMq6dFJQhH30u8bO3u4k2irKlclZktLNYDebQ/0=
gitea.watsonlabs.net/watsonb8/fayec v0.0.4 h1:SLvwip1DQy13QngVsEgoLtN7T6bS+X6348p6PQhUF2A=
gitea.watsonlabs.net/watsonb8/fayec v0.0.4/go.mod h1:gv8CWMq6dFJQhH30u8bO3u4k2irKlclZktLNYDebQ/0=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.2.1-0.20230919023741-5727a20506fa h1:dFNaDeztJzo26t7URiOvaWNUDxve80tAAEHTKpi5JEk=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.2.1-0.20230919023741-5727a20506fa/go.mod h1:QRCibl6Tpr/uBtXD46qXqEkxqR5tQa5vdw+0j7hn+Mw=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.0 h1:Uz5TIIF9tFf0LYEbCJqP8axufdBfsVorAYOaal2NmPw=
@ -18,6 +20,10 @@ gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.2 h1:QJLwAqYoIxhTtZIzMsjZGiLcml6N
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.2/go.mod h1:htgKMGvk2QieyYT69DWnTLABFc/6ttMlIRIr6zPXNfo=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.3 h1:sBmF/10Zk0iyKs1nakHfOeB9BUoSyemCpDUEux+BpMk=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.3/go.mod h1:htgKMGvk2QieyYT69DWnTLABFc/6ttMlIRIr6zPXNfo=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.4 h1:RnvQlgcBIyTSnrG7E311Zuy/A3avSuBYUb8lDN9sw5Q=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.4/go.mod h1:htgKMGvk2QieyYT69DWnTLABFc/6ttMlIRIr6zPXNfo=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.5 h1:J8r/xl8mcQ5mkR/3+gWxu0WdD4CecX42iqB+GLRhNt4=
gitea.watsonlabs.net/watsonb8/groupme-lib v0.3.5/go.mod h1:3tsM98NYRgbrGrHokW/FYSoETCIaZVhfV+UGcDymQGg=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=

View File

@ -143,12 +143,10 @@ func (portal *Portal) SyncDM(user *User, dm *groupme.Chat) {
}
portal.log.Infoln("Syncing portal for", user.MXID)
go func() {
err := user.Conn.SubscribeToDM(context.TODO(), dm.LastMessage.ConversationID, user.Token)
if err != nil {
portal.log.Errorln("Subscribing failed, live metadata updates won't work", err)
}
}()
err := user.Conn.SubscribeToDM(context.TODO(), dm.LastMessage.ConversationID, user.Token)
if err != nil {
portal.log.Errorln("Subscribing failed, live metadata updates won't work", err)
}
if len(portal.MXID) == 0 {
puppet := portal.bridge.GetPuppetByGMID(portal.Key.GMID)
@ -206,12 +204,10 @@ func (portal *Portal) SyncGroup(user *User, group *groupme.Group) {
}
portal.log.Infoln("Syncing portal for", user.MXID)
go func() {
err := user.Conn.SubscribeToGroup(context.TODO(), portal.Key.GMID, user.Token)
if err != nil {
portal.log.Errorln("Subscribing failed, live metadata updates won't work", err)
}
}()
err := user.Conn.SubscribeToGroup(context.TODO(), portal.Key.GMID, user.Token)
if err != nil {
portal.log.Errorln("Subscribing failed, live metadata updates won't work", err)
}
if len(portal.MXID) == 0 {
portal.Name = group.Name

16
user.go
View File

@ -269,7 +269,7 @@ func (user *User) Connect(gmClient *groupmeext.Client, pushSub *groupme.PushSubs
user.GMID = myuser.ID
}
user.Conn.AddFullHandler(user)
user.Conn.AddFullHandler(user, user.Token)
//TODO: typing notification?
return user.RestoreSession()
@ -277,15 +277,11 @@ func (user *User) Connect(gmClient *groupmeext.Client, pushSub *groupme.PushSubs
func (user *User) RestoreSession() bool {
if len(user.Token) > 0 {
go func() {
err := user.Conn.SubscribeToUser(context.TODO(), user.GMID, user.Token)
if err != nil {
fmt.Println(err)
}
}()
//if err != nil {
// fmt.Println(err)
//}
err := user.Conn.SubscribeToUser(context.TODO(), user.GMID, user.Token)
if err != nil {
fmt.Println(err)
}
//TODO: typing notifics
user.ConnectionErrors = 0