Skip to content

Commit 1c8cc48

Browse files
committed
feat: bluesky finisher
1 parent a9e42ce commit 1c8cc48

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

apps/frontend/src/components/launches/providers/bluesky/bluesky.provider.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider';
2+
import { ThreadFinisher } from '@gitroom/frontend/components/launches/finisher/thread.finisher';
3+
4+
const SettingsComponent = () => {
5+
return <ThreadFinisher />;
6+
};
7+
28
export default withProvider(
3-
null,
9+
SettingsComponent,
410
undefined,
511
undefined,
612
async (posts) => {

libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
135135
username: profile.data.handle!,
136136
};
137137
} catch (e) {
138+
console.log(e);
138139
return 'Invalid credentials';
139140
}
140141
}
@@ -221,6 +222,41 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
221222
cidUrl.push({ cid, url: uri, rev: commit.rev });
222223
}
223224

225+
if (postDetails?.[0]?.settings?.active_thread_finisher) {
226+
const rt = new RichText({
227+
text: postDetails?.[0]?.settings?.thread_finisher,
228+
});
229+
230+
await rt.detectFacets(agent);
231+
232+
await agent.post({
233+
text: postDetails?.[0]?.settings?.thread_finisher,
234+
facets: rt.facets,
235+
createdAt: new Date().toISOString(),
236+
embed: {
237+
$type: 'app.bsky.embed.record',
238+
record: {
239+
uri: cidUrl[0].url,
240+
cid: cidUrl[0].cid,
241+
},
242+
},
243+
...(loadCid
244+
? {
245+
reply: {
246+
root: {
247+
uri: loadUri,
248+
cid: loadCid,
249+
},
250+
parent: {
251+
uri: loadUri,
252+
cid: loadCid,
253+
},
254+
},
255+
}
256+
: {}),
257+
});
258+
}
259+
224260
return postDetails.map((p, index) => ({
225261
id: p.id,
226262
postId: cidUrl[index].url,

libraries/nestjs-libraries/src/integrations/social/threads.provider.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,7 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
411411
id: makeId(10),
412412
media: [],
413413
message:
414-
postDetails?.[0]?.settings?.thread_finisher! +
415-
'\n' +
416-
responses[0].releaseURL,
414+
postDetails?.[0]?.settings?.thread_finisher,
417415
settings: {},
418416
},
419417
lastReplyId,

0 commit comments

Comments
 (0)