Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
thilobillerbeck committed Nov 17, 2024
2 parents 6fc6c9f + 52dae21 commit 0b2b2b2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
36 changes: 33 additions & 3 deletions lib/tasks/mastodonToBluesky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,40 @@ export default async function taskMastodonToBluesky() {
}
}

let result = await blueskyClient.post(postBsky);
try {
let result = await blueskyClient.post(postBsky);

if (repRef.root === undefined) repRef.root = result;
repRef.parent = result;
if (repRef.root === undefined) repRef.root = result;
repRef.parent = result;
} catch (err) {
if(err.error === "AccountDeactivated") {
logSchedulerEvent(
user.name,
user.mastodonInstance.url,
"REPOSTER",
`Account deactivated, invalidating creds`
);

db.user.update({
where: {
id: user.id
},
data: {
blueskySession: null,
blueskySessionEvent: null,
blueskyToken: null,
blueskyHandle: null
}
}).then(() => {
logSchedulerEvent(user.name, user.mastodonInstance.url, "AGENT", "bluesky creds invalidated")
}).catch((err) => {
logSchedulerEvent(user.name, user.mastodonInstance.url, "AGENT", "could not clear creds")
console.error(err)
})

return;
}
}
}

repostsInThisRun[post.id] = repRef;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@sentry/profiling-node": "^8.38.0",
"fastify": "^5.1.0",
"html-to-text": "^9.0.5",
"liquidjs": "^10.18.0",
"liquidjs": "^10.19.0",
"megalodon": "^10.0.6",
"node-html-parser": "^6.1.13",
"prisma": "^5.22.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b2b2b2

Please sign in to comment.