From 6ba1035b69e8a3c4413d343b893ea6d9254e951f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 3 Mar 2018 07:32:18 +0900 Subject: nanka iroiro Closes #1168, #1169 --- src/web/app/boot.js | 4 +++- src/web/app/common/scripts/check-for-update.ts | 10 ++++++---- src/web/app/common/views/components/switch.vue | 6 +++++- src/web/app/desktop/views/components/settings.vue | 11 ++++++++++- 4 files changed, 24 insertions(+), 7 deletions(-) (limited to 'src/web/app') diff --git a/src/web/app/boot.js b/src/web/app/boot.js index 211dc2f883..91830b6c03 100644 --- a/src/web/app/boot.js +++ b/src/web/app/boot.js @@ -61,11 +61,13 @@ app = isMobile ? 'mobile' : 'desktop'; } + const ver = localStorage.getItem('v') || VERSION; + // Load an app script // Note: 'async' make it possible to load the script asyncly. // 'defer' make it possible to run the script when the dom loaded. const script = document.createElement('script'); - script.setAttribute('src', `/assets/${app}.${VERSION}.${lang}.js`); + script.setAttribute('src', `/assets/${app}.${ver}.${lang}.js`); script.setAttribute('async', 'true'); script.setAttribute('defer', 'true'); head.appendChild(script); diff --git a/src/web/app/common/scripts/check-for-update.ts b/src/web/app/common/scripts/check-for-update.ts index 3e7eb79d8b..81c1eb9812 100644 --- a/src/web/app/common/scripts/check-for-update.ts +++ b/src/web/app/common/scripts/check-for-update.ts @@ -1,11 +1,13 @@ import MiOS from '../mios'; -import { version } from '../../config'; +import { version as current } from '../../config'; export default async function(mios: MiOS, force = false, silent = false) { const meta = await mios.getMeta(force); + const newer = meta.version; - if (meta.version != version) { + if (newer != current) { localStorage.setItem('should-refresh', 'true'); + localStorage.setItem('v', newer); // Clear cache (serive worker) try { @@ -21,10 +23,10 @@ export default async function(mios: MiOS, force = false, silent = false) { } if (!silent) { - alert('%i18n:common.update-available%'.replace('{newer}', meta.version).replace('{current}', version)); + alert('%i18n:common.update-available%'.replace('{newer}', newer).replace('{current}', current)); } - return meta.version; + return newer; } else { return null; } diff --git a/src/web/app/common/views/components/switch.vue b/src/web/app/common/views/components/switch.vue index fc12e00540..bfb951dfa1 100644 --- a/src/web/app/common/views/components/switch.vue +++ b/src/web/app/common/views/components/switch.vue @@ -86,6 +86,7 @@ export default Vue.extend({ diff --git a/src/web/app/desktop/views/components/settings.vue b/src/web/app/desktop/views/components/settings.vue index 4a9db5f48b..0c1968f67a 100644 --- a/src/web/app/desktop/views/components/settings.vue +++ b/src/web/app/desktop/views/components/settings.vue @@ -94,6 +94,9 @@ この設定はアカウントに保存されません。 + + この設定はアカウントに保存されません。実験的機能を有効にするとMisskeyの動作が不安定になる可能性があります。 +
@@ -126,17 +129,22 @@ export default Vue.extend({ data() { return { page: 'profile', + meta: null, license, version, latestVersion: undefined, checkingForUpdate: false, showPostFormOnTopOfTl: false, - debug: localStorage.getItem('debug') == 'true' + debug: localStorage.getItem('debug') == 'true', + enableExperimental: localStorage.getItem('enableExperimental') == 'true' }; }, watch: { debug() { localStorage.setItem('debug', this.debug ? 'true' : 'false'); + }, + enableExperimental() { + localStorage.setItem('enableExperimental', this.enableExperimental ? 'true' : 'false'); } }, computed: { @@ -145,6 +153,7 @@ export default Vue.extend({ } }, created() { + this.meta = (this as any).os.getMeta(); this.showPostFormOnTopOfTl = (this as any).os.i.client_settings.showPostFormOnTopOfTl; }, methods: { -- cgit v1.2.3-freya