Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
thilobillerbeck committed Dec 17, 2024
2 parents 29649f7 + 21ad931 commit 346a190
Show file tree
Hide file tree
Showing 5 changed files with 397 additions and 360 deletions.
5 changes: 4 additions & 1 deletion devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
languages = {
typescript.enable = true;
javascript.enable = true;
javascript.pnpm.enable = true;
javascript.pnpm = {
enable = true;
install.enable = true;
};
};

processes = {
Expand Down
12 changes: 6 additions & 6 deletions lib/mastodon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ function verifyThread(uid: string, status: Status, searchSpace: Status[], initia
}

export async function getNewToots(client: Mastodon, uid: string, lastTootTime: Date) {
const statusses = await client.getAccountStatuses(uid, {
const statuses = await client.getAccountStatuses(uid, {
limit: 50,
exclude_reblogs: true,
exclude_replies: false,
only_media: false
});
const statusses_data = await statusses.data;
const statusses_filtered = statusses_data.filter((status) => {
const statuses_data = await statuses.data;
const statuses_filtered = statuses_data.filter((status) => {
const newPost = new Date(status.created_at) > lastTootTime;
const isPublic = status.visibility === 'public';
const isNotMention = status.mentions.length === 0;

// due to the way some mastodon clients handle threads, we need to check if the status may be a thread
const isThread = verifyThread(uid, status, statusses_data, true);
const isThread = verifyThread(uid, status, statuses_data, true);

return newPost && (isPublic || isThread) && isNotMention;
});

return statusses_filtered;
}
return statuses_filtered;
}
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
"@atproto/xrpc": "^0.6.4",
"@fastify/cookie": "^11.0.1",
"@fastify/formbody": "^8.0.1",
"@fastify/jwt": "^9.0.1",
"@fastify/jwt": "^9.0.2",
"@fastify/schedule": "^5.0.2",
"@fastify/session": "^11.0.1",
"@fastify/static": "^8.0.2",
"@fastify/static": "^8.0.3",
"@fastify/view": "^10.0.1",
"@prisma/client": "^5.22.0",
"@sentry/node": "^8.40.0",
"@sentry/profiling-node": "^8.40.0",
"fastify": "^5.1.0",
"@prisma/client": "^6.0.1",
"@sentry/node": "^8.45.1",
"@sentry/profiling-node": "^8.46.0",
"fastify": "^5.2.0",
"html-to-text": "^9.0.5",
"liquidjs": "^10.19.0",
"megalodon": "^10.0.7",
"node-html-parser": "^6.1.13",
"prisma": "^5.22.0",
"prisma": "^6.0.1",
"sharp": "^0.33.5",
"toad-scheduler": "^3.0.1"
},
Expand All @@ -40,11 +40,11 @@
"@types/html-to-text": "^9.0.4",
"autoprefixer": "^10.4.20",
"concurrently": "^9.1.0",
"daisyui": "^4.12.14",
"daisyui": "^4.12.20",
"postcss": "^8.4.49",
"postcss-cli": "^11.0.0",
"semantic-release": "^24.2.0",
"tailwindcss": "^3.4.15",
"tailwindcss": "^3.4.16",
"ts-node": "^10.9.2",
"typescript": "^5.7.2"
},
Expand Down
Loading

0 comments on commit 346a190

Please sign in to comment.