Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6667688193 | ||
|
|
30a1629f23 | ||
|
|
ba50faeebb | ||
|
|
3c0d784e3d | ||
|
|
3e75310e1f | ||
|
|
2b01d6d8d7 | ||
|
|
be6d60d7a9 | ||
|
|
3c0815d55b | ||
|
|
abd8584cb8 | ||
|
|
5a910f80b3 | ||
|
|
67bdfd853e |
@@ -4,7 +4,8 @@ class Misc {
|
|||||||
async loadConfig() {
|
async loadConfig() {
|
||||||
|
|
||||||
const query = {params: [
|
const query = {params: [
|
||||||
'name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter', 'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink',
|
'name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter',
|
||||||
|
'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink', 'restricted'
|
||||||
]};
|
]};
|
||||||
|
|
||||||
const config = await wsc.message(await wsc.send(Object.assign({action: 'get-config'}, query)));
|
const config = await wsc.message(await wsc.send(Object.assign({action: 'get-config'}, query)));
|
||||||
|
|||||||
@@ -770,6 +770,10 @@ class Reader {
|
|||||||
return this.$store.state.config.bucEnabled && this.bucEnabled;
|
return this.$store.state.config.bucEnabled && this.bucEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get restricted() {
|
||||||
|
return this.$store.state.config.restricted;
|
||||||
|
}
|
||||||
|
|
||||||
get routeParamUrl() {
|
get routeParamUrl() {
|
||||||
let result = '';
|
let result = '';
|
||||||
const path = this.$route.fullPath;
|
const path = this.$route.fullPath;
|
||||||
@@ -1263,6 +1267,19 @@ class Reader {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isUrlAllowed(url) {
|
||||||
|
const restrictedSites = this.restricted?.sites;
|
||||||
|
if (restrictedSites) {
|
||||||
|
url = url.toLowerCase();
|
||||||
|
for (const site of restrictedSites) {
|
||||||
|
if (url.indexOf(site) === 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
async _loadBook(opts) {
|
async _loadBook(opts) {
|
||||||
if (!opts || !opts.url) {
|
if (!opts || !opts.url) {
|
||||||
this.mostRecentBook();
|
this.mostRecentBook();
|
||||||
@@ -1273,6 +1290,11 @@ class Reader {
|
|||||||
|
|
||||||
let url = encodeURI(decodeURI(opts.url));
|
let url = encodeURI(decodeURI(opts.url));
|
||||||
|
|
||||||
|
if (!this.isUrlAllowed(url)) {
|
||||||
|
this.$root.stdDialog.alert('Книга не загружена, причина: нарушение авторских прав.<br>Приносим извинения за неудобство.', '', {color: 'negative'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((url.indexOf('http://') != 0) && (url.indexOf('https://') != 0) &&
|
if ((url.indexOf('http://') != 0) && (url.indexOf('https://') != 0) &&
|
||||||
(url.indexOf('disk://') != 0))
|
(url.indexOf('disk://') != 0))
|
||||||
url = 'http://' + url;
|
url = 'http://' + url;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<div @copy.prevent="copyText" v-html="page2"></div>
|
<div @copy.prevent="copyText" v-html="page2"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="showStatusBar" ref="statusBar" class="layout">
|
<div v-show="showStatusBar" ref="statusBar" class="layout" :class="{'no-events': clickControl}">
|
||||||
<div v-html="statusBar"></div>
|
<div v-html="statusBar"></div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -1353,6 +1353,9 @@ export default vueComponent(TextPage);
|
|||||||
background-color: rgba(0,0,0,0);
|
background-color: rgba(0,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-events {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
.note-para {
|
.note-para {
|
||||||
|
|||||||
@@ -1,4 +1,30 @@
|
|||||||
export const versionHistory = [
|
export const versionHistory = [
|
||||||
|
{
|
||||||
|
version: '1.2.6',
|
||||||
|
releaseDate: '2024-10-03',
|
||||||
|
showUntil: '2024-10-02',
|
||||||
|
content:
|
||||||
|
`
|
||||||
|
<ul>
|
||||||
|
<li>исправления из-за нарушения авторских прав</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
`
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
version: '1.2.4',
|
||||||
|
releaseDate: '2024-08-27',
|
||||||
|
showUntil: '2024-08-26',
|
||||||
|
content:
|
||||||
|
`
|
||||||
|
<ul>
|
||||||
|
<li>исправление багов</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
`
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
version: '1.2.3',
|
version: '1.2.3',
|
||||||
releaseDate: '2024-08-02',
|
releaseDate: '2024-08-02',
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "liberama",
|
"name": "liberama",
|
||||||
"version": "1.2.3",
|
"version": "1.2.5",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "liberama",
|
"name": "liberama",
|
||||||
"version": "1.2.3",
|
"version": "1.2.5",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liberama",
|
"name": "liberama",
|
||||||
"version": "1.2.3",
|
"version": "1.2.6",
|
||||||
"author": "Book Pauk <bookpauk@gmail.com>",
|
"author": "Book Pauk <bookpauk@gmail.com>",
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
"repository": "bookpauk/liberama",
|
"repository": "bookpauk/liberama",
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ module.exports = {
|
|||||||
|
|
||||||
useExternalBookConverter: false,
|
useExternalBookConverter: false,
|
||||||
acceptFileExt: '.fb2, .fb3, .html, .txt, .zip, .bz2, .gz, .rar, .epub, .mobi, .rtf, .doc, .docx, .pdf, .djvu, .jpg, .jpeg, .png',
|
acceptFileExt: '.fb2, .fb3, .html, .txt, .zip, .bz2, .gz, .rar, .epub, .mobi, .rtf, .doc, .docx, .pdf, .djvu, .jpg, .jpeg, .png',
|
||||||
webConfigParams: ['name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter', 'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink'],
|
restricted: {},
|
||||||
|
webConfigParams: ['name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter', 'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink', 'restricted'],
|
||||||
|
|
||||||
jembaDb: [
|
jembaDb: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class ConfigManager {
|
|||||||
|
|
||||||
await fs.ensureDir(config.dataDir);
|
await fs.ensureDir(config.dataDir);
|
||||||
this._userConfigFile = `${config.dataDir}/config.json`;
|
this._userConfigFile = `${config.dataDir}/config.json`;
|
||||||
|
this._restrictedFile = `${config.dataDir}/restricted.json`;
|
||||||
this._config = config;
|
this._config = config;
|
||||||
|
|
||||||
this.inited = true;
|
this.inited = true;
|
||||||
@@ -75,6 +76,10 @@ class ConfigManager {
|
|||||||
return this._userConfigFile;
|
return this._userConfigFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get restrictedFile() {
|
||||||
|
return this._restrictedFile;
|
||||||
|
}
|
||||||
|
|
||||||
set userConfigFile(value) {
|
set userConfigFile(value) {
|
||||||
if (value)
|
if (value)
|
||||||
this._userConfigFile = value;
|
this._userConfigFile = value;
|
||||||
@@ -100,6 +105,12 @@ class ConfigManager {
|
|||||||
} else {
|
} else {
|
||||||
await this.save();
|
await this.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (await fs.pathExists(this.restrictedFile)) {
|
||||||
|
const data = JSON.parse(await fs.readFile(this.restrictedFile, 'utf8'));
|
||||||
|
|
||||||
|
this.config = {restricted: data};
|
||||||
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
throw new Error(`Error while loading "${this.userConfigFile}": ${e.message}`);
|
throw new Error(`Error while loading "${this.userConfigFile}": ${e.message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user