Fix crashing /init_db and remove dead proxy_image handler
/init_db dropped the channels/playlists collections then crashed on an undefined `res` variable, so the "Reset DB" button in the UI always surfaced a 500 even though the wipe had already happened. proxy_image used aiohttp.ClientSession without importing aiohttp and was never routed or called from the frontend, so it's just removed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
55cefe47f4
commit
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user