Add relay identity management and subscription enhancements.
Some checks failed
Go / build (push) Has been cancelled
Some checks failed
Go / build (push) Has been cancelled
- Introduced relay identity management for subscriptions and follow-list sync. - Added `IdentityRequested` function to handle the `identity` subcommand. - Implemented periodic follow-list synchronization for active subscribers. - Enhanced payment handling to include payer pubkey and subscription updates. - Added trial expiry and subscription expiry notifications.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package acl
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -370,6 +371,32 @@ func (f *Follows) GetFollowedPubkeys() [][]byte {
|
||||
return followedPubkeys
|
||||
}
|
||||
|
||||
// AddFollow appends a pubkey to the in-memory follows list if not already present
|
||||
// and signals the syncer to refresh subscriptions.
|
||||
func (f *Follows) AddFollow(pub []byte) {
|
||||
if len(pub) == 0 {
|
||||
return
|
||||
}
|
||||
f.followsMx.Lock()
|
||||
defer f.followsMx.Unlock()
|
||||
for _, p := range f.follows {
|
||||
if bytes.Equal(p, pub) {
|
||||
return
|
||||
}
|
||||
}
|
||||
b := make([]byte, len(pub))
|
||||
copy(b, pub)
|
||||
f.follows = append(f.follows, b)
|
||||
// notify syncer if initialized
|
||||
if f.updated != nil {
|
||||
select {
|
||||
case f.updated <- struct{}{}:
|
||||
default:
|
||||
// if channel is full or not yet listened to, ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
log.T.F("registering follows ACL")
|
||||
Registry.Register(new(Follows))
|
||||
|
||||
Reference in New Issue
Block a user