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
+29 -2
View File
@@ -3,7 +3,7 @@ import { useEffect } from "react";
import { useSearchParams } from "@remix-run/react";
import { createUserSession, sessionStorage } from "~/api/login/auth.server";
import { OAuthClient } from "~/api/login/oauth-client";
import { getServerOAuthConfigRuntime } from "~/config/oauth-secret.server";
import { getServerOAuthConfigRuntime, getPortOAuthConfig } from "~/config/oauth-secret.server";
import { loginWithOAuth, type LoginRequest } from "~/api/login/login-client";
import { isMobileDevice, MOBILE_CHAT_PATH } from "~/utils/mobile-detect.server";
@@ -106,9 +106,36 @@ export async function loader({ request }: LoaderFunctionArgs) {
console.log("✅ OAuth2.0回调参数验证通过");
// 🔑 判断是否从钉钉登录:检查 remote-user header
const remoteUser = request.headers.get("remote-user");
const isDingTalkLogin = remoteUser !== null;
console.log("🔧 [Callback] remote-user 检测:", {
remoteUser: remoteUser,
isDingTalkLogin: isDingTalkLogin,
loginType: isDingTalkLogin ? '钉钉Web登录' : '内网Web登录'
});
// 声明在 try 外部,以便在 catch 中访问
let tokenResponse = null;
const oauthClient = new OAuthClient(getServerOAuthConfigRuntime());
// 获取端口特定的OAuth配置(包含钉钉回调地址)
const portOAuthConfig = getPortOAuthConfig(port);
const oauthClient = new OAuthClient(portOAuthConfig);
// 🔑 根据登录类型设置回调地址
if (isDingTalkLogin) {
// 钉钉登录:使用钉钉回调地址
if (portOAuthConfig.dingtalkRedirectUri) {
oauthClient.setRedirectUri(portOAuthConfig.dingtalkRedirectUri);
console.log("🔧 [Callback] 使用钉钉回调地址:", portOAuthConfig.dingtalkRedirectUri);
} else {
console.warn("⚠️ [Callback] 钉钉登录但未配置钉钉回调地址,使用默认内网地址");
}
} else {
// 内网登录:使用默认内网回调地址
console.log("🔧 [Callback] 使用内网回调地址:", portOAuthConfig.redirectUri);
}
try {
console.log("🔧 开始处理OAuth2.0回调");
+4 -3
View File
@@ -411,7 +411,7 @@ export default function Home() {
<tr className="border-b border-gray-200">
<th className="py-3 px-4 text-left font-medium text-gray-700"></th>
<th className="py-3 px-4 text-left font-medium text-gray-700"></th>
<th className="py-3 px-4 text-right font-medium text-gray-700"></th>
<th className="py-3 px-4 text-right font-medium text-gray-700"></th>
</tr>
</thead>
<tbody>
@@ -430,8 +430,9 @@ export default function Home() {
<td className="py-3 px-4 text-gray-900">{item.point_name}</td>
<td className="py-3 px-4 text-right">
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
<i className="ri-user-line mr-1"></i>
{item.error_user_count}
{/* <i className="ri-user-line mr-1"></i> */}
{/* <i className="ri-numbers-line mr-1"></i> */}
<p className="text-sm mr-0.5">{item.error_user_count}</p>
</span>
</td>
</tr>