A frontend for your PDS

feat: add hiddenFromHomepage property to account metadata and filter accounts in the UI

tophhie.cloud e59259bf 358eaead

verified
+25 -1
+3 -1
src/App.svelte
··· 135 135 </div> 136 136 <div id="accountsList"> 137 137 {#each accountsData as accountObject} 138 - <AccountComponent account={accountObject} /> 138 + {#if !accountObject.hiddenFromHomepage} 139 + <AccountComponent account={accountObject} /> 140 + {/if} 139 141 {/each} 140 142 </div> 141 143 <p class="disclaimer-footer">
+22
src/lib/pdsfetch.ts
··· 25 25 avatarCid: string | null; 26 26 currentCursor?: string; 27 27 deactivated?: boolean; 28 + hiddenFromHomepage: boolean; 28 29 } 29 30 30 31 let accountsMetadata: AccountMetadata[] = []; ··· 171 172 displayName: "", 172 173 avatarCid: null, 173 174 deactivated: false, 175 + hiddenFromHomepage: false, 174 176 }; 175 177 176 178 try { ··· 191 193 } 192 194 193 195 try { 196 + const { data } = await rpc.get("com.atproto.repo.getRecord", { 197 + params: { 198 + repo: did, 199 + collection: "social.tophhie.profile", 200 + rkey: "self", 201 + }, 202 + }); 203 + const value = (data.value as any).pdsPreferences.showOnHomepage; 204 + account.hiddenFromHomepage = value === false; 205 + } catch { 206 + // Ignore errors, as this record may not exist 207 + } 208 + 209 + try { 194 210 account.handle = await blueskyHandleFromDid(did); 195 211 } catch (e) { 196 212 console.error(`Error fetching handle for ${did}:`, e); ··· 346 362 347 363 const postsAcc: PostsAcc[] = await Promise.all( 348 364 accountsToFetch.map(async (account) => { 365 + if (account.hiddenFromHomepage) { 366 + return { 367 + posts: [], 368 + account, 369 + }; 370 + } 349 371 const result = await fetchPostsForUser( 350 372 account.did, 351 373 account.currentCursor || null,