|
@@ -133,6 +133,9 @@ import ReaderDialogs from './ReaderDialogs/ReaderDialogs.vue';
|
|
import bookManager from './share/bookManager';
|
|
import bookManager from './share/bookManager';
|
|
import rstore from '../../store/modules/reader';
|
|
import rstore from '../../store/modules/reader';
|
|
import readerApi from '../../api/reader';
|
|
import readerApi from '../../api/reader';
|
|
|
|
+import miscApi from '../../api/misc';
|
|
|
|
+
|
|
|
|
+import {versionHistory} from './versionHistory';
|
|
import * as utils from '../../share/utils';
|
|
import * as utils from '../../share/utils';
|
|
|
|
|
|
export default @Component({
|
|
export default @Component({
|
|
@@ -229,7 +232,6 @@ class Reader extends Vue {
|
|
this.rstore = rstore;
|
|
this.rstore = rstore;
|
|
this.loading = true;
|
|
this.loading = true;
|
|
this.commit = this.$store.commit;
|
|
this.commit = this.$store.commit;
|
|
- this.dispatch = this.$store.dispatch;
|
|
|
|
this.reader = this.$store.state.reader;
|
|
this.reader = this.$store.state.reader;
|
|
this.config = this.$store.state.config;
|
|
this.config = this.$store.state.config;
|
|
|
|
|
|
@@ -292,6 +294,32 @@ class Reader extends Vue {
|
|
this.updateRoute();
|
|
this.updateRoute();
|
|
|
|
|
|
await this.$refs.dialogs.init();
|
|
await this.$refs.dialogs.init();
|
|
|
|
+
|
|
|
|
+ await utils.sleep(15*1000); //подождем 15 секунд, чтобы прогрузился ServiceWorker при выходе новой версии
|
|
|
|
+ this.isFirstNeedUpdateNotify = true;
|
|
|
|
+ //вечный цикл, запрашиваем периодически конфиг для проверки выхода новой версии читалки
|
|
|
|
+ while (true) {// eslint-disable-line no-constant-condition
|
|
|
|
+ if (this.showNeedUpdateNotify) {
|
|
|
|
+ try {
|
|
|
|
+ const config = await miscApi.loadConfig();
|
|
|
|
+ this.commit('config/setConfig', config);
|
|
|
|
+
|
|
|
|
+ let againMes = '';
|
|
|
|
+ if (this.isFirstNeedUpdateNotify) {
|
|
|
|
+ againMes = ' ЕЩЕ один раз';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (this.version != this.clientVersion)
|
|
|
|
+ this.$root.notify.info(`Вышла новая версия (v${this.version}) читалки.<br>Пожалуйста, обновите страницу${againMes}.`, 'Обновление');
|
|
|
|
+ } catch(e) {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await utils.sleep(3600*1000); //каждый час
|
|
|
|
+ this.isFirstNeedUpdateNotify = false;
|
|
|
|
+ }
|
|
|
|
+ //дальше кода нет
|
|
})();
|
|
})();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -304,6 +332,7 @@ class Reader extends Vue {
|
|
this.blinkCachedLoad = settings.blinkCachedLoad;
|
|
this.blinkCachedLoad = settings.blinkCachedLoad;
|
|
this.showToolButton = settings.showToolButton;
|
|
this.showToolButton = settings.showToolButton;
|
|
this.enableSitesFilter = settings.enableSitesFilter;
|
|
this.enableSitesFilter = settings.enableSitesFilter;
|
|
|
|
+ this.showNeedUpdateNotify = settings.showNeedUpdateNotify;
|
|
|
|
|
|
this.readerActionByKeyCode = utils.userHotKeysObjectSwap(settings.userHotKeys);
|
|
this.readerActionByKeyCode = utils.userHotKeysObjectSwap(settings.userHotKeys);
|
|
this.$root.readerActionByKeyEvent = (event) => {
|
|
this.$root.readerActionByKeyEvent = (event) => {
|
|
@@ -394,6 +423,16 @@ class Reader extends Vue {
|
|
return this.$store.state.config.mode;
|
|
return this.$store.state.config.mode;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ get version() {
|
|
|
|
+ return this.$store.state.config.version;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ get clientVersion() {
|
|
|
|
+ let v = versionHistory[0].header;
|
|
|
|
+ v = v.split(' ')[0];
|
|
|
|
+ return v;
|
|
|
|
+ }
|
|
|
|
+
|
|
get routeParamUrl() {
|
|
get routeParamUrl() {
|
|
let result = '';
|
|
let result = '';
|
|
const path = this.$route.fullPath;
|
|
const path = this.$route.fullPath;
|