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:
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})
dl = ItemDTO(
@ -134,7 +133,7 @@ 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
)

View file

@ -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'),

View file

@ -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):

View file

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