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
+3 -1
View File
@@ -1,10 +1,12 @@
// @ts-ignore
/* eslint-disable */
// API 更新时间:
// API 唯一标识:
import * as auth from './auth';
import * as common from './common';
import * as oauth from './oauth';
export default {
auth,
oauth,
common,
};
+47
View File
@@ -0,0 +1,47 @@
// @ts-ignore
/* eslint-disable */
import request from '@/utils/request';
/** Apple Login Callback POST /v1/auth/oauth/callback/apple */
export async function appleLoginCallback(options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/apple', {
method: 'POST',
...(options || {}),
});
}
/** Facebook Login Callback GET /v1/auth/oauth/callback/facebook */
export async function facebookLoginCallback(options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/facebook', {
method: 'GET',
...(options || {}),
});
}
/** Google Login Callback GET /v1/auth/oauth/callback/google */
export async function googleLoginCallback(options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/google', {
method: 'GET',
...(options || {}),
});
}
/** Telegram Login Callback GET /v1/auth/oauth/callback/telegram */
export async function telegramLoginCallback(options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/telegram', {
method: 'GET',
...(options || {}),
});
}
/** OAuth login POST /v1/auth/oauth/login */
export async function oAuthLogin(body: API.OAthLoginRequest, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.OAuthLoginResponse }>('/v1/auth/oauth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
+20
View File
@@ -205,6 +205,26 @@ declare namespace API {
last_at: number;
};
type OAthLoginRequest = {
/** google, facebook, apple, telegram, github etc. */
method: string;
};
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 OAuthLoginResponse = {
redirect: string;
};
type OnlineUser = {
uid: number;
ip: string;