From a00b2d6574e1c8c0388eeb24833c6652c56cf743 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 27 Jul 2022 23:29:52 +0700 Subject: [PATCH 01/10] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/core/BookUpdateChecker/BUCServer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/core/BookUpdateChecker/BUCServer.js b/server/core/BookUpdateChecker/BUCServer.js index f2822962..bed3a1dd 100644 --- a/server/core/BookUpdateChecker/BUCServer.js +++ b/server/core/BookUpdateChecker/BUCServer.js @@ -253,7 +253,7 @@ class BUCServer { let hash = ''; const headers = await this.down.head(row.id); - const modTime = headers['last-modified'] + const modTime = headers['last-modified'] || ''; if (!modTime || !row.modTime || (modTime !== row.modTime)) { const downdata = await this.down.load(row.id); @@ -291,6 +291,8 @@ class BUCServer { }`, where: `@@id(${db.esc(row.id)})` }); + + log(LM_ERR, `error ${row.id} > ${e.stack}`); } finally { (async() => { await utils.sleep(this.sameHostCheckInterval); From 32dff128f406a82a46175b826d369049d02d610a Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Thu, 28 Jul 2022 18:04:47 +0700 Subject: [PATCH 02/10] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=80=D1=81=D0=B8=D0=BD=D0=B3?= =?UTF-8?q?=D0=B0=20head-=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/core/BookUpdateChecker/BUCServer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/core/BookUpdateChecker/BUCServer.js b/server/core/BookUpdateChecker/BUCServer.js index bed3a1dd..b557e90a 100644 --- a/server/core/BookUpdateChecker/BUCServer.js +++ b/server/core/BookUpdateChecker/BUCServer.js @@ -134,6 +134,7 @@ class BUCServer { id, queryTime: now, checkTime: 0, // 0 - never checked + etag: '', modTime: '', size: 0, checkSum: '', //sha256 @@ -253,9 +254,13 @@ class BUCServer { let hash = ''; const headers = await this.down.head(row.id); + + const etag = headers['etag'] || ''; const modTime = headers['last-modified'] || ''; - if (!modTime || !row.modTime || (modTime !== row.modTime)) { + if ((!etag || !row.etag || (etag !== row.etag)) + && (!modTime || !row.modTime || (modTime !== row.modTime)) + ) { const downdata = await this.down.load(row.id); size = downdata.length; @@ -267,6 +272,7 @@ class BUCServer { table: 'buc', mod: `(r) => { r.checkTime = ${db.esc(Date.now())}; + r.etag = ${(unchanged ? 'r.etag' : db.esc(etag))}; r.modTime = ${(unchanged ? 'r.modTime' : db.esc(modTime))}; r.size = ${(unchanged ? 'r.size' : db.esc(size))}; r.checkSum = ${(unchanged ? 'r.checkSum' : db.esc(hash))}; From f4a7482b3b5b05f3bb0f0bb6a12510b6e0c3615a Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Thu, 28 Jul 2022 18:38:49 +0700 Subject: [PATCH 03/10] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=80=D1=81=D0=B8=D0=BD=D0=B3?= =?UTF-8?q?=D0=B0=20head-=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/core/BookUpdateChecker/BUCServer.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/server/core/BookUpdateChecker/BUCServer.js b/server/core/BookUpdateChecker/BUCServer.js index b557e90a..2645d971 100644 --- a/server/core/BookUpdateChecker/BUCServer.js +++ b/server/core/BookUpdateChecker/BUCServer.js @@ -26,8 +26,8 @@ class BUCServer { this.periodicCheckWait = 500;//пауза, если нечего делать this.cleanQueryInterval = 300*dayMs;//интервал очистки устаревших - this.oldQueryInterval = 30*dayMs;//интервал устаревания запроса на обновление - this.checkingInterval = 3*hourMs;//интервал проверки обновления одного и того же файла + this.oldQueryInterval = 14*dayMs;//интервал устаревания запроса на обновление + this.checkingInterval = 5*hourMs;//интервал проверки обновления одного и того же файла this.sameHostCheckInterval = 1000;//интервал проверки файла на том же сайте, не менее } else { this.maxCheckQueueLength = 10;//максимальная длина checkQueue @@ -184,8 +184,8 @@ class BUCServer { log(LM_WARN, `clean 'buc' table: deleted ${res.deleted}`); } - rows = await db.select({table: 'buc', count: true}); - log(LM_WARN, `'buc' table length: ${rows[0].count}`); + //rows = await db.select({table: 'buc', count: true}); + //log(LM_WARN, `'buc' table length: ${rows[0].count}`); now = Date.now(); //выборка кандидатов @@ -250,16 +250,20 @@ class BUCServer { try { let unchanged = true; - let size = 0; let hash = ''; const headers = await this.down.head(row.id); const etag = headers['etag'] || ''; const modTime = headers['last-modified'] || ''; + let size = parseInt(headers['content-length'], 10) || 0; + //log(row.id); + //log(`etag: ${etag}, modTime: ${modTime}, size: ${size}`) + if ((!etag || !row.etag || (etag !== row.etag)) && (!modTime || !row.modTime || (modTime !== row.modTime)) + && (!size || !row.size || (size !== row.size)) ) { const downdata = await this.down.load(row.id); From 18c8b2d80307ff5f1b4ad2c63398841df7887043 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Thu, 28 Jul 2022 18:50:56 +0700 Subject: [PATCH 04/10] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/core/BookUpdateChecker/BUCClient.js | 2 +- server/core/BookUpdateChecker/BUCServer.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/core/BookUpdateChecker/BUCClient.js b/server/core/BookUpdateChecker/BUCClient.js index 4a49508d..7ea33e83 100644 --- a/server/core/BookUpdateChecker/BUCClient.js +++ b/server/core/BookUpdateChecker/BUCClient.js @@ -249,7 +249,7 @@ class BUCClient { this.periodicSendBookUrls();//no await this.periodicSync();//no await - log(`BUC Client started`); + log(`BUC Client Worker started`); } catch (e) { log(LM_FATAL, e.stack); ayncExit.exit(1); diff --git a/server/core/BookUpdateChecker/BUCServer.js b/server/core/BookUpdateChecker/BUCServer.js index 2645d971..4a8681cf 100644 --- a/server/core/BookUpdateChecker/BUCServer.js +++ b/server/core/BookUpdateChecker/BUCServer.js @@ -260,7 +260,7 @@ class BUCServer { //log(row.id); //log(`etag: ${etag}, modTime: ${modTime}, size: ${size}`) - + if ((!etag || !row.etag || (etag !== row.etag)) && (!modTime || !row.modTime || (modTime !== row.modTime)) && (!size || !row.size || (size !== row.size)) @@ -331,9 +331,9 @@ class BUCServer { for (let i = 0; i < 10; i++) this.periodicCheck();//no await - log(`------------------`); - log(`BUC Server started`); - log(`------------------`); + log(`-------------------------`); + log(`BUC Server Worker started`); + log(`-------------------------`); } catch (e) { log(LM_FATAL, e.stack); ayncExit.exit(1); From 45ea26810a6849e4800df762e847b4f8fe1f8946 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Thu, 28 Jul 2022 20:22:38 +0700 Subject: [PATCH 05/10] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20fillCheckQueue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/core/BookUpdateChecker/BUCServer.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/server/core/BookUpdateChecker/BUCServer.js b/server/core/BookUpdateChecker/BUCServer.js index 4a8681cf..7e923d0f 100644 --- a/server/core/BookUpdateChecker/BUCServer.js +++ b/server/core/BookUpdateChecker/BUCServer.js @@ -184,8 +184,8 @@ class BUCServer { log(LM_WARN, `clean 'buc' table: deleted ${res.deleted}`); } - //rows = await db.select({table: 'buc', count: true}); - //log(LM_WARN, `'buc' table length: ${rows[0].count}`); + rows = await db.select({table: 'buc', count: true}); + log(LM_WARN, `'buc' table size: ${rows[0].count}`); now = Date.now(); //выборка кандидатов @@ -200,24 +200,30 @@ class BUCServer { ` }); -//console.log(rows); - + //формирование checkQueue if (rows.length) { const ids = []; + const rowsToPush = []; + //сначала выберем сколько надо for (const row of rows) { - if (this.checkQueue.length >= this.maxCheckQueueLength) + if (this.checkQueue.length + rowsToPush.length >= this.maxCheckQueueLength) break; + rowsToPush.push(row); ids.push(row.id); - this.checkQueue.push(row); } + //установим у них флаг "в обработке" await db.update({ table: 'buc', mod: `(r) => r.state = 1`, where: `@@id(${db.esc(ids)})` }); + + //пушим в очередь, после этого их обработает periodicCheck + for (const row of rowsToPush) + this.checkQueue.push(row); log(LM_WARN, `checkQueue: added ${ids.length} recs, total ${this.checkQueue.length}`); } From 49038b10f79362838ccfb9866e9c07d68782a5d0 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Fri, 29 Jul 2022 17:45:33 +0700 Subject: [PATCH 06/10] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/core/BookUpdateChecker/BUCServer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/core/BookUpdateChecker/BUCServer.js b/server/core/BookUpdateChecker/BUCServer.js index 7e923d0f..3c873b97 100644 --- a/server/core/BookUpdateChecker/BUCServer.js +++ b/server/core/BookUpdateChecker/BUCServer.js @@ -308,7 +308,7 @@ class BUCServer { where: `@@id(${db.esc(row.id)})` }); - log(LM_ERR, `error ${row.id} > ${e.stack}`); + log(LM_ERR, `error ${row.id} > ${e.stack ? e.stack : e.message}`); } finally { (async() => { await utils.sleep(this.sameHostCheckInterval); From 084401b9c33e9acec682d2800b3e82d9d8dfda22 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 3 Aug 2022 14:53:58 +0700 Subject: [PATCH 07/10] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reader/RecentBooksPage/RecentBooksPage.vue | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue index e23e3ff9..32a07476 100644 --- a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue +++ b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue @@ -147,8 +147,8 @@ {{ item.desc.title }}
- Размер: {{ item.downloadSize }} → {{ item.bucSize }}, - {{ item.bucSize - item.downloadSize > 0 ? '+' : '' }}{{ item.bucSize - item.downloadSize }} + Размер: {{ item.bucSize - item.downloadSize > 0 ? '+' : '' }}{{ item.bucSize - item.downloadSize }} + ({{ item.downloadSize }} → {{ item.bucSize }})
@@ -231,7 +231,12 @@ @update:model-value="checkBucChange(item)" > - Проверять обновления +
+ Проверка обновлений отключена автоматически
т.к. книга не обновлялась {{ bucCancelDays }} дней +
+
+ {{ (item.checkBuc ? 'Проверка обновлений книги включена' : 'Проверка обновлений книги отключена') }} +
@@ -289,6 +294,7 @@ class RecentBooksPage { bucEnabled = false; bucSizeDiff = 0; bucSetOnNew = false; + bucCancelDays = 0; needBookUpdateCount = 0; showArchive = false; @@ -332,6 +338,7 @@ class RecentBooksPage { this.bucEnabled = settings.bucEnabled; this.bucSizeDiff = settings.bucSizeDiff; this.bucSetOnNew = settings.bucSetOnNew; + this.bucCancelDays = settings.bucCancelDays; } get settings() { @@ -403,8 +410,8 @@ class RecentBooksPage { inGroup: false, coverPageUrl: book.coverPageUrl, - showCheckBuc: !this.showArchive && utils.hasProp(book, 'downloadSize'), - checkBuc: !!book.checkBuc, + showCheckBuc: !this.showArchive && utils.hasProp(book, 'downloadSize') && book.url.indexOf('disk://') !== 0, + checkBuc: book.checkBuc, needBookUpdate: ( !this.showArchive && book.checkBuc From 76673295bf408f11ca7d54fdfc2e916b26fdac6e Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 3 Aug 2022 14:57:01 +0700 Subject: [PATCH 08/10] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE=D0=BE=D1=82=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BA=D0=BD=D0=B8=D0=B3=20=D0=BF=D0=BE=20=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=B5=D1=87=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=B7=D0=B0=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BE=D0=BB=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=B0=20=D0=B4=D0=BD=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/Reader.vue | 38 +++++++++++++++ .../Reader/SettingsPage/UpdateTab.inc | 48 ++++++++++++++----- client/components/Reader/share/bookManager.js | 2 + client/store/modules/reader.js | 4 +- 4 files changed, 80 insertions(+), 12 deletions(-) diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index 69e43a4d..863443f9 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -476,7 +476,10 @@ class Reader { this.dualPageMode = settings.dualPageMode; this.userWallpapers = settings.userWallpapers; this.bucEnabled = settings.bucEnabled; + this.bucSizeDiff = settings.bucSizeDiff; this.bucSetOnNew = settings.bucSetOnNew; + this.bucCancelEnabled = settings.bucCancelEnabled; + this.bucCancelDays = settings.bucCancelDays; this.readerActionByKeyCode = utils.userHotKeysObjectSwap(settings.userHotKeys); this.$root.readerActionByKeyEvent = (event) => { @@ -604,6 +607,7 @@ class Reader { await utils.sleep(1000);//чтобы не ддосить сервер } + const checkSetTime = {}; //проставим новые размеры у книг for (const book of sorted) { //размер 0 считаем отсутствующим @@ -611,6 +615,40 @@ class Reader { book.bucSize = bucSize[book.url]; await bookManager.recentSetItem(book); } + + //подготовка к следующему шагу + if (updateUrls.has(book.url)) { + let time = checkSetTime[book.key] || 0; + if (book.checkBucTime && book.checkBucTime > time) { + time = book.checkBucTime; + } else if (book.loadTime && book.loadTime > time) { + time = book.loadTime; + } + + checkSetTime[book.key] = time; + } + } + + //bucCancelEnabled и bucCancelDays + //снимем флаг checkBuc у необновлявшихся bucCancelDays + if (this.bucCancelEnabled) { + for (const [key, time] of Object.entries(checkSetTime)) { + if (time && Date.now() - time > this.bucCancelDays*24*3600*1000) { + const book = await bookManager.getRecentBook({key}); + const needBookUpdate = + book.checkBuc + && book.bucSize + && utils.hasProp(book, 'downloadSize') + && book.bucSize !== book.downloadSize + && (book.bucSize - book.downloadSize >= this.bucSizeDiff) + ; + + if (book && !needBookUpdate) { + book.checkBuc = undefined;//!!! + await bookManager.recentSetItem(book); + } + } + } } await this.$refs.recentBooksPage.updateTableData(); diff --git a/client/components/Reader/SettingsPage/UpdateTab.inc b/client/components/Reader/SettingsPage/UpdateTab.inc index fe5d0cbe..f5e193e4 100644 --- a/client/components/Reader/SettingsPage/UpdateTab.inc +++ b/client/components/Reader/SettingsPage/UpdateTab.inc @@ -27,17 +27,7 @@
- - Автопроверка для вновь загружаемых - - Автоматически устанавливать флаг проверки
- обновлений для всех вновь загружаемых книг -
-
-
- -
-
Разница размеров
+
Разница размеров
@@ -48,3 +38,39 @@
+ +
+
+ + Автопроверка для вновь загружаемых + + Автоматически устанавливать флаг проверки
+ обновлений для всех вновь загружаемых книг +
+
+
+ +
+
+ + Отменять проверку через {{ bucCancelDays }} дней{{ (bucCancelEnabled ? ':' : '') }} + + Снимать флаг проверки с книги, если не было
+ обновлений в течение {{ bucCancelDays }} дней +
+
+
+ +
+
+
+
+ + + + Снимать флаг проверки с книги, если не было
+ обновлений в течение {{ bucCancelDays }} дней +
+
+
+ diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index 651dda1a..fc080c34 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -505,6 +505,8 @@ class BookManager { for (const book of updateItems) { book.checkBuc = checkBuc; + if (checkBuc) + book.checkBucTime = Date.now(); await this.recentSetItem(book); } } diff --git a/client/store/modules/reader.js b/client/store/modules/reader.js index 7af61591..57d0e150 100644 --- a/client/store/modules/reader.js +++ b/client/store/modules/reader.js @@ -185,7 +185,7 @@ const settingDefaults = { fontShifts: {}, showToolButton: {}, - toolBarHideOnScroll: true, + toolBarHideOnScroll: false, userHotKeys: {}, userWallpapers: [], @@ -196,6 +196,8 @@ const settingDefaults = { bucEnabled: true, // общее включение/выключение проверки обновлений bucSizeDiff: 1, // разница в размерах файла, при которой показывать наличие обновления bucSetOnNew: true, // автоматически включать проверку обновлений для вновь загружаемых файлов + bucCancelEnabled: true, // вкл/выкл отмену проверки книг через bucCancelDays + bucCancelDays: 60, // количество дней, через которое отменяется проверка книги, при условии отсутствия обновлений за это время //для SettingsPage needUpdateSettingsView: 0, From ec8fbcdf381ef7a860932569f965d75bf50b72b9 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 3 Aug 2022 15:34:24 +0700 Subject: [PATCH 09/10] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/Reader.vue | 26 +++++++++---------- client/components/Reader/share/bookManager.js | 5 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index 863443f9..82eb6ee8 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -616,25 +616,25 @@ class Reader { await bookManager.recentSetItem(book); } - //подготовка к следующему шагу + //подготовка к следующему шагу, ищем книгу по url с максимальной датой установки checkBucTime/loadTime + //от этой даты будем потом отсчитывать bucCancelDays if (updateUrls.has(book.url)) { - let time = checkSetTime[book.key] || 0; - if (book.checkBucTime && book.checkBucTime > time) { - time = book.checkBucTime; - } else if (book.loadTime && book.loadTime > time) { - time = book.loadTime; - } + let rec = checkSetTime[book.url] || {time: 0, loadTime: 0}; - checkSetTime[book.key] = time; + const time = (book.checkBucTime ? book.checkBucTime : (rec.loadTime || 0)); + if (time > rec.time || (time == rec.time && (book.loadTime > rec.loadTime))) + rec = {time, loadTime: book.loadTime, key: book.key}; + + checkSetTime[book.url] = rec; } } //bucCancelEnabled и bucCancelDays //снимем флаг checkBuc у необновлявшихся bucCancelDays if (this.bucCancelEnabled) { - for (const [key, time] of Object.entries(checkSetTime)) { - if (time && Date.now() - time > this.bucCancelDays*24*3600*1000) { - const book = await bookManager.getRecentBook({key}); + for (const rec of Object.values(checkSetTime)) { + if (rec.time && Date.now() - rec.time > this.bucCancelDays*24*3600*1000) { + const book = await bookManager.getRecentBook({key: rec.key}); const needBookUpdate = book.checkBuc && book.bucSize @@ -644,8 +644,7 @@ class Reader { ; if (book && !needBookUpdate) { - book.checkBuc = undefined;//!!! - await bookManager.recentSetItem(book); + await bookManager.setCheckBuc(book, undefined);//!!! } } } @@ -1289,6 +1288,7 @@ class Reader { this.checkBookPosPercent(); this.activateClickMapPage();//no await + this.$refs.recentBooksPage.updateTableData();//no await return; } diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index fc080c34..da8d8c67 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -487,7 +487,7 @@ class BookManager { await this.recentSetItem(item); } - async setCheckBuc(value, checkBuc = true) { + async setCheckBuc(value, checkBuc) { const item = this.recent[value.key]; const updateItems = []; @@ -503,10 +503,11 @@ class BookManager { } } + const now = Date.now(); for (const book of updateItems) { book.checkBuc = checkBuc; if (checkBuc) - book.checkBucTime = Date.now(); + book.checkBucTime = now; await this.recentSetItem(book); } } From 058c79570b21ed38d1775b980bf8d4384861cd87 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 3 Aug 2022 15:52:48 +0700 Subject: [PATCH 10/10] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/Reader.vue | 3 +++ client/components/Reader/share/bookManager.js | 2 +- client/store/modules/reader.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index 82eb6ee8..9cc55eba 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -610,6 +610,9 @@ class Reader { const checkSetTime = {}; //проставим новые размеры у книг for (const book of sorted) { + if (book.deleted) + continue; + //размер 0 считаем отсутствующим if (book.url && bucSize[book.url] && bucSize[book.url] !== book.bucSize) { book.bucSize = bucSize[book.url]; diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index da8d8c67..8308cf0d 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -495,7 +495,7 @@ class BookManager { if (item.sameBookKey !== undefined) { const sorted = this.getSortedRecent(); for (const book of sorted) { - if (book.sameBookKey === item.sameBookKey) + if (!book.deleted && book.sameBookKey === item.sameBookKey) updateItems.push(book); } } else { diff --git a/client/store/modules/reader.js b/client/store/modules/reader.js index 57d0e150..3c72299a 100644 --- a/client/store/modules/reader.js +++ b/client/store/modules/reader.js @@ -197,7 +197,7 @@ const settingDefaults = { bucSizeDiff: 1, // разница в размерах файла, при которой показывать наличие обновления bucSetOnNew: true, // автоматически включать проверку обновлений для вновь загружаемых файлов bucCancelEnabled: true, // вкл/выкл отмену проверки книг через bucCancelDays - bucCancelDays: 60, // количество дней, через которое отменяется проверка книги, при условии отсутствия обновлений за это время + bucCancelDays: 90, // количество дней, через которое отменяется проверка книги, при условии отсутствия обновлений за это время //для SettingsPage needUpdateSettingsView: 0,