Refactoring

This commit is contained in:
2022-01-26 16:24:09 +01:00
parent 551ff95660
commit 9b0dc4d21b
12 changed files with 5268 additions and 84 deletions

View File

@@ -5,8 +5,13 @@ const Koa = require('koa'),
{ join } = require('path'),
{ Server } = require('socket.io'),
{ createServer } = require('http'),
{ download, abortDownload, retriveDownload } = require('./lib/downloader'),
{ ytdlpUpdater } = require('./lib/updater'),
{
download,
abortDownload,
retriveDownload,
abortAllDownloads
} = require('./lib/downloader'),
db = require('./lib/db');
const app = new Koa()
@@ -25,8 +30,11 @@ io.on('connection', socket => {
logger('ws', args?.url)
download(socket, args)
})
socket.on('abort', () => {
abortDownload(socket)
socket.on('abort', (args) => {
abortDownload(socket, args)
})
socket.on('abort-all', () => {
abortAllDownloads(socket)
})
socket.on('update-bin', () => {
ytdlpUpdater(socket)