feat(auth): Add Oauth configuration for Telegram, Facebook, Google, Github, and Apple

This commit is contained in:
web@ppanel
2025-01-19 20:43:35 +07:00
parent cefcb310d6
commit 18ee600836
133 changed files with 2391 additions and 24 deletions
+38
View File
@@ -226,6 +226,44 @@ export async function updateNodeConfig(body: API.NodeConfig, options?: { [key: s
});
}
/** Get OAuth config GET /v1/admin/system/oauth_config */
export async function getOAuthConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.OAuthQueryResponse }>(
'/v1/admin/system/oauth_config',
{
method: 'GET',
...(options || {}),
},
);
}
/** Update oauth config PUT /v1/admin/system/oauth_config */
export async function updateOAuthConfig(body: API.OAuthConfig, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/oauth_config', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** OAuth create config POST /v1/admin/system/oauth_config */
export async function oAuthCreateConfig(
body: API.OAuthCreateRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/oauth_config', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Get register config GET /v1/admin/system/register_config */
export async function getRegisterConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.RegisterConfig }>('/v1/admin/system/register_config', {
+27
View File
@@ -123,6 +123,7 @@ declare namespace API {
name: string;
description: string;
subscribe_type: string;
platform: ApplicationPlatform;
};
type CreateApplicationVersionRequest = {
@@ -618,6 +619,31 @@ declare namespace API {
last_at: number;
};
type OAuthConfig = {
id: number;
platform: 'github' | 'google' | 'apple' | 'qq' | 'wechat' | 'telegram' | 'facebook';
team_id: string;
key_id: string;
client_id: string;
client_secret: string;
redirect: string;
enabled: boolean;
};
type OAuthCreateRequest = {
platform: 'github' | 'google' | 'apple' | 'qq' | 'wechat' | 'telegram' | 'facebook';
team_id: string;
key_id: string;
client_id: string;
client_secret: string;
enabled: boolean;
redirect: string;
};
type OAuthQueryResponse = {
list: OAuthConfig[];
};
type OnlineUser = {
uid: number;
ip: string;
@@ -1027,6 +1053,7 @@ declare namespace API {
name: string;
description: string;
subscribe_type: string;
platform: ApplicationPlatform;
};
type UpdateApplicationVersionRequest = {