mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Use cloudflare turnstile.
This commit is contained in:
@@ -385,7 +385,16 @@ func GetFile(fid string) (*model.FileView, error) {
|
||||
return file.ToView(), nil
|
||||
}
|
||||
|
||||
func DownloadFile(ip string, fid string) (string, string, error) {
|
||||
func DownloadFile(ip, fid, cfToken string) (string, string, error) {
|
||||
passed, err := verifyCfToken(cfToken)
|
||||
if err != nil {
|
||||
log.Error("failed to verify cf token: ", err)
|
||||
return "", "", model.NewRequestError("failed to verify cf token")
|
||||
}
|
||||
if !passed {
|
||||
log.Info("cf token verification failed")
|
||||
return "", "", model.NewRequestError("cf token verification failed")
|
||||
}
|
||||
downloads, _ := ipDownloads.Load(ip)
|
||||
if downloads == nil {
|
||||
ipDownloads.Store(ip, 1)
|
||||
|
Reference in New Issue
Block a user