Добавлен раздел "Сетевая библиотека" в режим "omnireader"

This commit is contained in:
Book Pauk
2022-12-15 16:31:42 +07:00
parent 55264314b8
commit a5bf8f88cd
10 changed files with 86 additions and 61 deletions

View File

@@ -197,7 +197,7 @@ class App {
setAppTitle(title) { setAppTitle(title) {
if (!title) { if (!title) {
if (this.mode == 'liberama.top') { if (this.mode == 'liberama') {
document.title = `Liberama Reader - всегда с вами`; document.title = `Liberama Reader - всегда с вами`;
} else if (this.mode == 'omnireader') { } else if (this.mode == 'omnireader') {
document.title = `Omni Reader - всегда с вами`; document.title = `Omni Reader - всегда с вами`;
@@ -217,19 +217,12 @@ class App {
return this.$store.state.config.mode; return this.$store.state.config.mode;
} }
get showAsideBar() {
return (this.mode !== null && this.mode != 'reader' && this.mode != 'omnireader' && this.mode != 'liberama.top');
}
set showAsideBar(value) {
}
get isReaderActive() { get isReaderActive() {
return (this.rootRoute == '/reader' || this.rootRoute == '/external-libs'); return (this.rootRoute == '/reader' || this.rootRoute == '/external-libs');
} }
redirectIfNeeded() { redirectIfNeeded() {
if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top')) { if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama')) {
const search = window.location.search.substr(1); const search = window.location.search.substr(1);
//распознавание параметра url вида "?url=<link>" и редирект при необходимости //распознавание параметра url вида "?url=<link>" и редирект при необходимости

View File

@@ -80,7 +80,7 @@ class CardIndex {
} }
get isReader() { get isReader() {
return (this.mode !== null && (this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top')); return (this.mode !== null && (this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama'));
} }
} }

View File

@@ -325,8 +325,6 @@ class ExternalLibs {
this.debouncedGoToLink = _.debounce((link) => { this.debouncedGoToLink = _.debounce((link) => {
this.goToLink(link); this.goToLink(link);
}, 100, {'maxWait':200}); }, 100, {'maxWait':200});
//this.commit = this.$store.commit;
//this.commit('reader/setLibs', rstore.libsDefaults);
} }
mounted() { mounted() {
@@ -338,10 +336,7 @@ class ExternalLibs {
i++; i++;
} }
if (this.mode != 'liberama.top') { this.libsDefaults = rstore.getLibsDefaults(this.mode);
this.$router.replace('/404');
return;
}
this.$refs.window.init(); this.$refs.window.init();
@@ -404,7 +399,8 @@ class ExternalLibs {
} }
} else if (d.type == 'libs') { } else if (d.type == 'libs') {
this.ready = true; this.ready = true;
this.libs = _.cloneDeep(d.data); if (d.data)
this.libs = _.cloneDeep(d.data);
} else if (d.type == 'notify') { } else if (d.type == 'notify') {
this.$root.notify.success(d.data, '', {position: 'bottom-right'}); this.$root.notify.success(d.data, '', {position: 'bottom-right'});
} }
@@ -502,7 +498,7 @@ class ExternalLibs {
if (this.ready && this.selectedLink) { if (this.ready && this.selectedLink) {
let title = `${(this.libs.comment ? this.libs.comment + ' ': '') + lu.removeProtocol(this.libs.startLink)}`; let title = `${(this.libs.comment ? this.libs.comment + ' ': '') + lu.removeProtocol(this.libs.startLink)}`;
if (this.inpxReady && this.inpxTitle) if (this.inpxReady && this.inpxTitle)
title = this.inpxTitle; title = `${this.inpxTitle} ${lu.removeProtocol(this.inpxUrl)}`;
result += ` | ${title}`; result += ` | ${title}`;
} }
this.$root.setAppTitle(result); this.$root.setAppTitle(result);
@@ -574,7 +570,7 @@ class ExternalLibs {
get defaultRootLinkOptions() { get defaultRootLinkOptions() {
let result = []; let result = [];
rstore.libsDefaults.groups.forEach(group => { this.libsDefaults.groups.forEach(group => {
result.push({label: lu.removeProtocol(group.r), value: group.r}); result.push({label: lu.removeProtocol(group.r), value: group.r});
}); });
@@ -604,6 +600,8 @@ class ExternalLibs {
goToLink(link) { goToLink(link) {
this.inpxReady = false; this.inpxReady = false;
this.inpxTitle = '';
this.inpxUrl = '';
this.inpxOrigin = false; this.inpxOrigin = false;
if (!this.ready || !link) if (!this.ready || !link)
@@ -735,10 +733,10 @@ class ExternalLibs {
} }
updateBookmarkLink() { updateBookmarkLink() {
const index = lu.getSafeRootIndexByUrl(rstore.libsDefaults.groups, this.defaultRootLink); const index = lu.getSafeRootIndexByUrl(this.libsDefaults.groups, this.defaultRootLink);
if (index >= 0) { if (index >= 0) {
this.bookmarkLink = rstore.libsDefaults.groups[index].s; this.bookmarkLink = this.libsDefaults.groups[index].s;
this.bookmarkDesc = this.getCommentByLink(rstore.libsDefaults.groups[index].list, this.bookmarkLink); this.bookmarkDesc = this.getCommentByLink(this.libsDefaults.groups[index].list, this.bookmarkLink);
} else { } else {
this.bookmarkLink = ''; this.bookmarkLink = '';
this.bookmarkDesc = ''; this.bookmarkDesc = '';
@@ -893,20 +891,22 @@ class ExternalLibs {
<p>Окно 'Сетевая библиотека' позволяет открывать ссылки в читалке без переключения между окнами, <p>Окно 'Сетевая библиотека' позволяет открывать ссылки в читалке без переключения между окнами,
что особенно актуально для мобильных устройств. Имеется возможность управлять закладками что особенно актуально для мобильных устройств. Имеется возможность управлять закладками
на понравившиеся ресурсы, книги или страницы авторов. Открытие ссылок и навигация происходят во фрейме, но, на понравившиеся ресурсы, книги или страницы авторов. Открытие ссылок и навигация происходят во фрейме, но,
к сожалению, в нем открываются не все страницы.</p> к сожалению, в нем открываются не все страницы.</p>` +
<p>Доступ к сайтам <span style="color: blue">http://flibusta.is</span> и <span style="color: blue">http://fantasy-worlds.org</span> работает через прокси. (this.mode === 'liberama' ?
`<p>Доступ к сайтам <span style="color: blue">http://flibusta.is</span> и <span style="color: blue">http://fantasy-worlds.org</span> работает через прокси.
<br><span style="color: red"><b>ПРЕДУПРЕЖДЕНИЕ!</b></span> <br><span style="color: red"><b>ПРЕДУПРЕЖДЕНИЕ!</b></span>
Доступ предназначен только для просмотра и скачивания книг. Авторизоваться на этих сайтах Доступ предназначен только для просмотра и скачивания книг. Авторизоваться на этих сайтах
из фрейма категорически не рекомендуется, т.к. ваше подключение не защищено и данные могут попасть из фрейма категорически не рекомендуется, т.к. ваше подключение не защищено и данные могут попасть
к третьим лицам. к третьим лицам.
</p> </p>
`
: '') +
<p>Из-за проблем с безопасностью, навигация 'вперед-назад' во фрейме осуществляется с помощью контекстного меню правой кнопкой мыши. `<p>Из-за проблем с безопасностью, навигация 'вперед-назад' во фрейме осуществляется с помощью контекстного меню правой кнопкой мыши.
На мобильных устройствах для этого служит системная клавиша 'Назад (стрелка влево)' и опция 'Вперед (стрелка вправо)' в меню браузера. На мобильных устройствах для этого служит системная клавиша 'Назад (стрелка влево)' и опция 'Вперед (стрелка вправо)' в меню браузера.
</p> </p>
<p>Приятного пользования ;-) <p>Приятного пользования ;-)
</p> </p>
`, 'Справка', {iconName: 'la la-info-circle'}); `, 'Справка', {iconName: 'la la-info-circle'});

View File

@@ -24,7 +24,7 @@
</p> </p>
<p>Поддерживаемые форматы: <b>fb2, fb2.zip, html, txt</b> и другие.</p> <p>Поддерживаемые форматы: <b>fb2, fb2.zip, html, txt</b> и другие.</p>
<div v-show="mode == 'omnireader' || mode == 'liberama.top'"> <div v-show="mode == 'omnireader' || mode == 'liberama'">
<p> <p>
Вы можете добавить в свой браузер закладку, указав в ее свойствах вместо адреса следующий код: Вы можете добавить в свой браузер закладку, указав в ее свойствах вместо адреса следующий код:
<br><strong>{{ bookmarkText }}</strong> <br><strong>{{ bookmarkText }}</strong>

View File

@@ -8,7 +8,7 @@ import vueComponent from '../../vueComponent.js';
import Window from '../../share/Window.vue'; import Window from '../../share/Window.vue';
import * as utils from '../../../share/utils'; import * as utils from '../../../share/utils';
//import rstore from '../../../store/modules/reader'; import rstore from '../../../store/modules/reader';
import _ from 'lodash'; import _ from 'lodash';
const componentOptions = { const componentOptions = {
@@ -28,10 +28,21 @@ class LibsPage {
this.popupWindow = null; this.popupWindow = null;
this.commit = this.$store.commit; this.commit = this.$store.commit;
this.messageListener = null; this.messageListener = null;
//this.commit('reader/setLibs', rstore.libsDefaults);
} }
init() { async init() {
//подождем this.mode
let i = 0;
while(!this.mode && i < 100) {
await utils.sleep(100);
i++;
}
if (!this.libs) {
const defaults = rstore.getLibsDefaults(this.mode);
this.commit('reader/setLibs', defaults);
}
this.childReady = false; this.childReady = false;
const subdomain = (window.location.protocol != 'http:' ? 'b.' : ''); const subdomain = (window.location.protocol != 'http:' ? 'b.' : '');
this.origin = `http://${subdomain}${window.location.host}`; this.origin = `http://${subdomain}${window.location.host}`;

View File

@@ -1,6 +1,6 @@
<template> <template>
<div ref="main" class="column no-wrap" style="min-height: 500px"> <div ref="main" class="column no-wrap" style="min-height: 500px">
<div v-if="mode != 'liberama.top'" class="relative-position"> <div v-if="mode != 'liberama'" class="relative-position">
<GithubCorner url="https://github.com/bookpauk/liberama" corner-color="#1B695F" git-color="#EBE2C9"></GithubCorner> <GithubCorner url="https://github.com/bookpauk/liberama" corner-color="#1B695F" git-color="#EBE2C9"></GithubCorner>
</div> </div>
<div class="col column justify-center items-center no-wrap overflow-hidden" style="min-height: 230px"> <div class="col column justify-center items-center no-wrap overflow-hidden" style="min-height: 230px">
@@ -108,7 +108,7 @@ class LoaderPage {
get title() { get title() {
if (this.mode == 'omnireader') if (this.mode == 'omnireader')
return 'Omni Reader - браузерная онлайн-читалка.'; return 'Omni Reader - браузерная онлайн-читалка.';
if (this.mode == 'liberama.top') if (this.mode == 'liberama')
return 'Liberama Reader - браузерная онлайн-читалка.'; return 'Liberama Reader - браузерная онлайн-читалка.';
return 'Универсальная читалка книг и ресурсов интернета.'; return 'Универсальная читалка книг и ресурсов интернета.';

View File

@@ -1007,7 +1007,7 @@ class Reader {
libsToogle() { libsToogle() {
this.libsActive = !this.libsActive; this.libsActive = !this.libsActive;
if (this.libsActive) { if (this.libsActive) {
this.$refs.libsPage.init(); this.$refs.libsPage.init();//no await
} else { } else {
this.$refs.libsPage.done(); this.$refs.libsPage.done();
} }

View File

@@ -141,7 +141,7 @@ class ReaderDialogs {
async showDonation() { async showDonation() {
const today = utils.formatDate(new Date(), 'coMonth'); const today = utils.formatDate(new Date(), 'coMonth');
if ((this.mode == 'omnireader' || this.mode == 'liberama.top') && this.showDonationDialog && this.donationRemindDate != today) { if ((this.mode == 'omnireader' || this.mode == 'liberama') && this.showDonationDialog && this.donationRemindDate != today) {
await utils.sleep(3000); await utils.sleep(3000);
this.donationVisible = true; this.donationVisible = true;
} }

View File

@@ -87,7 +87,7 @@
</q-tooltip> </q-tooltip>
</q-icon> </q-icon>
</div> </div>
<div v-if="mode == 'omnireader' || mode == 'liberama.top'"> <div v-if="mode == 'omnireader' || mode == 'liberama'">
<br>Переход по ссылке позволит автоматически ввести ключ доступа: <br>Переход по ссылке позволит автоматически ввести ключ доступа:
<br><div class="text-center" style="margin-top: 5px"> <br><div class="text-center" style="margin-top: 5px">
<a :href="setStorageKeyLink" target="_blank">Ссылка для ввода ключа</a> <a :href="setStorageKeyLink" target="_blank">Ссылка для ввода ключа</a>

View File

@@ -223,30 +223,51 @@ function addDefaultsToSettings(settings) {
return false; return false;
} }
const libsDefaults = { function getLibsDefaults(mode = 'reader') {
startLink: 'http://flibusta.is', const result = {
comment: 'Флибуста | Книжное братство', startLink: '',
closeAfterSubmit: false, comment: '',
openInFrameOnEnter: false, closeAfterSubmit: false,
openInFrameOnAdd: false, openInFrameOnEnter: false,
groups: [ openInFrameOnAdd: false,
{r: 'http://flibusta.is', s: 'http://flibusta.is', list: [ helpShowed: false,
{l: 'http://flibusta.is', c: 'Флибуста | Книжное братство'}, groups: [
]}, {r: 'http://samlib.ru', s: 'http://samlib.ru', list: [
{r: 'http://fantasy-worlds.org', s: 'http://fantasy-worlds.org', list: [ {l: 'http://samlib.ru', c: 'Журнал "Самиздат"'},
{l: 'http://fantasy-worlds.org', c: 'Миры Фэнтези'}, ]},
]}, {r: 'http://lib.ru', s: 'http://lib.ru', list: [
{r: 'http://samlib.ru', s: 'http://samlib.ru', list: [ {l: 'http://lib.ru', c: 'Библиотека Максима Мошкова'},
{l: 'http://samlib.ru', c: 'Журнал "Самиздат"'}, ]},
]}, {r: 'https://aldebaran.ru', s: 'https://aldebaran.ru', list: [
{r: 'http://lib.ru', s: 'http://lib.ru', list: [ {l: 'https://aldebaran.ru', c: 'АЛЬДЕБАРАН | Электронная библиотека книг'},
{l: 'http://lib.ru', c: 'Библиотека Максима Мошкова'}, ]},
]}, ],
{r: 'https://aldebaran.ru', s: 'https://aldebaran.ru', list: [ };
{l: 'https://aldebaran.ru', c: 'АЛЬДЕБАРАН | Электронная библиотека книг'},
]}, if (mode === 'liberama') {
] result.groups.unshift(
}; {r: 'http://fantasy-worlds.org', s: 'http://fantasy-worlds.org', list: [
{l: 'http://fantasy-worlds.org', c: 'Миры Фэнтези'},
]}
);
result.groups.unshift(
{r: 'http://flibusta.is', s: 'http://flibusta.is', list: [
{l: 'http://flibusta.is', c: 'Флибуста | Книжное братство'},
]}
);
} else if (mode === 'omnireader') {
result.groups.unshift(
{r: 'https://lib.omnireader.ru', s: 'https://lib.omnireader.ru', list: [
{l: 'https://lib.omnireader.ru', c: 'Общественное достояние'},
]}
);
}
result.startLink = result.groups[0].r;
result.comment = result.groups[0].c;
return result;
}
// initial state // initial state
const state = { const state = {
@@ -262,7 +283,7 @@ const state = {
currentProfile: '', currentProfile: '',
settings: Object.assign({}, settingDefaults), settings: Object.assign({}, settingDefaults),
settingsRev: {}, settingsRev: {},
libs: Object.assign({}, libsDefaults), libs: false,
libsRev: 0, libsRev: 0,
}; };
@@ -332,7 +353,7 @@ export default {
webFonts, webFonts,
settingDefaults, settingDefaults,
addDefaultsToSettings, addDefaultsToSettings,
libsDefaults, getLibsDefaults,
namespaced: true, namespaced: true,
state, state,