|
@@ -3,7 +3,6 @@ import path from 'path-browserify';
|
|
import _ from 'lodash';
|
|
import _ from 'lodash';
|
|
|
|
|
|
import BookParser from './BookParser';
|
|
import BookParser from './BookParser';
|
|
-import bmHelper from './bmHelper';
|
|
|
|
import readerApi from '../../../api/reader';
|
|
import readerApi from '../../../api/reader';
|
|
import coversStorage from './coversStorage';
|
|
import coversStorage from './coversStorage';
|
|
import * as utils from '../../../share/utils';
|
|
import * as utils from '../../../share/utils';
|
|
@@ -27,10 +26,9 @@ const bmRecentStoreNew = localForage.createInstance({
|
|
});
|
|
});
|
|
|
|
|
|
class BookManager {
|
|
class BookManager {
|
|
- async init(settings, restricted) {
|
|
|
|
|
|
+ async init(settings) {
|
|
this.loaded = false;
|
|
this.loaded = false;
|
|
this.settings = settings;
|
|
this.settings = settings;
|
|
- this.restricted = restricted;
|
|
|
|
|
|
|
|
this.eventListeners = [];
|
|
this.eventListeners = [];
|
|
this.books = {};
|
|
this.books = {};
|
|
@@ -234,18 +232,6 @@ class BookManager {
|
|
return inflator.result;
|
|
return inflator.result;
|
|
}
|
|
}
|
|
|
|
|
|
- isUrlAllowed(url) {
|
|
|
|
- const restrictedSites = this.restricted?.sites;
|
|
|
|
- if (restrictedSites) {
|
|
|
|
- for (const site of restrictedSites) {
|
|
|
|
- if (url.indexOf(site) === 0)
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
async addBook(newBook, callback) {
|
|
async addBook(newBook, callback) {
|
|
let meta = {url: newBook.url, path: newBook.path};
|
|
let meta = {url: newBook.url, path: newBook.path};
|
|
|
|
|
|
@@ -362,10 +348,6 @@ class BookManager {
|
|
}
|
|
}
|
|
|
|
|
|
async parseBook(meta, data, callback) {
|
|
async parseBook(meta, data, callback) {
|
|
- if (!this.isUrlAllowed(meta.url)) {
|
|
|
|
- data = bmHelper.restrictedData;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
const parsed = new BookParser(this.settings);
|
|
const parsed = new BookParser(this.settings);
|
|
|
|
|
|
const parsedMeta = await parsed.parse(data, callback);
|
|
const parsedMeta = await parsed.parse(data, callback);
|