this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

automod: private admin state hydration

+39 -3
+20 -2
automod/account_meta.go
··· 6 6 "fmt" 7 7 "time" 8 8 9 + comatproto "github.com/bluesky-social/indigo/api/atproto" 9 10 appbsky "github.com/bluesky-social/indigo/api/bsky" 10 11 "github.com/bluesky-social/indigo/atproto/identity" 12 + "github.com/bluesky-social/indigo/atproto/syntax" 11 13 ) 12 14 13 15 type ProfileSummary struct { ··· 19 21 type AccountPrivate struct { 20 22 Email string 21 23 EmailConfirmed bool 24 + IndexedAt time.Time 22 25 } 23 26 24 27 // information about a repo/account/identity, always pre-populated and relevant to many rules ··· 30 33 FollowersCount int64 31 34 FollowsCount int64 32 35 PostsCount int64 33 - IndexedAt *time.Time 34 36 } 35 37 36 38 func (e *Engine) GetAccountMeta(ctx context.Context, ident *identity.Identity) (*AccountMeta, error) { ··· 93 95 } 94 96 95 97 if e.AdminClient != nil { 96 - // XXX: get admin-level info (email, indexed at, etc). requires lexgen update 98 + pv, err := comatproto.AdminGetAccountInfo(ctx, e.AdminClient, ident.DID.String()) 99 + if err != nil { 100 + return nil, err 101 + } 102 + ap := AccountPrivate{} 103 + if pv.Email != nil && *pv.Email != "" { 104 + ap.Email = *pv.Email 105 + } 106 + if pv.EmailConfirmedAt != nil && *pv.EmailConfirmedAt != "" { 107 + ap.EmailConfirmed = true 108 + } 109 + ts, err := syntax.ParseDatetimeTime(pv.IndexedAt) 110 + if err != nil { 111 + return nil, err 112 + } 113 + ap.IndexedAt = ts 114 + am.Private = &ap 97 115 } 98 116 99 117 val, err := json.Marshal(&am)
+1
automod/rules/all.go
··· 12 12 ReplyCountPostRule, 13 13 BanHashtagsPostRule, 14 14 AccountDemoPostRule, 15 + AccountPrivateDemoPostRule, 15 16 }, 16 17 } 17 18 return rules
+17
automod/rules/private.go
··· 1 + package rules 2 + 3 + import ( 4 + "strings" 5 + 6 + "github.com/bluesky-social/indigo/automod" 7 + ) 8 + 9 + // dummy rule. this leaks PII (account email) in logs and should never be used in real life 10 + func AccountPrivateDemoPostRule(evt *automod.PostEvent) error { 11 + if evt.Account.Private != nil { 12 + if strings.HasSuffix(evt.Account.Private.Email, "@blueskyweb.xyz") { 13 + evt.Logger.Info("hello dev!", "email", evt.Account.Private.Email) 14 + } 15 + } 16 + return nil 17 + }
+1 -1
cmd/hepa/main.go
··· 126 126 }, 127 127 PLCLimiter: rate.NewLimiter(rate.Limit(cctx.Int("plc-rate-limit")), 1), 128 128 TryAuthoritativeDNS: true, 129 - SkipDNSDomainSuffixes: []string{".bsky.social"}, 129 + SkipDNSDomainSuffixes: []string{".bsky.social", ".staging.bsky.dev"}, 130 130 } 131 131 var dir identity.Directory 132 132 if cctx.String("redis-url") != "" {