mirror of
https://github.com/Findus23/HNReader.git
synced 2024-09-10 04:53:45 +02:00
fix server
This commit is contained in:
parent
662bb277c1
commit
a0ba5a39c5
1 changed files with 2 additions and 2 deletions
|
@ -12,7 +12,7 @@ from config import debug, user_agent, redis_socket, city
|
|||
from hnapi import HNClient
|
||||
from reader import Reader
|
||||
|
||||
geoip = maxminddb.open_database(Path(__file__).parent/'dbip-city-lite-2022-11.mmdb')
|
||||
geoip = maxminddb.open_database(Path(__file__).parent / 'dbip-city-lite-2022-11.mmdb')
|
||||
|
||||
session = AsyncClient(timeout=Timeout(timeout=15.0), headers={
|
||||
"User-Agent": user_agent,
|
||||
|
@ -43,7 +43,7 @@ async def read(request: Request):
|
|||
return "Url not found", 404
|
||||
if not debug and (
|
||||
"x-forwarded-for" not in request.headers
|
||||
or not is_from_city(request.headers["x-forwarded-for"])
|
||||
or not await is_from_city(request.headers["x-forwarded-for"])
|
||||
):
|
||||
return JSONResponse({
|
||||
"title": "Reader View not public",
|
||||
|
|
Loading…
Reference in a new issue