mirror of
https://github.com/Findus23/HNReader.git
synced 2024-09-19 15:23:44 +02:00
correct IP detection
This commit is contained in:
parent
de98a843f9
commit
ae4fe2fd42
1 changed files with 4 additions and 1 deletions
|
@ -33,7 +33,10 @@ async def read(request: Request):
|
|||
item = await api.get_item(item_id)
|
||||
if "url" not in item:
|
||||
return "Url not found", 404
|
||||
if not debug and request.client not in trusted_ips:
|
||||
if not debug and (
|
||||
"x-forwarded-for" not in request.headers
|
||||
or request.headers["x-forwarded-for"] not in trusted_ips
|
||||
):
|
||||
return JSONResponse({
|
||||
"title": "Reader View not public",
|
||||
"html": "For security reasons, this instance doesn't allow fetching a reader-friendly version of the website."
|
||||
|
|
Loading…
Reference in a new issue