diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index 0dd472b3..fc37ac4b 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -540,11 +540,10 @@ class Reader extends Vue { await this.$refs.recentBooksPage.updateTableData(); } + //сохранение в serverStorage if (value) { await utils.sleep(500); - while (!this.$refs.serverStorage.inited) await utils.sleep(100); - - this.$refs.serverStorage.saveRecent(value); + await this.$refs.serverStorage.saveRecent(value); } } } diff --git a/client/components/Reader/ServerStorage/ServerStorage.vue b/client/components/Reader/ServerStorage/ServerStorage.vue index 41db5989..4064314a 100644 --- a/client/components/Reader/ServerStorage/ServerStorage.vue +++ b/client/components/Reader/ServerStorage/ServerStorage.vue @@ -432,67 +432,74 @@ class ServerStorage extends Vue { } async saveRecent(itemKey, recurse) { + while (!this.inited || this.savingRecent) + await utils.sleep(100); + if (!this.keyInited || !this.serverSyncEnabled || this.savingRecent) return; - const bm = bookManager; + this.savingRecent = true; + try { + const bm = bookManager; - let needSaveRecent = false; - let needSaveRecentPatch = false; - let needSaveRecentMod = false; + let needSaveRecent = false; + let needSaveRecentPatch = false; + let needSaveRecentMod = false; - //newRecentMod - let newRecentMod = {}; - if (itemKey && this.cachedRecentPatch.data[itemKey] && this.prevItemKey == itemKey) { - newRecentMod = _.cloneDeep(this.cachedRecentMod); - newRecentMod.rev++; + //newRecentMod + let newRecentMod = {}; + if (itemKey && this.cachedRecentPatch.data[itemKey] && this.prevItemKey == itemKey) { + newRecentMod = _.cloneDeep(this.cachedRecentMod); + newRecentMod.rev++; - newRecentMod.data.key = itemKey; - newRecentMod.data.mod = utils.getObjDiff(this.cachedRecentPatch.data[itemKey], bm.recent[itemKey]); - needSaveRecentMod = true; - } - this.prevItemKey = itemKey; + newRecentMod.data.key = itemKey; + newRecentMod.data.mod = utils.getObjDiff(this.cachedRecentPatch.data[itemKey], bm.recent[itemKey]); + needSaveRecentMod = true; + } + this.prevItemKey = itemKey; - //newRecentPatch - let newRecentPatch = {}; - if (itemKey && !needSaveRecentMod) { - newRecentPatch = _.cloneDeep(this.cachedRecentPatch); - newRecentPatch.rev++; - newRecentPatch.data[itemKey] = bm.recent[itemKey]; + //newRecentPatch + let newRecentPatch = {}; + if (itemKey && !needSaveRecentMod) { + newRecentPatch = _.cloneDeep(this.cachedRecentPatch); + newRecentPatch.rev++; + newRecentPatch.data[itemKey] = bm.recent[itemKey]; - let applyMod = this.cachedRecentMod.data; - if (applyMod && applyMod.key && newRecentPatch.data[applyMod.key]) - newRecentPatch.data[applyMod.key] = utils.applyObjDiff(newRecentPatch.data[applyMod.key], applyMod.mod); + let applyMod = this.cachedRecentMod.data; + if (applyMod && applyMod.key && newRecentPatch.data[applyMod.key]) + newRecentPatch.data[applyMod.key] = utils.applyObjDiff(newRecentPatch.data[applyMod.key], applyMod.mod); - newRecentMod = {rev: this.cachedRecentMod.rev + 1, data: {}}; - needSaveRecentPatch = true; - needSaveRecentMod = true; - } + newRecentMod = {rev: this.cachedRecentMod.rev + 1, data: {}}; + needSaveRecentPatch = true; + needSaveRecentMod = true; + } - //newRecent - let newRecent = {}; - if (!itemKey || (needSaveRecentPatch && Object.keys(newRecentPatch.data).length > 10)) { - newRecent = {rev: this.cachedRecent.rev + 1, data: bm.recent}; - newRecentPatch = {rev: this.cachedRecentPatch.rev + 1, data: {}}; - newRecentMod = {rev: this.cachedRecentMod.rev + 1, data: {}}; - needSaveRecent = true; - needSaveRecentPatch = true; - needSaveRecentMod = true; - } + //newRecent + let newRecent = {}; + if (!itemKey || (needSaveRecentPatch && Object.keys(newRecentPatch.data).length > 10)) { + //ждем весь bm.recent + while (!bookManager.loaded) + await utils.sleep(100); - //query - let query = {}; - if (needSaveRecent) { - query = {recent: newRecent, recentPatch: newRecentPatch, recentMod: newRecentMod}; - } else if (needSaveRecentPatch) { - query = {recentPatch: newRecentPatch, recentMod: newRecentMod}; - } else { - query = {recentMod: newRecentMod}; - } + newRecent = {rev: this.cachedRecent.rev + 1, data: bm.recent}; + newRecentPatch = {rev: this.cachedRecentPatch.rev + 1, data: {}}; + newRecentMod = {rev: this.cachedRecentMod.rev + 1, data: {}}; + needSaveRecent = true; + needSaveRecentPatch = true; + needSaveRecentMod = true; + } - //сохранение - this.savingRecent = true; - try { + //query + let query = {}; + if (needSaveRecent) { + query = {recent: newRecent, recentPatch: newRecentPatch, recentMod: newRecentMod}; + } else if (needSaveRecentPatch) { + query = {recentPatch: newRecentPatch, recentMod: newRecentMod}; + } else { + query = {recentMod: newRecentMod}; + } + + //сохранение let result = {state: ''}; try { diff --git a/client/components/Reader/versionHistory.js b/client/components/Reader/versionHistory.js index 3a30ee2f..0ce414b2 100644 --- a/client/components/Reader/versionHistory.js +++ b/client/components/Reader/versionHistory.js @@ -1,7 +1,7 @@ export const versionHistory = [ { - showUntil: '2019-10-20', - header: '0.7.4 (2019-10-21)', + showUntil: '2019-10-21', + header: '0.7.5 (2019-10-22)', content: `
-
URL html- , - (, " fb2").
- : html, txt, fb2, fb2.zip
+ : fb2, html, txt, rtf, doc, docx, pdf, epub, mobi : zip, bz2, gz
, :
javascript:location.href='http://old.omnireader.ru/?url='+location.href; diff --git a/package.json b/package.json index 422a64a2..8a4d7311 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Liberama", - "version": "0.7.4", + "version": "0.7.5", "engines": { "node": ">=10.0.0" },