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