From 1561391293a0573c64b024efd6edc3e1380cb0a8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 13 Aug 2021 17:59:54 +0900 Subject: feat(client): Misskey更新時にダイアログを表示するように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/init.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/client/init.ts') diff --git a/src/client/init.ts b/src/client/init.ts index 95aa18862c..2feeaf0ce1 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -7,6 +7,7 @@ import '@client/style.scss'; import * as Sentry from '@sentry/browser'; import { Integrations } from '@sentry/tracing'; import { computed, createApp, watch, markRaw } from 'vue'; +import compareVersions from 'compare-versions'; import widgets from '@client/widgets'; import directives from '@client/directives'; @@ -206,8 +207,9 @@ if (lastVersion !== version) { // テーマリビルドするため localStorage.removeItem('theme'); - // TODO: バージョンが新しくなった時だけダイアログ出す - //popup(); + if (lastVersion != null && compareVersions(version, lastVersion) === 1) { + popup(import('@client/components/updated.vue'), {}, {}, 'closed'); + } } // NOTE: この処理は必ず↑のクライアント更新時処理より後に来ること(テーマ再構築のため) -- cgit v1.2.3-freya From 6c1f03eefd005dd403de5592aed0f8ea89633b96 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 15 Aug 2021 20:34:06 +0900 Subject: enhance(client): Improve stability of version comparison --- src/client/init.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/client/init.ts') diff --git a/src/client/init.ts b/src/client/init.ts index 2feeaf0ce1..1580ef3e08 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -207,8 +207,11 @@ if (lastVersion !== version) { // テーマリビルドするため localStorage.removeItem('theme'); - if (lastVersion != null && compareVersions(version, lastVersion) === 1) { - popup(import('@client/components/updated.vue'), {}, {}, 'closed'); + try { // 変なバージョン文字列来るとcompareVersionsでエラーになるため + if (lastVersion != null && compareVersions(version, lastVersion) === 1) { + popup(import('@client/components/updated.vue'), {}, {}, 'closed'); + } + } catch (e) { } } -- cgit v1.2.3-freya