Исправления из-за нарушения авторских прав

This commit is contained in:
Book Pauk
2024-10-03 11:51:09 +07:00
parent 2b01d6d8d7
commit 3e75310e1f
9 changed files with 63 additions and 7 deletions

View File

@@ -18,7 +18,8 @@ module.exports = {
useExternalBookConverter: false,
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: [
{

View File

@@ -56,6 +56,7 @@ class ConfigManager {
await fs.ensureDir(config.dataDir);
this._userConfigFile = `${config.dataDir}/config.json`;
this._restrictedFile = `${config.dataDir}/restricted.json`;
this._config = config;
this.inited = true;
@@ -75,6 +76,10 @@ class ConfigManager {
return this._userConfigFile;
}
get restrictedFile() {
return this._restrictedFile;
}
set userConfigFile(value) {
if (value)
this._userConfigFile = value;
@@ -100,6 +105,12 @@ class ConfigManager {
} else {
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) {
throw new Error(`Error while loading "${this.userConfigFile}": ${e.message}`);
}