diff --git a/client/components/Api/Api.vue b/client/components/Api/Api.vue
index b37c478..3ad07a8 100644
--- a/client/components/Api/Api.vue
+++ b/client/components/Api/Api.vue
@@ -235,6 +235,10 @@ class Api {
return await this.request(Object.assign({action: 'get-book-link'}, params), 120);
}
+ async getBookInfo(params) {
+ return await this.request(Object.assign({action: 'get-book-info'}, params), 120);
+ }
+
async getConfig() {
return await this.request({action: 'get-config'});
}
diff --git a/client/components/Search/BaseList.js b/client/components/Search/BaseList.js
index 0a5d23e..0118659 100644
--- a/client/components/Search/BaseList.js
+++ b/client/components/Search/BaseList.js
@@ -185,6 +185,10 @@ export default class BaseList {
const url = this.config.bookReadLink.replace('${DOWNLOAD_LINK}', href);
window.open(url, '_blank');
}
+ } else if (action == 'bookInfo') {
+ //информация о книге
+ const response = await this.api.getBookInfo({bookPath, downFileName});
+ this.$emit('listEvent', {action: 'bookInfo', data: response.bookInfo});
}
} catch(e) {
this.$root.stdDialog.alert(e.message, 'Ошибка');
@@ -208,6 +212,7 @@ export default class BaseList {
case 'download':
case 'copyLink':
case 'readBook':
+ case 'bookInfo':
this.download(event.book, event.action);//no await
break;
}
diff --git a/client/components/Search/BookInfoDialog/BookInfoDialog.vue b/client/components/Search/BookInfoDialog/BookInfoDialog.vue
new file mode 100644
index 0000000..2c3ce57
--- /dev/null
+++ b/client/components/Search/BookInfoDialog/BookInfoDialog.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/components/Search/BookView/BookView.vue b/client/components/Search/BookView/BookView.vue
index 463bbef..688d656 100644
--- a/client/components/Search/BookView/BookView.vue
+++ b/client/components/Search/BookView/BookView.vue
@@ -55,7 +55,7 @@
{{ bookSize }}, {{ book.ext }}
-
+
[ . . . ]
diff --git a/client/components/Search/Search.vue b/client/components/Search/Search.vue
index fe70ec7..bed5d14 100644
--- a/client/components/Search/Search.vue
+++ b/client/components/Search/Search.vue
@@ -250,6 +250,7 @@
+
@@ -266,6 +267,7 @@ import SelectGenreDialog from './SelectGenreDialog/SelectGenreDialog.vue';
import SelectLangDialog from './SelectLangDialog/SelectLangDialog.vue';
import SelectLibRateDialog from './SelectLibRateDialog/SelectLibRateDialog.vue';
import SelectDateDialog from './SelectDateDialog/SelectDateDialog.vue';
+import BookInfoDialog from './BookInfoDialog/BookInfoDialog.vue';
import authorBooksStorage from './authorBooksStorage';
import DivBtn from '../share/DivBtn.vue';
@@ -292,6 +294,7 @@ const componentOptions = {
SelectLangDialog,
SelectLibRateDialog,
SelectDateDialog,
+ BookInfoDialog,
Dialog,
DivBtn
},
@@ -404,6 +407,7 @@ class Search {
selectLangDialogVisible = false;
selectLibRateDialogVisible = false;
selectDateDialogVisible = false;
+ bookInfoDialogVisible = false;
pageCount = 1;
@@ -458,6 +462,8 @@ class Search {
genreTreeInpxHash = '';
showTooltips = true;
+ bookInfo = {};
+
limitOptions = [
{label: '10', value: 10},
{label: '20', value: 20},
@@ -879,6 +885,10 @@ class Search {
case 'submitUrl':
this.sendMessage({type: 'submitUrl', data: event.data});
break;
+ case 'bookInfo':
+ this.bookInfo = event.data;
+ this.bookInfoDialogVisible = true;
+ break;
}
}
diff --git a/server/controllers/WebSocketController.js b/server/controllers/WebSocketController.js
index 0dac9f6..07ce0ee 100644
--- a/server/controllers/WebSocketController.js
+++ b/server/controllers/WebSocketController.js
@@ -84,6 +84,8 @@ class WebSocketController {
await this.getGenreTree(req, ws); break;
case 'get-book-link':
await this.getBookLink(req, ws); break;
+ case 'get-book-info':
+ await this.getBookInfo(req, ws); break;
case 'get-inpx-file':
await this.getInpxFile(req, ws); break;
@@ -173,6 +175,17 @@ class WebSocketController {
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`);
+
+ const result = await this.webWorker.getBookInfo({bookPath: req.bookPath, downFileName: req.downFileName});
+
+ this.send(result, req, ws);
+ }
+
async getInpxFile(req, ws) {
if (!this.config.allowRemoteLib)
throw new Error('Remote lib access disabled');
diff --git a/server/core/WebWorker.js b/server/core/WebWorker.js
index 05ee501..b2079e5 100644
--- a/server/core/WebWorker.js
+++ b/server/core/WebWorker.js
@@ -437,6 +437,26 @@ class WebWorker {
}
}
+ async getBookInfo(params) {
+ this.checkMyState();
+
+ try {
+ //const db = this.db;
+ let link = await this.getBookLink(params);
+ const hash = path.basename(link.link);
+
+ /*const bookFile = `${this.config.filesDir}/${hash}`;
+ const bookInfo = await fb2parser*/
+
+ return {hash};
+ } catch(e) {
+ log(LM_ERR, `getBookInfo error: ${e.message}`);
+ if (e.message.indexOf('ENOENT') >= 0)
+ throw new Error('404 Файл не найден');
+ throw e;
+ }
+ }
+
/*
async restoreBookFile(publicPath) {
this.checkMyState();