Use cloudflare turnstile.

This commit is contained in:
2025-05-15 15:01:39 +08:00
parent 578aab36c3
commit f4e82092eb
11 changed files with 134 additions and 23 deletions

View File

@@ -74,11 +74,12 @@ class Network {
}
}
async register(username: string, password: string): Promise<Response<UserWithToken>> {
async register(username: string, password: string, cfToken: string): Promise<Response<UserWithToken>> {
try {
const response = await axios.postForm(`${this.apiBaseUrl}/user/register`, {
username,
password
password,
cf_token: cfToken
})
return response.data
} catch (e: any) {
@@ -599,8 +600,8 @@ class Network {
}
}
getFileDownloadLink(fileId: string): string {
return `${this.apiBaseUrl}/files/download/${fileId}`;
getFileDownloadLink(fileId: string, cfToken: string): string {
return `${this.apiBaseUrl}/files/download/${fileId}?cf_token=${cfToken}`;
}
async createComment(resourceID: number, content: string): Promise<Response<any>> {