diff --git a/README.md b/README.md index 64f88c7..53038cc 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ Options: // содержимое кнопки-ссылки "(читать)", если не задано - кнопка "(читать)" не показывается // пример: "https://omnireader.ru/#/reader?url=${DOWNLOAD_LINK}" // на место ${DOWNLOAD_LINK} будет подставлена ссылка на скачивание файла книги + // пример: "https://mydomain.ru/#/reader?url=http://127.0.0.1:8086${DOWNLOAD_URI}" + // на место ${DOWNLOAD_URI} будут подставлены параметры (без имени хоста) из ссылки на скачивание файла книги "bookReadLink": "", // включить(true)/выключить(false) журналирование diff --git a/client/components/Search/BaseList.js b/client/components/Search/BaseList.js index d1d98af..f8f7a34 100644 --- a/client/components/Search/BaseList.js +++ b/client/components/Search/BaseList.js @@ -178,7 +178,18 @@ export default class BaseList { if (this.list.liberamaReady) { this.$emit('listEvent', {action: 'submitUrl', data: href}); } else { - const url = this.config.bookReadLink.replace('${DOWNLOAD_LINK}', href); + const bookReadLink = this.config.bookReadLink; + let url = bookReadLink; + + if (bookReadLink.indexOf('${DOWNLOAD_LINK}') >= 0) { + url = bookReadLink.replace('${DOWNLOAD_LINK}', href); + + } else if (bookReadLink.indexOf('${DOWNLOAD_URI}') >= 0) { + const hrefUrl = new URL(href); + const urlWithoutHost = hrefUrl.pathname + hrefUrl.search + hrefUrl.hash; + url = bookReadLink.replace('${DOWNLOAD_URI}', urlWithoutHost); + } + window.open(url, '_blank'); } } else if (action == 'bookInfo') {