Limited post send size and post syncing is working for small posts 😮

This commit is contained in:
2025-05-19 02:09:50 -07:00
parent 55de88bec5
commit 438e004cc3
4 changed files with 40 additions and 4 deletions

View File

@@ -215,6 +215,29 @@ export class Sync {
// console.log.apply(null, log(`getPostsForUser`,output));
}
async writePostForUser(userID:string, post:any) {
// HACK: Some posts have insanely large images, so I'm gonna skip them.
// Once we support delete then we we could delete these posts in a sensible way.
if (this.postBlockList.has(post.post_id)) {
console.log.apply(null, log(`Skipping blocked post: ${post.post_id}`));;
return;
}
// HACK - some posts had the wrong author ID
if (userID === this.userID) {
post.author_id = this.userID;
}
post.post_timestamp = new Date(post.post_timestamp);
if (post.image_data) {
post.image_data = await base64ToArrayBuffer(post.image_data);
}
console.log.apply(null, log(`Merging same user peer posts...`));
await mergeDataArray(userID, [post]);
}
// async getPostIdsForUserHandler(data: any) {
// let message = data.message;
// let postIds = await getAllIds(message.user_id) ?? [];