From 9e509ac8457195003149077f3c2762e062a3f8f0 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sat, 22 Feb 2025 13:49:57 +0700 Subject: [PATCH 1/4] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20caniuse-lite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3c9c769f..e9e747ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "liberama", - "version": "1.2.5", + "version": "1.2.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "liberama", - "version": "1.2.5", + "version": "1.2.6", "hasInstallScript": true, "license": "CC0-1.0", "dependencies": { @@ -3364,9 +3364,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001643", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz", - "integrity": "sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg==", + "version": "1.0.30001700", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001700.tgz", + "integrity": "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ==", "dev": true, "funding": [ { @@ -13709,9 +13709,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001643", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz", - "integrity": "sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg==", + "version": "1.0.30001700", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001700.tgz", + "integrity": "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ==", "dev": true }, "chalk": { From 583b96661697ab18377b68bc03d4348fd5b98ece Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sat, 22 Feb 2025 14:31:19 +0700 Subject: [PATCH 2/4] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F,=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20=D0=BD=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B4=D0=B0=D0=B2=D0=B0=D0=BB=20=D0=B1=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D1=88=D0=BE=D0=B9=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3?= =?UTF-8?q?=20=D0=BA=D0=B0=D0=B6=D0=B4=D1=8B=D0=B9=20=D1=80=D0=B0=D0=B7=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B8=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/api/misc.js | 13 ++++++++----- client/components/App.vue | 7 +++++-- client/store/modules/config.js | 1 - server/controllers/WebSocketController.js | 18 +++++++++++++++++- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/client/api/misc.js b/client/api/misc.js index 0ece914b..696e71cb 100644 --- a/client/api/misc.js +++ b/client/api/misc.js @@ -1,12 +1,15 @@ import wsc from './webSocketConnection'; class Misc { - async loadConfig() { + async loadConfig(_configHash) { - const query = {params: [ - 'name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter', - 'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink', 'restricted' - ]}; + const query = { + params: [ + 'name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter', + 'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink', 'restricted' + ], + _configHash, + }; const config = await wsc.message(await wsc.send(Object.assign({action: 'get-config'}, query))); if (config.error) diff --git a/client/components/App.vue b/client/components/App.vue index 99c4ca0a..1b76c6f2 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -154,8 +154,11 @@ class App { (async() => { //загрузим конфиг сервера try { - const config = await miscApi.loadConfig(); - this.commit('config/setConfig', config); + const config = await miscApi.loadConfig(this.config._configHash); + + if (!config._useCached) + this.commit('config/setConfig', config); + this.showPage = true; } catch(e) { //проверим, не получен ли конфиг ранее diff --git a/client/store/modules/config.js b/client/store/modules/config.js index 32852f7f..41a3ad92 100644 --- a/client/store/modules/config.js +++ b/client/store/modules/config.js @@ -1,4 +1,3 @@ -import miscApi from '../../api/misc'; // initial state const state = { name: null, diff --git a/server/controllers/WebSocketController.js b/server/controllers/WebSocketController.js index c17aa98d..c0f5606a 100644 --- a/server/controllers/WebSocketController.js +++ b/server/controllers/WebSocketController.js @@ -20,6 +20,8 @@ class WebSocketController { this.readerWorker = new ReaderWorker(config); this.workerState = new WorkerState(); + this.configHash = ''; + if (config.bucEnabled) { this.bucClient = new BUCClient(config); } @@ -119,8 +121,22 @@ class WebSocketController { async getConfig(req, ws) { if (Array.isArray(req.params)) { const paramsSet = new Set(req.params); + const _configHash = req._configHash; - this.send(_.pick(this.config, this.config.webConfigParams.filter(x => paramsSet.has(x))), req, ws); + let response = {_useCached: true}; + + //оптимизация, чтобы не отдавал большой конфиг каждый раз при обновлении страницы + if (!_configHash || _configHash !== this.configHash) { + if (!this.configHash) { + const webConfig = _.pick(this.config, this.config.webConfigParams); + this.configHash = await utils.getBufHash(Buffer.from(JSON.stringify(webConfig)), 'sha256', 'hex'); + } + + response = _.pick(this.config, this.config.webConfigParams.filter(x => paramsSet.has(x))); + response._configHash = this.configHash; + } + + this.send(response, req, ws); } else { throw new Error('params is not an array'); } From dbec1e630e2661aeeec8663437a13e29f98ed0ba Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sat, 22 Feb 2025 14:39:29 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=81=D0=B1=D0=BE=D1=80=D0=B0=20=D0=B4=D0=BE=D0=BD?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/HelpPage/HelpPage.vue | 2 +- client/components/Reader/ReaderDialogs/ReaderDialogs.vue | 2 +- client/components/Reader/SettingsPage/OthersTab/OthersTab.vue | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/components/Reader/HelpPage/HelpPage.vue b/client/components/Reader/HelpPage/HelpPage.vue index b9555903..d3f4e3f3 100644 --- a/client/components/Reader/HelpPage/HelpPage.vue +++ b/client/components/Reader/HelpPage/HelpPage.vue @@ -51,7 +51,7 @@ const tabs = [ ['MouseHelpPage', 'Мышь/тачскрин'], ['HotkeysHelpPage', 'Клавиатура'], ['VersionHistoryPage', 'История версий'], - ['DonateHelpPage', 'Помочь проекту'], + //['DonateHelpPage', 'Помочь проекту'], ]; const componentOptions = { diff --git a/client/components/Reader/ReaderDialogs/ReaderDialogs.vue b/client/components/Reader/ReaderDialogs/ReaderDialogs.vue index 5fa85cb5..f8609645 100644 --- a/client/components/Reader/ReaderDialogs/ReaderDialogs.vue +++ b/client/components/Reader/ReaderDialogs/ReaderDialogs.vue @@ -131,7 +131,7 @@ class ReaderDialogs { async init() { await this.showWhatsNew(); - await this.showDonation(); + //await this.showDonation(); } loadSettings() { diff --git a/client/components/Reader/SettingsPage/OthersTab/OthersTab.vue b/client/components/Reader/SettingsPage/OthersTab/OthersTab.vue index eb5f0c2b..3da49307 100644 --- a/client/components/Reader/SettingsPage/OthersTab/OthersTab.vue +++ b/client/components/Reader/SettingsPage/OthersTab/OthersTab.vue @@ -53,7 +53,7 @@ -
+
From 130aebb5143643e80fa0a874e07653f4e6cf06d9 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sat, 22 Feb 2025 14:43:18 +0700 Subject: [PATCH 4/4] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.2.?= =?UTF-8?q?7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/versionHistory.js | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/components/Reader/versionHistory.js b/client/components/Reader/versionHistory.js index c05a13c3..0ca43e1e 100644 --- a/client/components/Reader/versionHistory.js +++ b/client/components/Reader/versionHistory.js @@ -1,4 +1,18 @@ export const versionHistory = [ +{ + version: '1.2.7', + releaseDate: '2025-02-22', + showUntil: '2025-02-21', + content: +` +
    +
  • отключена форма для сбора донатов
  • +
  • мелкие оптимизации
  • +
+ +` +}, + { version: '1.2.6', releaseDate: '2024-10-03', diff --git a/package.json b/package.json index 7059f5ec..432c216a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "liberama", - "version": "1.2.6", + "version": "1.2.7", "author": "Book Pauk ", "license": "CC0-1.0", "repository": "bookpauk/liberama",