File tree Expand file tree Collapse file tree 3 files changed +27
-16
lines changed
packages/integrations/src Expand file tree Collapse file tree 3 files changed +27
-16
lines changed Original file line number Diff line number Diff line change 11
11
"editor.defaultFormatter" : " Prisma.prisma"
12
12
},
13
13
"[typescript]" : {
14
- "editor.defaultFormatter" : " biomejs.biome "
14
+ "editor.defaultFormatter" : " vscode.typescript-language-features "
15
15
},
16
16
"[typescriptreact]" : {
17
17
"editor.defaultFormatter" : " biomejs.biome"
21
21
},
22
22
"editor.formatOnSave" : true ,
23
23
"tailwindCSS.experimental.classRegex" : [
24
- [" cva\\ (([^)]*)\\ )" , " [\" '`]([^\" '`]*).*?[\" '`]" ],
25
- [" cx\\ (([^)]*)\\ )" , " (?:'|\" |`)([^']*)(?:'|\" |`)" ]
24
+ [
25
+ " cva\\ (([^)]*)\\ )" ,
26
+ " [\" '`]([^\" '`]*).*?[\" '`]"
27
+ ],
28
+ [
29
+ " cx\\ (([^)]*)\\ )" ,
30
+ " (?:'|\" |`)([^']*)(?:'|\" |`)"
31
+ ]
26
32
],
27
33
"typescript.enablePromptUseWorkspaceTsdk" : true ,
28
34
"typescript.tsdk" : " node_modules/typescript/lib" ,
29
35
"typescript.preferences.autoImportFileExcludePatterns" : [
30
36
" next/router.d.ts" ,
31
37
" next/dist/client/router.d.ts"
32
38
]
33
- }
39
+ }
Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ import path from 'node:path';
3
3
import type { WebhookEvent } from '@clerk/fastify' ;
4
4
import { AccessLevel , db } from '@openpanel/db' ;
5
5
import {
6
+ createSlackInstaller ,
6
7
sendSlackNotification ,
7
- slackInstaller ,
8
+
8
9
} from '@openpanel/integrations/src/slack' ;
9
10
import { getRedisPub } from '@openpanel/redis' ;
10
11
import { zSlackAuthResponse } from '@openpanel/validation' ;
@@ -184,6 +185,7 @@ export async function slackWebhook(
184
185
request . log . error ( parsedParams . error , 'Invalid params' ) ;
185
186
return reply . status ( 400 ) . send ( { error : 'Invalid params' } ) ;
186
187
}
188
+ const slackInstaller = createSlackInstaller ( ) ;
187
189
188
190
const veryfiedState = await slackInstaller . stateStore ?. verifyStateParam (
189
191
new Date ( ) ,
Original file line number Diff line number Diff line change 3
3
import { LogLevel , App as SlackApp } from '@slack/bolt' ;
4
4
import { InstallProvider } from '@slack/oauth' ;
5
5
6
- const SLACK_CLIENT_ID = process . env . SLACK_CLIENT_ID ;
7
- const SLACK_CLIENT_SECRET = process . env . SLACK_CLIENT_SECRET ;
8
6
const SLACK_OAUTH_REDIRECT_URL = process . env . SLACK_OAUTH_REDIRECT_URL ;
9
- const SLACK_STATE_SECRET = process . env . SLACK_STATE_SECRET ;
10
-
11
-
12
- export const getSlackInstallUrl = ( {
13
- integrationId,
14
- organizationId,
15
- projectId,
16
- } : { integrationId : string ; organizationId : string ; projectId : string } ) => {
7
+ export const createSlackInstaller = ( ) => {
8
+ const SLACK_CLIENT_ID = process . env . SLACK_CLIENT_ID ;
9
+ const SLACK_CLIENT_SECRET = process . env . SLACK_CLIENT_SECRET ;
10
+ const SLACK_STATE_SECRET = process . env . SLACK_STATE_SECRET ;
17
11
const slackInstaller = new InstallProvider ( {
18
12
clientId : SLACK_CLIENT_ID ! ,
19
13
clientSecret : SLACK_CLIENT_SECRET ! ,
20
14
stateSecret : SLACK_STATE_SECRET ,
21
15
logLevel : process . env . NODE_ENV === 'development' ? LogLevel . DEBUG : undefined ,
22
16
} ) ;
23
-
17
+
18
+ return slackInstaller ;
19
+ } ;
20
+ export const getSlackInstallUrl = ( {
21
+ integrationId,
22
+ organizationId,
23
+ projectId,
24
+ } : { integrationId : string ; organizationId : string ; projectId : string } ) => {
25
+
26
+ const slackInstaller = createSlackInstaller ( ) ;
24
27
return slackInstaller . generateInstallUrl ( {
25
28
scopes : [
26
29
'incoming-webhook' ,
You can’t perform that action at this time.
0 commit comments