pull/222/head
Aevann 2024-02-01 22:56:45 +02:00
parent e4a000ab21
commit b438c25790
1 changed files with 9 additions and 4 deletions

View File

@ -434,16 +434,21 @@ def orgy(v):
return redirect("/chat")
if SITE == 'watchpeopledie.tv':
import ipinfo
access_token = environ.get("IPINFO_TOKEN").strip()
handler = ipinfo.getHandler(access_token)
@app.get("/1706708037797343.mp4")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
def geoblock():
ip = request.headers.get("X-Forwarded-For")
req = requests.get(f'http://ipinfo.io/{ip}/json')
try:
country = json.loads(req.text)['country']
country = handler.getDetails(ip).country
if country == 'AU':
abort(403, "This video is blocked in Australia.")
except:
print(req.text, flush=True)
except Exception as e:
print(e, flush=True)
return send_file('/videos/1706708037797343.mp4')