Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Update hardcoded suggested actors (#524)

* Update the hardcoded suggested follows

* Update the suggested actors to just use hardcoded list since there's now the foaf system

authored by

Paul Frazee and committed by
GitHub
df1791bd c5222db3

+46 -186
+35 -114
src/lib/constants.ts
··· 34 34 } 35 35 36 36 export const PROD_SUGGESTED_FOLLOWS = [ 37 - 'christina', 38 - 'wesam', 39 - 'jim', 40 - 'ab', 41 - 'karalabe', 42 - 'clun', 43 - 'staltz', 44 - 'gillian', 45 - 'karpathy', 46 - 'zoink', 47 - 'john', 48 - 'round', 49 - 'vex', 50 - 'umang', 51 - 'atroyn', 52 - 'poisonivy', 53 - 'wongmjane', 54 - 'lari', 55 - 'arunwadhwa', 56 - 'trav', 57 - 'fred', 58 - 'offscript', 59 - 'satnam', 60 - 'ella', 61 - 'caspian', 62 - 'spencer', 63 - 'nickgrossman', 64 - 'koji', 65 - 'avy', 66 - 'seymourstein', 67 - 'joelg', 68 - 'stig', 69 - 'rabble', 70 - 'hunterwalk', 71 - 'evan', 72 - 'aviral', 73 - 'tami', 74 - 'generativist', 75 - 'gord', 76 - 'ninjapleasedj', 77 - 'robotics', 78 - 'noahjnelson', 79 - 'vijay', 80 - 'scottbeale', 81 - 'daybreakjung', 82 - 'shelby', 83 - 'joel', 84 - 'space', 85 - 'rish', 86 - 'simon', 87 - 'kelly', 88 - 'maxbittker', 89 - 'sylphrenetic', 90 - 'caleb', 91 - 'jik', 92 - 'james', 93 - 'neil', 94 - 'tippenein', 95 - 'mandel', 96 - 'sharding', 97 - 'tyler', 98 - 'raymond', 99 - 'visakanv', 100 - 'saz', 101 - 'steph', 102 - 'ratzlaff', 103 - 'beth', 104 - 'weisser', 105 - 'katherine', 106 - 'annagat', 107 - 'an', 108 - 'kunal', 109 - 'josh', 110 - 'lurkshark', 111 - 'amir', 112 - 'amyxzh', 113 - 'danielle', 114 - 'jack-frazee', 115 - 'daniellefong', 116 - 'dystopiabreaker', 117 - 'morgan', 118 - 'vibes', 119 - 'cat', 120 - 'yuriy', 121 - 'alvinreyes', 122 - 'skoot', 123 - 'patricia', 124 - 'ara4n', 125 - 'case', 126 - 'armand', 127 - 'ivan', 128 - 'nicholas', 129 - 'kelsey', 130 - 'ericlee', 131 - 'emily', 132 - 'jake', 133 - 'jennijuju', 134 - 'ian5v', 135 - 'bnewbold', 136 - 'jasmine', 137 - 'chris', 138 - 'mtclai', 139 - 'willscott', 140 - 'michael', 141 - 'kwkroeger', 142 - 'broox', 143 - 'iamrosewang', 144 - 'jack-morrison', 145 - 'pwang', 146 - 'martin', 147 - 'jack', 148 - 'jay', 37 + 'faithlove.art', 38 + 'danielkoeth.bsky.social', 39 + 'bsky.app', 40 + 'jay.bsky.team', 41 + 'pfrazee.com', 42 + 'why.bsky.team', 43 + 'support.bsky.team', 44 + 'jack.bsky.social', 45 + 'earthquake.bsky.social', 46 + 'jamesgunn.bsky.social', 47 + 'seangunn.bsky.social', 48 + 'kumail.bsky.social', 49 + 'craignewmark.bsky.social', 50 + 'grimes.bsky.social', 51 + 'xychelsea.tv', 52 + 'mcq.bsky.social', 53 + 'mmasnick.bsky.social', 54 + 'nitasha.bsky.social', 55 + 'kenklippenstein.bsky.social', 56 + 'jaypeters.bsky.social', 57 + 'miyagawa.bsky.social', 58 + 'anildash.com', 59 + 'tiffani.bsky.social', 60 + 'kelseyhightower.com', 61 + 'aliafonzy.bsky.social', 62 + 'tszzl.bsky.social', 63 + 'danabramov.bsky.social', 64 + 'shinyakato.dev', 65 + 'karpathy.bsky.social', 66 + 'lookitup.baby', 67 + 'brooke.vibe.camp', 68 + 'mollywhite.net', 69 + 'amir.blue', 70 + 'zoink.bsky.social', 71 + 'moskov.bsky.social', 149 72 ] 150 - .map(handle => `${handle}.bsky.social`) 151 - .concat(['pfrazee.com', 'divy.zone', 'dholms.xyz', 'why.bsky.world']) 152 73 export const STAGING_SUGGESTED_FOLLOWS = ['arcalinea', 'paul', 'paul2'].map( 153 74 handle => `${handle}.staging.bsky.dev`, 154 75 )
+11 -72
src/state/models/discovery/suggested-actors.ts
··· 19 19 isRefreshing = false 20 20 hasLoaded = false 21 21 error = '' 22 - hasMore = true 23 - loadMoreCursor?: string 24 - 25 - hardCodedSuggestions: SuggestedActor[] | undefined 22 + hasMore = false 26 23 27 24 // data 28 25 suggestions: SuggestedActor[] = [] ··· 60 57 } 61 58 62 59 loadMore = bundleAsync(async (replace: boolean = false) => { 63 - if (!replace && !this.hasMore) { 60 + if (this.suggestions.length && !replace) { 64 61 return 65 62 } 66 - if (replace) { 67 - this.hardCodedSuggestions = undefined 68 - } 69 63 this._xLoading(replace) 70 64 try { 71 - let items: SuggestedActor[] = this.suggestions 72 - if (replace) { 73 - items = [] 74 - this.loadMoreCursor = undefined 75 - } 76 - let res 77 - do { 78 - await this.fetchHardcodedSuggestions() 79 - if (this.hardCodedSuggestions && this.hardCodedSuggestions.length > 0) { 80 - // pull from the hard-coded suggestions 81 - const newItems = this.hardCodedSuggestions.splice(0, this.pageSize) 82 - items = items.concat(newItems) 83 - this.hasMore = true 84 - this.loadMoreCursor = undefined 85 - } else { 86 - // pull from the PDS' algo 87 - res = await this.rootStore.agent.app.bsky.actor.getSuggestions({ 88 - limit: this.pageSize, 89 - cursor: this.loadMoreCursor, 90 - }) 91 - this.loadMoreCursor = res.data.cursor 92 - this.hasMore = !!this.loadMoreCursor 93 - items = items.concat( 94 - res.data.actors.filter( 95 - actor => !items.find(i => i.did === actor.did), 96 - ), 97 - ) 98 - } 99 - } while (items.length < this.pageSize && this.hasMore) 100 - runInAction(() => { 101 - this.suggestions = items 102 - }) 103 - this._xIdle() 104 - } catch (e: any) { 105 - this._xIdle(e) 106 - } 107 - }) 108 - 109 - async fetchHardcodedSuggestions() { 110 - if (this.hardCodedSuggestions) { 111 - return 112 - } 113 - try { 114 65 // clone the array so we can mutate it 115 66 const actors = [ 116 67 ...SUGGESTED_FOLLOWS( 117 68 this.rootStore.session.currentSession?.service || '', 118 69 ), 119 70 ] 120 - 121 - // fetch the profiles in chunks of 25 (the limit allowed by `getProfiles`) 122 - let profiles: AppBskyActorDefs.ProfileView[] = [] 123 - do { 124 - const res = await this.rootStore.agent.getProfiles({ 125 - actors: actors.splice(0, 25), 126 - }) 127 - profiles = profiles.concat(res.data.profiles) 128 - } while (actors.length) 129 - 71 + const res = await this.rootStore.agent.getProfiles({ 72 + actors: shuffle(actors).splice(0, 25), 73 + }) 74 + const {profiles} = res.data 130 75 this.rootStore.me.follows.hydrateProfiles(profiles) 131 76 132 77 runInAction(() => { 133 - profiles = profiles.filter(profile => { 78 + this.suggestions = profiles.filter(profile => { 134 79 if (profile.viewer?.following) { 135 80 return false 136 81 } ··· 139 84 } 140 85 return true 141 86 }) 142 - this.hardCodedSuggestions = shuffle(profiles) 143 87 }) 144 - } catch (e) { 145 - this.rootStore.log.error( 146 - 'Failed to getProfiles() for suggested follows', 147 - {e}, 148 - ) 149 - runInAction(() => { 150 - this.hardCodedSuggestions = [] 151 - }) 88 + this._xIdle() 89 + } catch (e: any) { 90 + this._xIdle(e) 152 91 } 153 - } 92 + }) 154 93 155 94 // state transitions 156 95 // =