删除dashboard过滤相关的冗余代码

This commit is contained in:
jingrow 2026-01-04 17:35:12 +08:00
parent 67019666b9
commit a135223579
2 changed files with 2 additions and 11 deletions

View File

@ -16,8 +16,7 @@ const getBackendUrl = () => {
} else {
// 生产环境:使用绝对 URL
const backendUrl = import.meta.env.VITE_JINGROW_BACKEND_URL || 'https://cloud.jingrow.com'
// 确保 URL 不以 /dashboard 结尾API 路径应该直接在根路径下)
return backendUrl.replace(/\/dashboard\/?$/, '')
return backendUrl
}
}

View File

@ -18,12 +18,7 @@ import {
// 从环境变量或配置获取 OAuth2 配置
const getOAuth2Config = () => {
// 从环境变量或配置中获取
let backendUrl = import.meta.env.VITE_JINGROW_BACKEND_URL || 'https://cloud.jingrow.com'
// 确保 URL 不以 /dashboard 结尾API 路径应该直接在根路径下)
// 如果用户设置了 /dashboard自动移除
backendUrl = backendUrl.replace(/\/dashboard\/?$/, '')
const backendUrl = import.meta.env.VITE_JINGROW_BACKEND_URL || 'https://cloud.jingrow.com'
const clientId = import.meta.env.VITE_OAUTH2_CLIENT_ID || 'i679osfadt'
const redirectUri = `${window.location.origin}/oauth/callback`
@ -80,7 +75,6 @@ export async function getAuthorizationUrl(state?: string): Promise<string> {
...(state && { state })
})
// 确保 API 路径正确(不应该包含 /dashboard
const apiPath = '/api/action/jingrow.integrations.oauth2.authorize'
const authUrl = `${config.backendUrl}${apiPath}?${params.toString()}`
@ -216,7 +210,6 @@ export async function refreshAccessToken(): Promise<TokenInfo> {
* token
*/
export async function revokeToken(token?: string, tokenTypeHint: 'access_token' | 'refresh_token' = 'access_token'): Promise<void> {
const config = getOAuth2Config()
const tokenToRevoke = token || (tokenTypeHint === 'access_token' ? getAccessToken() : getRefreshToken())
if (!tokenToRevoke) {
@ -254,7 +247,6 @@ export async function revokeToken(token?: string, tokenTypeHint: 'access_token'
* OpenID Connect userinfo
*/
export async function getUserInfo(): Promise<any> {
const config = getOAuth2Config()
const accessToken = getAccessToken()
if (!accessToken) {