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 </div> 136 <div id="accountsList"> 137 {#each accountsData as accountObject} 138 - <AccountComponent account={accountObject} /> 139 {/each} 140 </div> 141 <p class="disclaimer-footer">
··· 135 </div> 136 <div id="accountsList"> 137 {#each accountsData as accountObject} 138 + {#if !accountObject.hiddenFromHomepage} 139 + <AccountComponent account={accountObject} /> 140 + {/if} 141 {/each} 142 </div> 143 <p class="disclaimer-footer">
+22
src/lib/pdsfetch.ts
··· 25 avatarCid: string | null; 26 currentCursor?: string; 27 deactivated?: boolean; 28 } 29 30 let accountsMetadata: AccountMetadata[] = []; ··· 171 displayName: "", 172 avatarCid: null, 173 deactivated: false, 174 }; 175 176 try { ··· 191 } 192 193 try { 194 account.handle = await blueskyHandleFromDid(did); 195 } catch (e) { 196 console.error(`Error fetching handle for ${did}:`, e); ··· 346 347 const postsAcc: PostsAcc[] = await Promise.all( 348 accountsToFetch.map(async (account) => { 349 const result = await fetchPostsForUser( 350 account.did, 351 account.currentCursor || null,
··· 25 avatarCid: string | null; 26 currentCursor?: string; 27 deactivated?: boolean; 28 + hiddenFromHomepage: boolean; 29 } 30 31 let accountsMetadata: AccountMetadata[] = []; ··· 172 displayName: "", 173 avatarCid: null, 174 deactivated: false, 175 + hiddenFromHomepage: false, 176 }; 177 178 try { ··· 193 } 194 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 { 210 account.handle = await blueskyHandleFromDid(did); 211 } catch (e) { 212 console.error(`Error fetching handle for ${did}:`, e); ··· 362 363 const postsAcc: PostsAcc[] = await Promise.all( 364 accountsToFetch.map(async (account) => { 365 + if (account.hiddenFromHomepage) { 366 + return { 367 + posts: [], 368 + account, 369 + }; 370 + } 371 const result = await fetchPostsForUser( 372 account.did, 373 account.currentCursor || null,