ari/DynamicPageLoads #2

Merged
astra merged 6 commits from ari/DynamicPageLoads into main 2025-04-22 03:14:38 +00:00
2 changed files with 1 additions and 59 deletions
Showing only changes of commit eeea306303 - Show all commits

View file

@ -18,7 +18,7 @@ export class Config {
* Maximum number of posts to show in the feed (across all users) * Maximum number of posts to show in the feed (across all users)
* @default 100 * @default 100
*/ */
static readonly MAX_POSTS: number = 5; static readonly MAX_POSTS: number = 15;
astra marked this conversation as resolved Outdated

The documentation for the variable needs updating i think

The documentation for the variable needs updating i think

Updated!

Updated!
/** /**
* Footer text for the dashboard * Footer text for the dashboard

View file

@ -161,31 +161,6 @@ const getAllMetadataFromPds = async (): Promise<AccountMetadata[]> => {
return metadata.filter((account) => account !== null) as AccountMetadata[]; return metadata.filter((account) => account !== null) as AccountMetadata[];
}; };
// OLD
const fetchPosts = async (did: string) => {
try {
const { data } = await rpc.get("com.atproto.repo.listRecords", {
params: {
repo: did as At.Identifier,
collection: "app.bsky.feed.post",
limit: Config.MAX_POSTS,
},
});
return {
records: data.records as ComAtprotoRepoListRecords.Record[],
did: did,
error: false,
};
} catch (e) {
console.error(`Error fetching posts for ${did}:`, e);
return {
records: [],
did: did,
error: true,
};
}
};
const identityResolve = async (did: At.Did) => { const identityResolve = async (did: At.Did) => {
const resolver = new CompositeDidDocumentResolver({ const resolver = new CompositeDidDocumentResolver({
methods: { methods: {
@ -364,38 +339,5 @@ const fetchPostsForUser = async (did: At.Did, cursor: string | null) => {
} }
}; };
// const fetchAllPosts = async () => {
// const users: AccountMetadata[] = await getAllMetadataFromPds();
// const postRecords = await Promise.all(
// users.map(
// async (metadata: AccountMetadata) => await fetchPosts(metadata.did),
// ),
// );
// // Filter out any records that have an error
// const validPostRecords = postRecords.filter((record) => !record.error);
// const posts: Post[] = validPostRecords.flatMap((userFetch) =>
// userFetch.records.map((record) => {
// const user = users.find(
// (user: AccountMetadata) => user.did == userFetch.did,
// );
// if (!user) {
// throw new Error(`User with DID ${userFetch.did} not found`);
// }
// return new Post(record, user);
// })
// );
// posts.sort((a, b) => b.timestamp - a.timestamp);
// if (!Config.SHOW_FUTURE_POSTS) {
// // Filter out posts that are in the future
// const now = Date.now();
// const filteredPosts = posts.filter((post) => post.timestamp <= now);
// return filteredPosts.slice(0, Config.MAX_POSTS);
// }
// return posts.slice(0, Config.MAX_POSTS);
// };
export { getAllMetadataFromPds, getNextPosts, Post }; export { getAllMetadataFromPds, getNextPosts, Post };
export type { AccountMetadata }; export type { AccountMetadata };