ReviewOS

also looking at this

stacks/postline

feat: crossposting — media (LinkedIn/IG/Threads), OAuth token refresh, and X/Twitter

#30
Merged glennmichael123 wants to merge feat/crosspost-media-and-token-refresh into main
28 files +1810 -109
app/Actions/Postline/TwitterAuthAction.tsadded+19-0
Changes to app/Actions/Postline/TwitterAuthAction.ts
@@ -0,0 +1,19 @@
1import { Action } from '@stacksjs/actions'
2import { response } from '@stacksjs/router'
3import { twitter } from '../../Services/Social/TwitterService'
4
5export default new Action({
6 name: 'Postline Twitter Auth',
7 description: 'Redirect the user to X/Twitter for OAuth consent.',
8 method: 'GET',
9
10 async handle() {
11 try {
12 return response.redirect(await twitter.getAuthUrl())
13 }
14 catch (error) {
15 const message = error instanceof Error ? error.message : String(error)
16 return response.redirect(`/accounts?twitter=error&message=${encodeURIComponent(message)}`)
17 }
18 },
19})