feat: 新增认证服务模块,包含用户注册、登录、令牌管理、GitHub OAuth及用户信息管理功能。

This commit is contained in:
2026-01-26 15:29:47 +08:00
parent 8012ec9bee
commit 22e9478389

View File

@@ -141,7 +141,16 @@ export function getGitHubLoginUrl(state?: string): string {
: '/api/v1'; : '/api/v1';
console.log('[Auth] Generating GitHub URL with base:', baseUrl); console.log('[Auth] Generating GitHub URL with base:', baseUrl);
const url = new URL(`${baseUrl}/auth/github`);
// 处理相对路径问题URL构造函数依然需要完整的 base 才能处理相对路径
let fullUrlString;
if (baseUrl.startsWith('/')) {
fullUrlString = `${window.location.origin}${baseUrl}/auth/github`;
} else {
fullUrlString = `${baseUrl}/auth/github`;
}
const url = new URL(fullUrlString);
if (state) { if (state) {
url.searchParams.append('state', state); url.searchParams.append('state', state);
} }