Merge branch 'release/0.6.5'
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
<ul>
|
||||
<li>загрузка любой страницы интернета</li>
|
||||
<li>изменение цвета фона, текста, размер и тип шрифта и прочее</li>
|
||||
<li>установка и запоминание текущей позиции и настроек в браузере (в будущем планируется сохранение и на сервер)</li>
|
||||
<li>установка и запоминание текущей позиции и настроек в браузере и на сервере</li>
|
||||
<li>синхронизация данных (настроек и читаемых книг) между различными устройствами</li>
|
||||
<li>кэширование файлов книг на клиенте и на сервере</li>
|
||||
<li>открытие книг с локального диска</li>
|
||||
<li>плавный скроллинг текста</li>
|
||||
|
||||
@@ -37,6 +37,7 @@ export default @Component({
|
||||
class ServerStorage extends Vue {
|
||||
created() {
|
||||
this.inited = false;
|
||||
this.keyInited = false;
|
||||
this.commit = this.$store.commit;
|
||||
this.prevServerStorageKey = null;
|
||||
this.$root.$on('generateNewServerStorageKey', () => {this.generateNewServerStorageKey()});
|
||||
@@ -88,6 +89,7 @@ class ServerStorage extends Vue {
|
||||
if (this.prevServerStorageKey != this.serverStorageKey) {
|
||||
this.prevServerStorageKey = this.serverStorageKey;
|
||||
this.hashedStorageKey = utils.toBase58(cryptoUtils.sha256(this.serverStorageKey));
|
||||
this.keyInited = true;
|
||||
|
||||
await this.loadProfiles(force);
|
||||
this.checkCurrentProfile();
|
||||
@@ -163,7 +165,7 @@ class ServerStorage extends Vue {
|
||||
}
|
||||
|
||||
async loadSettings(force) {
|
||||
if (!this.serverSyncEnabled || !this.currentProfile)
|
||||
if (!this.keyInited || !this.serverSyncEnabled || !this.currentProfile)
|
||||
return;
|
||||
|
||||
const setsId = `settings-${this.currentProfile}`;
|
||||
@@ -206,7 +208,7 @@ class ServerStorage extends Vue {
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
if (!this.serverSyncEnabled || !this.currentProfile || this.savingSettings)
|
||||
if (!this.keyInited || !this.serverSyncEnabled || !this.currentProfile || this.savingSettings)
|
||||
return;
|
||||
|
||||
const diff = utils.getObjDiff(this.oldSettings, this.settings);
|
||||
@@ -252,7 +254,7 @@ class ServerStorage extends Vue {
|
||||
}
|
||||
|
||||
async loadProfiles(force) {
|
||||
if (!this.serverSyncEnabled)
|
||||
if (!this.keyInited || !this.serverSyncEnabled)
|
||||
return;
|
||||
|
||||
const oldRev = this.profilesRev;
|
||||
@@ -294,7 +296,7 @@ class ServerStorage extends Vue {
|
||||
}
|
||||
|
||||
async saveProfiles() {
|
||||
if (!this.serverSyncEnabled || this.savingProfiles)
|
||||
if (!this.keyInited || !this.serverSyncEnabled || this.savingProfiles)
|
||||
return;
|
||||
|
||||
const diff = utils.getObjDiff(this.oldProfiles, this.profiles);
|
||||
@@ -346,7 +348,7 @@ class ServerStorage extends Vue {
|
||||
}
|
||||
|
||||
async loadRecent(force) {
|
||||
if (!this.serverSyncEnabled)
|
||||
if (!this.keyInited || !this.serverSyncEnabled)
|
||||
return;
|
||||
|
||||
const oldRev = bookManager.recentRev;
|
||||
@@ -416,7 +418,7 @@ class ServerStorage extends Vue {
|
||||
}
|
||||
|
||||
async saveRecent() {
|
||||
if (!this.serverSyncEnabled || this.savingRecent)
|
||||
if (!this.keyInited || !this.serverSyncEnabled || this.savingRecent)
|
||||
return;
|
||||
|
||||
const bm = bookManager;
|
||||
@@ -462,7 +464,7 @@ class ServerStorage extends Vue {
|
||||
}
|
||||
|
||||
async saveRecentLast(force = false) {
|
||||
if (!this.serverSyncEnabled || this.savingRecentLast)
|
||||
if (!this.keyInited || !this.serverSyncEnabled || this.savingRecentLast)
|
||||
return;
|
||||
|
||||
const bm = bookManager;
|
||||
|
||||
@@ -452,7 +452,7 @@
|
||||
</el-tab-pane>
|
||||
<!-- Сброс ------------------------------------------------------------------------->
|
||||
<el-tab-pane label="Сброс">
|
||||
<el-button @click="setDefaults">Установить по-умолчанию</el-button>
|
||||
<el-button @click="setDefaults">Установить по умолчанию</el-button>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
|
||||
@@ -79,19 +79,22 @@ class BookManager {
|
||||
}
|
||||
}
|
||||
|
||||
let key = null;
|
||||
len = await bmRecentStore.length();
|
||||
for (let i = 0; i < len; i++) {
|
||||
key = await bmRecentStore.key(i);
|
||||
if (key) {
|
||||
let r = await bmRecentStore.getItem(key);
|
||||
if (_.isObject(r) && r.key) {
|
||||
this.recent[r.key] = r;
|
||||
//"ленивая" загрузка
|
||||
(async() => {
|
||||
let key = null;
|
||||
len = await bmRecentStore.length();
|
||||
for (let i = 0; i < len; i++) {
|
||||
key = await bmRecentStore.key(i);
|
||||
if (key) {
|
||||
let r = await bmRecentStore.getItem(key);
|
||||
if (_.isObject(r) && r.key) {
|
||||
this.recent[r.key] = r;
|
||||
}
|
||||
} else {
|
||||
await bmRecentStore.removeItem(key);
|
||||
}
|
||||
} else {
|
||||
await bmRecentStore.removeItem(key);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
//размножение для дебага
|
||||
/*if (key) {
|
||||
@@ -410,6 +413,11 @@ class BookManager {
|
||||
this.recentLast = value;
|
||||
await bmCacheStore.setItem('recent-last', this.recentLast);
|
||||
if (value && value.key) {
|
||||
//гарантия переключения книги
|
||||
const mostRecent = this.mostRecentBook();
|
||||
if (mostRecent)
|
||||
this.recent[mostRecent.key].touchTime = value.touchTime - 1;
|
||||
|
||||
this.recent[value.key] = value;
|
||||
await bmRecentStore.setItem(value.key, value);
|
||||
await bmCacheStore.setItem('recent', this.recent);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Liberama",
|
||||
"version": "0.6.4",
|
||||
"version": "0.6.5",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user