Proper chronological feed

This commit is contained in:
Astra 2025-04-21 15:29:58 +09:00
parent 04de4c1841
commit d92f6f6514
Signed by: astra
SSH key fingerprint: SHA256:jQDNS75/33T59Ey4yAzrUPP/5YQaXEetsW8hwUae+ag
2 changed files with 5 additions and 5 deletions

View file

@ -15,10 +15,10 @@ export class Config {
static readonly FRONTEND_URL: string = "https://deer.social"; static readonly FRONTEND_URL: string = "https://deer.social";
/** /**
* Maximum number of posts to fetch from the PDS per user * Maximum number of posts to show in the feed (across all users)
* @default 10 * @default 100
*/ */
static readonly MAX_POSTS_PER_USER: number = 22; static readonly MAX_POSTS: number = 100;
/** /**
* Footer text for the dashboard * Footer text for the dashboard

View file

@ -167,7 +167,7 @@ const fetchPosts = async (did: string) => {
params: { params: {
repo: did as At.Identifier, repo: did as At.Identifier,
collection: "app.bsky.feed.post", collection: "app.bsky.feed.post",
limit: Config.MAX_POSTS_PER_USER, limit: Config.MAX_POSTS,
}, },
}); });
return { return {
@ -238,7 +238,7 @@ const fetchAllPosts = async () => {
}) })
); );
posts.sort((a, b) => b.timestamp - a.timestamp); posts.sort((a, b) => b.timestamp - a.timestamp);
return posts; return posts.slice(0, Config.MAX_POSTS);
}; };
export { fetchAllPosts, getAllMetadataFromPds, Post }; export { fetchAllPosts, getAllMetadataFromPds, Post };
export type { AccountMetadata }; export type { AccountMetadata };