Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,13 +81,13 @@ app.add_middleware(
|
|
| 81 |
)
|
| 82 |
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 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")
|