Перенос на сервер работы с именами файлов при скачивании

This commit is contained in:
Book Pauk
2022-11-06 18:03:03 +07:00
parent d9f1912ea2
commit 55239159ba
6 changed files with 69 additions and 106 deletions

View File

@@ -165,23 +165,19 @@ class WebSocketController {
}
async getBookLink(req, ws) {
if (!utils.hasProp(req, 'bookPath'))
throw new Error(`bookPath is empty`);
if (!utils.hasProp(req, 'downFileName'))
throw new Error(`downFileName is empty`);
if (!utils.hasProp(req, 'bookId'))
throw new Error(`bookId is empty`);
const result = await this.webWorker.getBookLink({bookPath: req.bookPath, downFileName: req.downFileName});
const result = await this.webWorker.getBookLink(req.bookId);
this.send(result, req, ws);
}
async getBookInfo(req, ws) {
if (!utils.hasProp(req, 'bookPath'))
throw new Error(`bookPath is empty`);
if (!utils.hasProp(req, 'downFileName'))
throw new Error(`downFileName is empty`);
if (!utils.hasProp(req, 'bookId'))
throw new Error(`bookId is empty`);
const result = await this.webWorker.getBookInfo({bookPath: req.bookPath, downFileName: req.downFileName});
const result = await this.webWorker.getBookInfo(req.bookId);
this.send(result, req, ws);
}