From 8108af29a8db14bd0a5f0d5a7e4c7c041b2d3c86 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 21 Nov 2025 16:48:29 +0800 Subject: [PATCH] perf(X-Pack): Optimize OAuth2 customization logic --- backend/common/core/config.py | 3 ++- frontend/src/i18n/en.json | 4 +++- frontend/src/i18n/ko-KR.json | 4 +++- frontend/src/i18n/zh-CN.json | 4 +++- .../views/system/authentication/Oauth2Editor.vue | 16 ++++++++++++++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/backend/common/core/config.py b/backend/common/core/config.py index 18be18c9..b2c2d66f 100644 --- a/backend/common/core/config.py +++ b/backend/common/core/config.py @@ -64,7 +64,8 @@ def all_cors_origins(self) -> list[str]: LOG_DIR: str = "logs" LOG_FORMAT: str = "%(asctime)s - %(name)s - %(levelname)s:%(lineno)d - %(message)s" SQL_DEBUG: bool = False - + BASE_DIR: str = "/opt/sqlbot" + SCRIPT_DIR: str = f"{BASE_DIR}/scripts" UPLOAD_DIR: str = "/opt/sqlbot/data/file" SQLBOT_KEY_EXPIRED: int = 100 # License key expiration timestamp, 0 means no expiration diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 7750e985..26a71792 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -723,7 +723,9 @@ "userinfo_url": "User Info URL", "token_url": "Token URL", "revoke_url": "Revocation URL", - "oauth2_field_mapping_placeholder": "Example: {'{'}\"account\": \"OAuth2Account\", \"name\": \"OAuth2Name\", \"email\": \"email\"{'}'}" + "oauth2_field_mapping_placeholder": "Example: {'{'}\"account\": \"OAuth2Account\", \"name\": \"OAuth2Name\", \"email\": \"email\"{'}'}", + "token_auth_method": "Token auth method", + "userinfo_auth_method": "Userinfo auth method" }, "login": { "default_login": "Default", diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json index 17108521..30275b48 100644 --- a/frontend/src/i18n/ko-KR.json +++ b/frontend/src/i18n/ko-KR.json @@ -723,7 +723,9 @@ "userinfo_url": "사용자 정보 URL", "token_url": "토큰 URL", "revoke_url": "취소 URL", - "oauth2_field_mapping_placeholder": "예: {'{'}\"account\": \"OAuth2Account\", \"name\": \"OAuth2Name\", \"email\": \"email\"{'}'}" + "oauth2_field_mapping_placeholder": "예: {'{'}\"account\": \"OAuth2Account\", \"name\": \"OAuth2Name\", \"email\": \"email\"{'}'}", + "token_auth_method": "토큰 인증 방식", + "userinfo_auth_method": "사용자 정보 인증 방식" }, "login": { "default_login": "기본값", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index e4c00fc1..06ecb6f3 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -723,7 +723,9 @@ "userinfo_url": "用户信息地址", "token_url": "令牌地址", "revoke_url": "撤销地址", - "oauth2_field_mapping_placeholder": "例如:{'{'}\"account\": \"oauth2Account\", \"name\": \"oauth2Name\", \"email\": \"email\"{'}'}" + "oauth2_field_mapping_placeholder": "例如:{'{'}\"account\": \"oauth2Account\", \"name\": \"oauth2Name\", \"email\": \"email\"{'}'}", + "token_auth_method": "Token 认证方式", + "userinfo_auth_method": "用户信息认证方式" }, "login": { "default_login": "默认", diff --git a/frontend/src/views/system/authentication/Oauth2Editor.vue b/frontend/src/views/system/authentication/Oauth2Editor.vue index 71e38895..45b59fef 100644 --- a/frontend/src/views/system/authentication/Oauth2Editor.vue +++ b/frontend/src/views/system/authentication/Oauth2Editor.vue @@ -27,6 +27,8 @@ const state = reactive({ client_id: '', client_secret: '', redirect_url: '', + token_auth_method: 'basic', + userinfo_auth_method: 'header', mapping: '', }), }) @@ -359,6 +361,20 @@ onBeforeMount(() => { --> + + + Basic + Body + + + + + + Header + Query + + +