mirror of
https://github.com/Rayzggz/server_torii.git
synced 2025-06-20 06:01:24 +08:00
feat: CAPTCHA session ID
This commit is contained in:
@ -29,13 +29,21 @@ func CheckTorii(w http.ResponseWriter, r *http.Request, reqData dataType.UserReq
|
||||
}
|
||||
return
|
||||
} else if bytes.Compare(decision.ResponseData, []byte("good")) == 0 {
|
||||
w.Header().Set("Set-Cookie", "__torii_clearance="+string(check.GenClearance(reqData, *ruleSet))+"; Path=/; HttpOnly")
|
||||
w.Header().Set("Set-Cookie", "__torii_clearance="+string(check.GenClearance(reqData, *ruleSet))+"; Path=/; Max-Age=86400; Priority=High; HttpOnly;")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, err := w.Write(decision.ResponseData)
|
||||
if err != nil {
|
||||
log.Printf("Error writing response: %v", err)
|
||||
return
|
||||
}
|
||||
} else if bytes.Compare(decision.ResponseData, []byte("timeout")) == 0 {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, err := w.Write([]byte("timeout"))
|
||||
if err != nil {
|
||||
log.Printf("Error writing response: %v", err)
|
||||
return
|
||||
}
|
||||
return
|
||||
} else {
|
||||
//should not be here
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user