Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fa98c7283 | ||
|
|
6881839e31 |
@@ -440,7 +440,7 @@ async def init_db(request):
|
|||||||
db_iptv.drop_collection("channels")
|
db_iptv.drop_collection("channels")
|
||||||
db_iptv.drop_collection("playlists")
|
db_iptv.drop_collection("playlists")
|
||||||
|
|
||||||
return web.Response(text=str(res),content_type='text/html')
|
return web.json_response({'status': 'ok'})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1138,19 +1138,6 @@ async def get_logo(request):
|
|||||||
return web.Response(body=image_data, content_type="image/jpeg")
|
return web.Response(body=image_data, content_type="image/jpeg")
|
||||||
|
|
||||||
|
|
||||||
async def proxy_image(request):
|
|
||||||
url = request.query.get("url")
|
|
||||||
if not url:
|
|
||||||
return web.Response(status=400, text="Missing URL")
|
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
|
||||||
async with session.get(url) as resp:
|
|
||||||
if resp.status == 200:
|
|
||||||
headers = {"Content-Type": resp.headers["Content-Type"]}
|
|
||||||
return web.Response(body=await resp.read(), headers=headers)
|
|
||||||
else:
|
|
||||||
return web.Response(status=resp.status)
|
|
||||||
|
|
||||||
async def list_logo(request):
|
async def list_logo(request):
|
||||||
result = logos.find({}).limit(1000)
|
result = logos.find({}).limit(1000)
|
||||||
search_string = "harry potter"
|
search_string = "harry potter"
|
||||||
@@ -1475,8 +1462,12 @@ def messageReceived():
|
|||||||
def connect(sid, environ):
|
def connect(sid, environ):
|
||||||
# engineio's aiohttp integration hardcodes REMOTE_ADDR to 127.0.0.1;
|
# engineio's aiohttp integration hardcodes REMOTE_ADDR to 127.0.0.1;
|
||||||
# the real peer address is only available via the underlying aiohttp request.
|
# the real peer address is only available via the underlying aiohttp request.
|
||||||
|
# Behind the nginx reverse proxy, that peer is nginx itself, so prefer the
|
||||||
|
# client IP nginx forwards via X-Real-IP (set in iptv.mrk.ovh.conf).
|
||||||
aiohttp_request = environ.get('aiohttp.request')
|
aiohttp_request = environ.get('aiohttp.request')
|
||||||
ip_address = aiohttp_request.remote if aiohttp_request else ''
|
ip_address = ''
|
||||||
|
if aiohttp_request:
|
||||||
|
ip_address = aiohttp_request.headers.get('X-Real-IP') or aiohttp_request.remote or ''
|
||||||
sio_session_ips[sid] = ip_address
|
sio_session_ips[sid] = ip_address
|
||||||
print("connect ", sid, ip_address, flush=True)
|
print("connect ", sid, ip_address, flush=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user