From cd712b4c5a71b65632bded8104ff2aae2b65ab2d Mon Sep 17 00:00:00 2001
From: ArabCoders
Date: Sat, 3 Feb 2024 00:39:05 +0300
Subject: [PATCH 1/5] parse webhook response body.
---
app/Webhooks.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/Webhooks.py b/app/Webhooks.py
index 5228b459..2887f98c 100644
--- a/app/Webhooks.py
+++ b/app/Webhooks.py
@@ -52,12 +52,17 @@ class Webhooks:
async with client.ClientSession() as session:
headers = req.get('headers', {}) if 'headers' in req else {}
async with session.request(method=req.get('method', 'POST'), url=req.get('url'), json=item.__dict__, headers=headers) as response:
- LOG.info(f"[{target.get('name')}] Response to [{event=} {item.id=}] [status: {response.status}].")
- return {
+ respData = {
'url': req.get('url'),
'status': response.status,
'text': await response.text()
}
+ msg = f"[{target.get('name')}] Response to [{event=} {item.id=}] [status: {response.status}]."
+ if respData.get('text'):
+ msg += f" [Body: {respData.get('text','??')}]"
+ LOG.info(msg)
+
+ return respData
except Exception as e:
return {
'url': req.get('url'),
From 18526bad3894ebc9fa85a555fb4ba74a705a12f4 Mon Sep 17 00:00:00 2001
From: ArabCoders
Date: Sat, 3 Feb 2024 16:18:55 +0300
Subject: [PATCH 2/5] Fixes for is_live flag.
---
app/DownloadQueue.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/app/DownloadQueue.py b/app/DownloadQueue.py
index 486442a2..e04f1cfc 100644
--- a/app/DownloadQueue.py
+++ b/app/DownloadQueue.py
@@ -118,9 +118,7 @@ class DownloadQueue:
except KeyError:
pass
- is_manifestless = 'post_live' == entry.get('live_status') if 'live_status' in entry else None
-
- options.update({'is_manifestless': is_manifestless})
+ options.update({'is_manifestless': 'post_live' == entry.get('live_status', None)})
dl = ItemDTO(
id=entry.get('id'),
@@ -134,9 +132,9 @@ class DownloadQueue:
output_template=output_template if output_template else self.config.output_template,
datetime=formatdate(time.time()),
error=error,
- is_live=entry.get('is_live', None) or live_in is not None,
+ is_live=entry.get('is_live', None) or 'is_live' == entry.get('live_status', None) or live_in,
live_in=live_in,
- options=options
+ options=options,
)
try:
From 8685c01969837a66711c81a34ab581beb9ec3e92 Mon Sep 17 00:00:00 2001
From: ArabCoders
Date: Sat, 3 Feb 2024 16:19:47 +0300
Subject: [PATCH 3/5] fix
---
app/DownloadQueue.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/DownloadQueue.py b/app/DownloadQueue.py
index e04f1cfc..b974cf26 100644
--- a/app/DownloadQueue.py
+++ b/app/DownloadQueue.py
@@ -118,7 +118,8 @@ class DownloadQueue:
except KeyError:
pass
- options.update({'is_manifestless': 'post_live' == entry.get('live_status', None)})
+ is_manifestless = entry.get('is_manifestless', False)
+ options.update({'is_manifestless': is_manifestless})
dl = ItemDTO(
id=entry.get('id'),
@@ -134,7 +135,7 @@ class DownloadQueue:
error=error,
is_live=entry.get('is_live', None) or 'is_live' == entry.get('live_status', None) or live_in,
live_in=live_in,
- options=options,
+ options=options
)
try:
From 86a52862da441fd726c5558fb043dfe7f52613bb Mon Sep 17 00:00:00 2001
From: ArabCoders
Date: Sat, 3 Feb 2024 19:04:49 +0300
Subject: [PATCH 4/5] Changed completed ui name to history.
---
frontend/src/components/Page-Completed.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontend/src/components/Page-Completed.vue b/frontend/src/components/Page-Completed.vue
index a13156fa..6c18559f 100644
--- a/frontend/src/components/Page-Completed.vue
+++ b/frontend/src/components/Page-Completed.vue
@@ -4,7 +4,7 @@
- Completed ({{ getTotal }})
+ History ({{ getTotal }})
@@ -197,7 +197,7 @@
- No downloads records.
+ No records.
From 620caf9caa7e642028779db5548a6b358183efec Mon Sep 17 00:00:00 2001
From: ArabCoders
Date: Fri, 16 Feb 2024 16:07:20 +0300
Subject: [PATCH 5/5] Attempt at fix for response hang when the app has been
running for long time.
---
app/main.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/app/main.py b/app/main.py
index 095eccb4..6e65f265 100644
--- a/app/main.py
+++ b/app/main.py
@@ -31,6 +31,7 @@ class Main:
connection: sqlite3.Connection = None
queue: DownloadQueue = None
loop: asyncio.AbstractEventLoop = None
+ appLoader: str = None
def __init__(self):
self.config = Config.get_instance()
@@ -349,10 +350,14 @@ class Main:
@self.routes.get(self.config.url_prefix)
async def index(_) -> Response:
- return web.FileResponse(os.path.join(
- os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
- 'frontend/dist/index.html'
- ))
+ if not self.appLoader:
+ with open(os.path.join(
+ os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
+ 'frontend/dist/index.html'
+ ), 'r') as f:
+ self.appLoader = f.read()
+
+ return web.Response(text=self.appLoader, content_type='text/html', charset='utf-8', status=200)
@self.sio.event()
async def connect(sid, environ):