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

@@ -190,8 +190,9 @@ func deleteFile(c fiber.Ctx) error {
}
func downloadFile(c fiber.Ctx) error {
cfToken := c.Query("cf_token")
ip := c.IP()
s, filename, err := service.DownloadFile(ip, c.Params("id"))
s, filename, err := service.DownloadFile(ip, c.Params("id"), cfToken)
if err != nil {
return err
}

View File

@@ -13,10 +13,11 @@ import (
func handleUserRegister(c fiber.Ctx) error {
username := c.FormValue("username")
password := c.FormValue("password")
cfToken := c.FormValue("cf_token")
if username == "" || password == "" {
return model.NewRequestError("Username and password are required")
}
user, err := service.CreateUser(username, password)
user, err := service.CreateUser(username, password, cfToken)
if err != nil {
return err
}