Добавлен раздел "Сетевая библиотека" в режим "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) {
if (!title) {
if (this.mode == 'liberama.top') {
if (this.mode == 'liberama') {
document.title = `Liberama Reader - всегда с вами`;
} else if (this.mode == 'omnireader') {
document.title = `Omni Reader - всегда с вами`;
@@ -217,19 +217,12 @@ class App {
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() {
return (this.rootRoute == '/reader' || this.rootRoute == '/external-libs');
}
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);
//распознавание параметра url вида "?url=<link>" и редирект при необходимости

View File

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

View File

@@ -24,7 +24,7 @@
</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>
Вы можете добавить в свой браузер закладку, указав в ее свойствах вместо адреса следующий код:
<br><strong>{{ bookmarkText }}</strong>

View File

@@ -8,7 +8,7 @@ import vueComponent from '../../vueComponent.js';
import Window from '../../share/Window.vue';
import * as utils from '../../../share/utils';
//import rstore from '../../../store/modules/reader';
import rstore from '../../../store/modules/reader';
import _ from 'lodash';
const componentOptions = {
@@ -28,10 +28,21 @@ class LibsPage {
this.popupWindow = null;
this.commit = this.$store.commit;
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;
const subdomain = (window.location.protocol != 'http:' ? 'b.' : '');
this.origin = `http://${subdomain}${window.location.host}`;

View File

@@ -1,6 +1,6 @@
<template>
<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>
</div>
<div class="col column justify-center items-center no-wrap overflow-hidden" style="min-height: 230px">
@@ -108,7 +108,7 @@ class LoaderPage {
get title() {
if (this.mode == 'omnireader')
return 'Omni Reader - браузерная онлайн-читалка.';
if (this.mode == 'liberama.top')
if (this.mode == 'liberama')
return 'Liberama Reader - браузерная онлайн-читалка.';
return 'Универсальная читалка книг и ресурсов интернета.';

View File

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

View File

@@ -141,7 +141,7 @@ class ReaderDialogs {
async showDonation() {
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);
this.donationVisible = true;
}

View File

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

View File

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