radames commited on
Commit
6169018
1 Parent(s): 5aa8efd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -81,13 +81,13 @@ app.add_middleware(
81
  )
82
 
83
 
84
- # @app.middleware("http")
85
- # async def validate_origin(request: Request, call_next):
86
- # if DEV:
87
- # return await call_next(request)
88
- # if request.headers.get("referer") not in origins:
89
- # raise HTTPException(status_code=403, detail="Forbidden")
90
- # return await call_next(request)
91
 
92
 
93
  @app.get("/image")
 
81
  )
82
 
83
 
84
+ @app.middleware("http")
85
+ async def validate_origin(request: Request, call_next):
86
+ if DEV:
87
+ return await call_next(request)
88
+ if request.headers.get("referer") not in origins:
89
+ raise HTTPException(status_code=403, detail="Forbidden")
90
+ return await call_next(request)
91
 
92
 
93
  @app.get("/image")