🐛 fix: Fix bugs

This commit is contained in:
web
2025-10-21 04:10:34 -07:00
parent c2bfee1f31
commit a46657d5ef
15 changed files with 276 additions and 19 deletions
+1
View File
@@ -20,6 +20,7 @@ export default function PhoneAuthForm() {
const [type, setType] = useState<'login' | 'register' | 'reset'>('login');
const [loading, startTransition] = useTransition();
const [initialValues, setInitialValues] = useState<API.TelephoneLoginRequest>({
identifier: '',
telephone: '',
telephone_area_code: '1',
password: '',
@@ -19,6 +19,8 @@ export default function Certification({ platform, children }: CertificationProps
oAuthLoginGetToken({
method: platform,
callback: searchParams,
// @ts-ignore
invite: localStorage.getItem('invite') || '',
})
.then((res) => {
const token = res?.data?.data?.token;
+12
View File
@@ -47,6 +47,18 @@ export async function userLogin(body: API.UserLoginRequest, options?: { [key: st
});
}
/** Device Login POST /v1/auth/login/device */
export async function deviceLogin(body: API.DeviceLoginRequest, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.LoginResponse }>('/v1/auth/login/device', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** User Telephone login POST /v1/auth/login/telephone */
export async function telephoneLogin(
body: API.TelephoneLoginRequest,
+21 -1
View File
@@ -114,6 +114,7 @@ declare namespace API {
type AuthConfig = {
mobile: MobileAuthenticateConfig;
email: EmailAuthticateConfig;
device: DeviceAuthticateConfig;
register: PubilcRegisterConfig;
};
@@ -211,6 +212,19 @@ declare namespace API {
currency_symbol: string;
};
type DeviceAuthticateConfig = {
enable: boolean;
show_ads: boolean;
enable_security: boolean;
only_real_device: boolean;
};
type DeviceLoginRequest = {
identifier: string;
user_agent: string;
cf_token?: string;
};
type Document = {
id: number;
title: string;
@@ -324,7 +338,7 @@ declare namespace API {
state: string;
};
type Hysteria = {
type Hysteria2 = {
port: number;
hop_ports: string;
hop_interval: number;
@@ -706,6 +720,7 @@ declare namespace API {
};
type ResetPasswordRequest = {
identifier: string;
email: string;
password: string;
code?: string;
@@ -898,6 +913,7 @@ declare namespace API {
};
type TelephoneLoginRequest = {
identifier: string;
telephone: string;
telephone_code: string;
telephone_area_code: string;
@@ -906,6 +922,7 @@ declare namespace API {
};
type TelephoneRegisterRequest = {
identifier: string;
telephone: string;
telephone_area_code: string;
password: string;
@@ -915,6 +932,7 @@ declare namespace API {
};
type TelephoneResetPasswordRequest = {
identifier: string;
telephone: string;
telephone_area_code: string;
password: string;
@@ -1035,12 +1053,14 @@ declare namespace API {
};
type UserLoginRequest = {
identifier: string;
email: string;
password: string;
cf_token?: string;
};
type UserRegisterRequest = {
identifier: string;
email: string;
password: string;
invite?: string;
+11
View File
@@ -19,3 +19,14 @@ export async function querySubscribeList(
},
);
}
/** Get user subscribe node info GET /v1/public/subscribe/node/list */
export async function queryUserSubscribeNodeList(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.QueryUserSubscribeNodeListResponse }>(
'/v1/public/subscribe/node/list',
{
method: 'GET',
...(options || {}),
},
);
}
+55 -1
View File
@@ -108,6 +108,7 @@ declare namespace API {
type AuthConfig = {
mobile: MobileAuthenticateConfig;
email: EmailAuthticateConfig;
device: DeviceAuthticateConfig;
register: PubilcRegisterConfig;
};
@@ -204,6 +205,13 @@ declare namespace API {
currency_symbol: string;
};
type DeviceAuthticateConfig = {
enable: boolean;
show_ads: boolean;
enable_security: boolean;
only_real_device: boolean;
};
type Document = {
id: number;
title: string;
@@ -256,6 +264,11 @@ declare namespace API {
list: PaymentMethod[];
};
type GetDeviceListResponse = {
list: UserDevice[];
total: number;
};
type GetLoginLogParams = {
page: number;
size: number;
@@ -343,7 +356,7 @@ declare namespace API {
list: Ticket[];
};
type Hysteria = {
type Hysteria2 = {
port: number;
hop_ports: string;
hop_interval: number;
@@ -799,6 +812,10 @@ declare namespace API {
total: number;
};
type QueryUserSubscribeNodeListResponse = {
list: UserSubscribeInfo[];
};
type RechargeOrderRequest = {
amount: number;
payment: number;
@@ -1039,6 +1056,10 @@ declare namespace API {
security_config: SecurityConfig;
};
type UnbindDeviceRequest = {
id: number;
};
type UnbindOAuthRequest = {
method: string;
};
@@ -1150,6 +1171,26 @@ declare namespace API {
updated_at: number;
};
type UserSubscribeInfo = {
id: number;
user_id: number;
order_id: number;
subscribe_id: number;
start_time: number;
expire_time: number;
finished_at: number;
reset_time: number;
traffic: number;
download: number;
upload: number;
token: string;
status: number;
created_at: number;
updated_at: number;
is_try_out: boolean;
nodes: UserSubscribeNodeInfo[];
};
type UserSubscribeLog = {
id: number;
user_id: number;
@@ -1160,6 +1201,19 @@ declare namespace API {
timestamp: number;
};
type UserSubscribeNodeInfo = {
id: number;
name: string;
uuid: string;
protocol: string;
port: number;
address: string;
tags: string[];
country: string;
city: string;
created_at: number;
};
type VerifyCodeConfig = {
verify_code_expire_time: number;
verify_code_limit: number;
+23
View File
@@ -128,6 +128,14 @@ export async function queryUserCommissionLog(
);
}
/** Get Device List GET /v1/public/user/devices */
export async function getDeviceList(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetDeviceListResponse }>('/v1/public/user/devices', {
method: 'GET',
...(options || {}),
});
}
/** Query User Info GET /v1/public/user/info */
export async function queryUserInfo(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.User }>('/v1/public/user/info', {
@@ -236,6 +244,21 @@ export async function resetUserSubscribeToken(
});
}
/** Unbind Device PUT /v1/public/user/unbind_device */
export async function unbindDevice(
body: API.UnbindDeviceRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/public/user/unbind_device', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Unbind OAuth POST /v1/public/user/unbind_oauth */
export async function unbindOAuth(body: API.UnbindOAuthRequest, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/public/user/unbind_oauth', {