From e3f9774edaa6ce81f4262efe138b1b7ddf5d4cbc Mon Sep 17 00:00:00 2001 From: erio Date: Fri, 6 Mar 2026 21:10:02 +0800 Subject: [PATCH] fix(sora): add GDrive OAuth callback page for postMessage flow The OAuth flow opens a popup window that redirects to /admin/gdrive-oauth-callback, but this route and page were missing. Add the callback view that extracts the authorization code from the URL and sends it back to the opener window via postMessage, completing the OAuth authorization flow. Co-Authored-By: Claude Opus 4.6 --- frontend/src/i18n/locales/en.ts | 4 +- frontend/src/i18n/locales/zh.ts | 4 +- frontend/src/router/index.ts | 11 +++ .../views/admin/GDriveOAuthCallbackView.vue | 71 +++++++++++++++++++ 4 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 frontend/src/views/admin/GDriveOAuthCallbackView.vue diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index d9c535453e..3b70bb1e90 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -3974,7 +3974,9 @@ export default { authorizeHint: 'Get Refresh Token via OAuth2', oauthFieldsRequired: 'Please fill in Client ID and Client Secret first', oauthSuccess: 'Google Drive authorization successful', - oauthFailed: 'Google Drive authorization failed' + oauthFailed: 'Google Drive authorization failed', + closeWindow: 'This window will close automatically', + processing: 'Processing authorization...' } }, streamTimeout: { diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index 8023666af6..a2ec660f70 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -4134,7 +4134,9 @@ export default { authorizeHint: '通过 OAuth2 获取 Refresh Token', oauthFieldsRequired: '请先填写 Client ID 和 Client Secret', oauthSuccess: 'Google Drive 授权成功', - oauthFailed: 'Google Drive 授权失败' + oauthFailed: 'Google Drive 授权失败', + closeWindow: '此窗口将自动关闭', + processing: '正在处理授权...' } }, streamTimeout: { diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index d235de517e..d8d17550c7 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -225,6 +225,17 @@ const routes: RouteRecordRaw[] = [ } }, + // ==================== Admin OAuth Callback Routes ==================== + { + path: '/admin/gdrive-oauth-callback', + name: 'GDriveOAuthCallback', + component: () => import('@/views/admin/GDriveOAuthCallbackView.vue'), + meta: { + requiresAuth: false, + title: 'Google Drive OAuth' + } + }, + // ==================== Admin Routes ==================== { path: '/admin', diff --git a/frontend/src/views/admin/GDriveOAuthCallbackView.vue b/frontend/src/views/admin/GDriveOAuthCallbackView.vue new file mode 100644 index 0000000000..f8f41c1fd6 --- /dev/null +++ b/frontend/src/views/admin/GDriveOAuthCallbackView.vue @@ -0,0 +1,71 @@ + + +