✨ feat(config): Update encryption fields in configuration form and refactor OAuth callback parameters
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// @ts-ignore
|
||||
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as announcement from './announcement';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @ts-ignore
|
||||
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as auth from './auth';
|
||||
|
||||
@@ -3,9 +3,36 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** Apple Login Callback POST /v1/auth/oauth/callback/apple */
|
||||
export async function appleLoginCallback(options?: { [key: string]: any }) {
|
||||
export async function appleLoginCallback(
|
||||
body: {
|
||||
code: string;
|
||||
id_token: string;
|
||||
state: string;
|
||||
},
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const formData = new FormData();
|
||||
|
||||
Object.keys(body).forEach((ele) => {
|
||||
const item = (body as any)[ele];
|
||||
|
||||
if (item !== undefined && item !== null) {
|
||||
if (typeof item === 'object' && !(item instanceof File)) {
|
||||
if (item instanceof Array) {
|
||||
item.forEach((f) => formData.append(ele, f || ''));
|
||||
} else {
|
||||
formData.append(ele, JSON.stringify(item));
|
||||
}
|
||||
} else {
|
||||
formData.append(ele, item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/apple', {
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
requestType: 'form',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
@@ -19,9 +46,16 @@ export async function facebookLoginCallback(options?: { [key: string]: any }) {
|
||||
}
|
||||
|
||||
/** Google Login Callback GET /v1/auth/oauth/callback/google */
|
||||
export async function googleLoginCallback(options?: { [key: string]: any }) {
|
||||
export async function googleLoginCallback(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.GoogleLoginCallbackParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/google', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
+16
@@ -10,6 +10,12 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type AppleLoginCallbackRequest = {
|
||||
code: string;
|
||||
id_token: string;
|
||||
state: string;
|
||||
};
|
||||
|
||||
type Application = {
|
||||
id: number;
|
||||
icon: string;
|
||||
@@ -172,6 +178,16 @@ declare namespace API {
|
||||
tos_content: string;
|
||||
};
|
||||
|
||||
type GoogleLoginCallbackParams = {
|
||||
code: string;
|
||||
state: string;
|
||||
};
|
||||
|
||||
type GoogleLoginCallbackRequest = {
|
||||
code: string;
|
||||
state: string;
|
||||
};
|
||||
|
||||
type Hysteria2 = {
|
||||
port: number;
|
||||
hop_ports: string;
|
||||
|
||||
Reference in New Issue
Block a user