1. 添加新的正式环境的secret配置信息。

2. 动态回调地址,如果是钉钉应用则用对应的回调地址。
3. 高频错误评查点改成显示出错次数。
4. 添加开关的通用组件,评查点列表方便修改状态。
This commit is contained in:
2026-01-19 16:22:21 +08:00
parent e332d05e5d
commit 1fca1a2e2e
8 changed files with 270 additions and 18 deletions
+32 -1
View File
@@ -5,7 +5,7 @@
* Remix 会自动排除 .server.ts 文件不打包到客户端
*/
import { OAUTH_CONFIG } from './api-config';
import { OAUTH_CONFIG, portConfigs } from './api-config';
// 用于控制日志输出(避免重复日志)
let hasLoggedSecret = false;
@@ -67,3 +67,34 @@ export function getServerOAuthConfigRuntime() {
};
}
/**
* 获取端口特定的OAuth配置(包含钉钉回调地址)
* @param port 端口号
* @returns OAuth配置(包含内网和钉钉回调地址)
*/
export function getPortOAuthConfig(port: string) {
const secret = getOAuthClientSecret();
const portConfig = portConfigs[port];
if (!portConfig?.oauth) {
console.warn(`⚠️ [oauth-secret.server] 端口 ${port} 没有特定OAuth配置,使用默认配置`);
return {
serverUrl: OAUTH_CONFIG.serverUrl!,
clientId: OAUTH_CONFIG.clientId!,
redirectUri: OAUTH_CONFIG.redirectUri!,
appId: OAUTH_CONFIG.appId!,
clientSecret: secret,
dingtalkRedirectUri: undefined
};
}
return {
serverUrl: OAUTH_CONFIG.serverUrl!,
clientId: OAUTH_CONFIG.clientId!,
redirectUri: portConfig.oauth.redirectUri || OAUTH_CONFIG.redirectUri!,
appId: OAUTH_CONFIG.appId!,
clientSecret: secret,
dingtalkRedirectUri: portConfig.oauth.dingtalkRedirectUri
};
}