@@ -120,7 +120,7 @@ function getLarkWorkspaceCredentialsByChannel(channelId: string): { appId: strin
120120 if ( ! channelId ) return undefined ;
121121 for ( const workspace of getWorkspaces ( ) ) {
122122 if ( workspace . type !== "lark" ) continue ;
123- const appId = workspace . larkAppId ?. trim ( ) ;
123+ const appId = workspace . larkAppKey ?. trim ( ) || workspace . larkAppId ?. trim ( ) ;
124124 const appSecret = workspace . larkAppSecret ?. trim ( ) ;
125125 if ( ! appId || ! appSecret ) continue ;
126126 if ( workspace . channelDetails . some ( ( channel ) => channel . id === channelId ) ) {
@@ -134,7 +134,7 @@ function getLarkWorkspaceCredentialsByWorkspace(workspaceId: string): { appId: s
134134 if ( ! workspaceId ) return undefined ;
135135 for ( const workspace of getWorkspaces ( ) ) {
136136 if ( workspace . type !== "lark" ) continue ;
137- const appId = workspace . larkAppId ?. trim ( ) ;
137+ const appId = workspace . larkAppKey ?. trim ( ) || workspace . larkAppId ?. trim ( ) ;
138138 const appSecret = workspace . larkAppSecret ?. trim ( ) ;
139139 if ( ! appId || ! appSecret ) continue ;
140140 if ( workspace . id === workspaceId ) {
@@ -307,7 +307,7 @@ function validateWorkspaceConfig(config: typeof defaultDashboardConfig): string
307307 const idCounts = new Map < string , number > ( ) ;
308308 const slackBotTokenCounts = new Map < string , number > ( ) ;
309309 const discordBotTokenCounts = new Map < string , number > ( ) ;
310- const larkAppIdCounts = new Map < string , number > ( ) ;
310+ const larkAppKeyCounts = new Map < string , number > ( ) ;
311311 for ( const workspace of config . workspaces ) {
312312 const workspaceId = workspace . id . trim ( ) ;
313313 if ( ! workspaceId ) {
@@ -325,13 +325,13 @@ function validateWorkspaceConfig(config: typeof defaultDashboardConfig): string
325325 }
326326
327327 if ( workspace . type === "lark" ) {
328- const appId = workspace . larkAppId ?. trim ( ) ?? "" ;
328+ const appId = workspace . larkAppKey ?. trim ( ) || workspace . larkAppId ?. trim ( ) || "" ;
329329 const appSecret = workspace . larkAppSecret ?. trim ( ) ?? "" ;
330330 if ( ! appId || ! appSecret ) {
331331 const label = workspace . name . trim ( ) || workspace . id ;
332- return `Missing Lark app id /app secret for workspace: ${ label } ` ;
332+ return `Missing Lark app key /app secret for workspace: ${ label } ` ;
333333 }
334- larkAppIdCounts . set ( appId , ( larkAppIdCounts . get ( appId ) ?? 0 ) + 1 ) ;
334+ larkAppKeyCounts . set ( appId , ( larkAppKeyCounts . get ( appId ) ?? 0 ) + 1 ) ;
335335 continue ;
336336 }
337337
@@ -361,9 +361,9 @@ function validateWorkspaceConfig(config: typeof defaultDashboardConfig): string
361361 return "Duplicate Discord bot tokens found across workspaces" ;
362362 }
363363
364- const duplicateLarkAppIdCount = Array . from ( larkAppIdCounts . values ( ) ) . filter ( ( count ) => count > 1 ) . length ;
365- if ( duplicateLarkAppIdCount > 0 ) {
366- return "Duplicate Lark app ids found across workspaces" ;
364+ const duplicateLarkAppKeyCount = Array . from ( larkAppKeyCounts . values ( ) ) . filter ( ( count ) => count > 1 ) . length ;
365+ if ( duplicateLarkAppKeyCount > 0 ) {
366+ return "Duplicate Lark app keys found across workspaces" ;
367367 }
368368
369369 return null ;
@@ -659,9 +659,11 @@ async function handleRequest(request: Request): Promise<Response> {
659659 }
660660 try {
661661 const payload = ( await request . json ( ) ) as Record < string , unknown > ;
662- const larkAppId = typeof payload . larkAppId === "string" ? payload . larkAppId : "" ;
662+ const larkAppKey = typeof payload . larkAppKey === "string"
663+ ? payload . larkAppKey
664+ : ( typeof payload . larkAppId === "string" ? payload . larkAppId : "" ) ;
663665 const larkAppSecret = typeof payload . larkAppSecret === "string" ? payload . larkAppSecret : "" ;
664- const workspace = await discoverLarkWorkspace ( larkAppId , larkAppSecret ) ;
666+ const workspace = await discoverLarkWorkspace ( larkAppKey , larkAppSecret ) ;
665667 return jsonResponse ( 200 , { ok : true , workspace } ) ;
666668 } catch ( error ) {
667669 const message = error instanceof Error ? error . message : "Lark workspace discovery failed" ;
0 commit comments