Работа над проектом

This commit is contained in:
Book Pauk
2022-09-25 16:12:54 +07:00
parent 1cfa787e5a
commit 7e5ea30579
5 changed files with 140 additions and 7 deletions

View File

@@ -72,6 +72,8 @@ class WebSocketController {
await this.getBookList(req, ws); break;
case 'get-genre-tree':
await this.getGenreTree(req, ws); break;
case 'get-book-link':
await this.getBookLink(req, ws); break;
default:
throw new Error(`Action not found: ${req.action}`);
@@ -141,6 +143,15 @@ class WebSocketController {
this.send(result, req, ws);
}
async getBookLink(req, ws) {
if (!utils.hasProp(req, 'bookPath'))
throw new Error(`bookPath is empty`);
const result = await this.webWorker.getBookLink(req.bookPath);
this.send(result, req, ws);
}
}
module.exports = WebSocketController;