test/custom-admin-ui #3
+2
-1
@@ -46,7 +46,8 @@ class IPRateLimit:
|
|||||||
self.ips.pop(ip)
|
self.ips.pop(ip)
|
||||||
|
|
||||||
def __call__(self, request: Request):
|
def __call__(self, request: Request):
|
||||||
ip = request.client.host
|
ip = request.headers.get('X-Real-IP', request.headers.get('X-Forwarded-For', request.client.host))
|
||||||
|
print(ip)
|
||||||
if not self.check_ip(ip):
|
if not self.check_ip(ip):
|
||||||
raise HTTPException(status_code=400, detail=f"请求次数过多,请稍后再试")
|
raise HTTPException(status_code=400, detail=f"请求次数过多,请稍后再试")
|
||||||
return ip
|
return ip
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<meta name="description" content="{{description}}"/>
|
<meta name="description" content="{{description}}"/>
|
||||||
<meta name="keywords" content="{{keywords}}"/>
|
<meta name="keywords" content="{{keywords}}"/>
|
||||||
<meta name="generator" content="FileCodeBox"/>
|
<meta name="generator" content="FileCodeBox"/>
|
||||||
<meta name="template" content="Lan-V1.5.4"/>
|
<meta name="template" content="Lan-V1.5.5"/>
|
||||||
<style>
|
<style>
|
||||||
.qu .el-button {
|
.qu .el-button {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
|
|||||||
Reference in New Issue
Block a user