File tree Expand file tree Collapse file tree
background_process/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,11 @@ def process_check_firewall_lists(
3535 if user_agent is not None and isinstance (user_agent , str ):
3636 # User agent blocking (e.g. blocking AI scrapers)
3737 if connection_manager .firewall_lists .is_user_agent_blocked (user_agent ):
38- reason = "You"
3938 return {
4039 "blocked" : True ,
4140 "type" : "bot-blocking" ,
4241 }
42+
43+ return {
44+ "blocked" : False ,
45+ }
Original file line number Diff line number Diff line change @@ -59,22 +59,21 @@ def pre_response():
5959 },
6060 receive = True ,
6161 )
62- if not check_fw_lists_res ["success" ] or not check_fw_lists_res ["blocked" ]:
62+ if not check_fw_lists_res ["success" ] or not check_fw_lists_res ["data" ][ " blocked" ]:
6363 return
6464
65- if check_fw_lists_res ["type" ] == "allowlist" :
65+ block_type = check_fw_lists_res ["data" ]["type" ]
66+
67+ if block_type == "allowlist" :
6668 message = "Your IP address is not allowed."
6769 message += " (Your IP: " + context .remote_address + ")"
6870 return message , 403
69-
70- if check_fw_lists_res ["data" ]["type" ] == "blocklist" :
71+ if block_type == "blocklist" :
7172 message = "Your IP address is blocked due to "
7273 message += check_fw_lists_res ["data" ]["reason" ]
7374 message += " (Your IP: " + context .remote_address + ")"
7475 return message , 403
75-
76- # User agent blocking (e.g. blocking AI scrapers)
77- if check_fw_lists_res ["data" ]["type" ] == "bot-blocking" :
76+ if block_type == "bot-blocking" :
7877 msg = "You are not allowed to access this resource because you have been identified as a bot."
7978 return msg , 403
8079
You can’t perform that action at this time.
0 commit comments