Merge pull request #70 from arabcoders/dev

Small additions
This commit is contained in:
Abdulmohsen 2024-02-16 16:12:04 +03:00 committed by GitHub
commit 022eb86dea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 11 deletions

View file

@ -118,8 +118,7 @@ class DownloadQueue:
except KeyError: except KeyError:
pass pass
is_manifestless = 'post_live' == entry.get('live_status') if 'live_status' in entry else None is_manifestless = entry.get('is_manifestless', False)
options.update({'is_manifestless': is_manifestless}) options.update({'is_manifestless': is_manifestless})
dl = ItemDTO( dl = ItemDTO(
@ -134,7 +133,7 @@ class DownloadQueue:
output_template=output_template if output_template else self.config.output_template, output_template=output_template if output_template else self.config.output_template,
datetime=formatdate(time.time()), datetime=formatdate(time.time()),
error=error, 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, live_in=live_in,
options=options options=options
) )

View file

@ -52,12 +52,17 @@ class Webhooks:
async with client.ClientSession() as session: async with client.ClientSession() as session:
headers = req.get('headers', {}) if 'headers' in req else {} 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: 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}].") respData = {
return {
'url': req.get('url'), 'url': req.get('url'),
'status': response.status, 'status': response.status,
'text': await response.text() '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: except Exception as e:
return { return {
'url': req.get('url'), 'url': req.get('url'),

View file

@ -31,6 +31,7 @@ class Main:
connection: sqlite3.Connection = None connection: sqlite3.Connection = None
queue: DownloadQueue = None queue: DownloadQueue = None
loop: asyncio.AbstractEventLoop = None loop: asyncio.AbstractEventLoop = None
appLoader: str = None
def __init__(self): def __init__(self):
self.config = Config.get_instance() self.config = Config.get_instance()
@ -349,10 +350,14 @@ class Main:
@self.routes.get(self.config.url_prefix) @self.routes.get(self.config.url_prefix)
async def index(_) -> Response: async def index(_) -> Response:
return web.FileResponse(os.path.join( if not self.appLoader:
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), with open(os.path.join(
'frontend/dist/index.html' 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() @self.sio.event()
async def connect(sid, environ): async def connect(sid, environ):

View file

@ -4,7 +4,7 @@
<span class="icon"> <span class="icon">
<font-awesome-icon :icon="showCompleted ? 'fa-solid fa-arrow-up' : 'fa-solid fa-arrow-down'" /> <font-awesome-icon :icon="showCompleted ? 'fa-solid fa-arrow-up' : 'fa-solid fa-arrow-down'" />
</span> </span>
<span>Completed <span v-if="hasItems">({{ getTotal }})</span></span> <span>History <span v-if="hasItems">({{ getTotal }})</span></span>
</span> </span>
</h1> </h1>
@ -197,7 +197,7 @@
<span class="icon has-text-success"> <span class="icon has-text-success">
<font-awesome-icon icon="fa-solid fa-circle-check" /> <font-awesome-icon icon="fa-solid fa-circle-check" />
</span> </span>
<span>No downloads records.</span> <span>No records.</span>
</span> </span>
</p> </p>
<p v-else> <p v-else>