Добавлена ссылка "читать"
This commit is contained in:
@@ -40,6 +40,10 @@
|
|||||||
<q-icon name="la la-copy" size="20px" />
|
<q-icon name="la la-copy" size="20px" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="config.bookReadLink" class="q-ml-sm clickable" @click="readBook">
|
||||||
|
(читать)
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="showGenres && book.genre" class="q-ml-sm">
|
<div v-if="showGenres && book.genre" class="q-ml-sm">
|
||||||
{{ bookGenre }}
|
{{ bookGenre }}
|
||||||
</div>
|
</div>
|
||||||
@@ -86,6 +90,10 @@ class BookView {
|
|||||||
this.showDeleted = settings.showDeleted;
|
this.showDeleted = settings.showDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get config() {
|
||||||
|
return this.$store.state.config;
|
||||||
|
}
|
||||||
|
|
||||||
get settings() {
|
get settings() {
|
||||||
return this.$store.state.settings;
|
return this.$store.state.settings;
|
||||||
}
|
}
|
||||||
@@ -132,6 +140,10 @@ class BookView {
|
|||||||
copyLink() {
|
copyLink() {
|
||||||
this.$emit('bookEvent', {action: 'copyLink', book: this.book});
|
this.$emit('bookEvent', {action: 'copyLink', book: this.book});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readBook() {
|
||||||
|
this.$emit('bookEvent', {action: 'readBook', book: this.book});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default vueComponent(BookView);
|
export default vueComponent(BookView);
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ class Search {
|
|||||||
this.search.series = `=${series}`;
|
this.search.series = `=${series}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async download(book, copy = false) {
|
async download(book, action) {
|
||||||
if (this.downloadFlag)
|
if (this.downloadFlag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -691,19 +691,22 @@ class Search {
|
|||||||
const link = response.link;
|
const link = response.link;
|
||||||
const href = `${window.location.origin}${link}`;
|
const href = `${window.location.origin}${link}`;
|
||||||
|
|
||||||
if (!copy) {
|
if (action == 'download') {
|
||||||
//скачивание
|
//скачивание
|
||||||
const d = this.$refs.download;
|
const d = this.$refs.download;
|
||||||
d.href = href;
|
d.href = href;
|
||||||
d.download = downFileName;
|
d.download = downFileName;
|
||||||
|
|
||||||
d.click();
|
d.click();
|
||||||
} else {
|
} else if (action == 'copyLink') {
|
||||||
//копирование ссылки
|
//копирование ссылки
|
||||||
if (utils.copyTextToClipboard(href))
|
if (utils.copyTextToClipboard(href))
|
||||||
this.$root.notify.success('Ссылка успешно скопирована');
|
this.$root.notify.success('Ссылка успешно скопирована');
|
||||||
else
|
else
|
||||||
this.$root.notify.error('Копирование ссылки не удалось');
|
this.$root.notify.error('Копирование ссылки не удалось');
|
||||||
|
} else if (action == 'readBook') {
|
||||||
|
const url = this.config.bookReadLink.replace('${DOWNLOAD_LINK}', href);
|
||||||
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
this.$root.stdDialog.alert(e.message, 'Ошибка');
|
this.$root.stdDialog.alert(e.message, 'Ошибка');
|
||||||
@@ -719,10 +722,9 @@ class Search {
|
|||||||
this.search.title = `=${event.book.title}`;
|
this.search.title = `=${event.book.title}`;
|
||||||
break;
|
break;
|
||||||
case 'download':
|
case 'download':
|
||||||
this.download(event.book);//no await
|
|
||||||
break;
|
|
||||||
case 'copyLink':
|
case 'copyLink':
|
||||||
this.download(event.book, true);//no await
|
case 'readBook':
|
||||||
|
this.download(event.book, event.action);//no await
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ module.exports = {
|
|||||||
publicDir: `${dataDir}/public`,
|
publicDir: `${dataDir}/public`,
|
||||||
|
|
||||||
accessPassword: '',
|
accessPassword: '',
|
||||||
|
bookReadLink: '',
|
||||||
loggingEnabled: true,
|
loggingEnabled: true,
|
||||||
|
|
||||||
maxFilesDirSize: 1024*1024*1024,//1Gb
|
maxFilesDirSize: 1024*1024*1024,//1Gb
|
||||||
@@ -23,7 +24,7 @@ module.exports = {
|
|||||||
cacheCleanInterval: 60,//minutes
|
cacheCleanInterval: 60,//minutes
|
||||||
lowMemoryMode: false,
|
lowMemoryMode: false,
|
||||||
|
|
||||||
webConfigParams: ['name', 'version', 'branch'],
|
webConfigParams: ['name', 'version', 'branch', 'bookReadLink'],
|
||||||
|
|
||||||
server: {
|
server: {
|
||||||
ip: '0.0.0.0',
|
ip: '0.0.0.0',
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const branchFilename = __dirname + '/application_env';
|
|||||||
|
|
||||||
const propsToSave = [
|
const propsToSave = [
|
||||||
'accessPassword',
|
'accessPassword',
|
||||||
|
'bookReadLink',
|
||||||
'loggingEnabled',
|
'loggingEnabled',
|
||||||
'maxFilesDirSize',
|
'maxFilesDirSize',
|
||||||
'queryCacheEnabled',
|
'queryCacheEnabled',
|
||||||
|
|||||||
Reference in New Issue
Block a user