From 9bb6dc52b855dcebd0c0493240d6282ba21810c2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 20 Mar 2021 15:42:02 +0900 Subject: clean up など MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/init.ts | 34 ---------------------------------- src/client/store.ts | 1 - src/client/theme-store.ts | 27 --------------------------- 3 files changed, 62 deletions(-) (limited to 'src/client') diff --git a/src/client/init.ts b/src/client/init.ts index 1c44e7f23e..2a2b6a2f86 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -4,40 +4,6 @@ import '@/style.scss'; -// TODO: そのうち消す -if (localStorage.getItem('vuex') != null) { - const vuex = JSON.parse(localStorage.getItem('vuex')); - - localStorage.setItem('account', JSON.stringify({ - ...vuex.i, - token: localStorage.getItem('i') - })); - localStorage.setItem('accounts', JSON.stringify(vuex.device.accounts)); - localStorage.setItem('miux:themes', JSON.stringify(vuex.device.themes)); - - if (vuex.device.userData) { - for (const [k, v] of Object.entries(vuex.device.userData)) { - localStorage.setItem('pizzax::base::' + k, JSON.stringify({ - widgets: v.widgets - })); - - if (v.deck) { - localStorage.setItem('pizzax::deck::' + k, JSON.stringify({ - columns: v.deck.columns, - layout: v.deck.layout, - })); - } - } - } - - localStorage.setItem('vuex-old', JSON.stringify(vuex)); - localStorage.removeItem('vuex'); - localStorage.removeItem('i'); - localStorage.removeItem('locale'); - - location.reload(); -} - import * as Sentry from '@sentry/browser'; import { Integrations } from '@sentry/tracing'; import { createApp, watch } from 'vue'; diff --git a/src/client/store.ts b/src/client/store.ts index 14924dadd0..e6fdd12f1d 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -212,7 +212,6 @@ type Plugin = { */ export class ColdDeviceStorage { public static default = { - themes: [] as Theme[], // TODO: そのうち消す // TODO: テーマをアカウントに保存するようになったのにもかかわらず、以下のどのテーマを使うかという情報だけがブラウザ保存になっていて、アカウント切り替えたりログアウトしたときに不具合が発生するのでなんとかする // テーマIDを保存するのではなく、テーマ自体を保存するようにすれば解決するかも darkTheme: '8050783a-7f63-445a-b270-36d0f6ba1677', diff --git a/src/client/theme-store.ts b/src/client/theme-store.ts index 5e440efbf9..8e21af70fc 100644 --- a/src/client/theme-store.ts +++ b/src/client/theme-store.ts @@ -33,30 +33,3 @@ export async function removeTheme(theme: Theme): Promise { await api('i/registry/set', { scope: ['client'], key: 'themes', value: themes }); localStorage.setItem(lsCacheKey, JSON.stringify(themes)); } - -// TODO: そのうち消す -if (ColdDeviceStorage.get('themes').length > 0) { - const lsThemes = ColdDeviceStorage.get('themes'); - let registryThemes; - try { - registryThemes = await api('i/registry/get', { scope: ['client'], key: 'themes' }); - } catch (e) { - if (e.code === 'NO_SUCH_KEY') { - registryThemes = []; - } else { - throw e; - } - } - const themes = [] as Theme[]; - for (const theme of lsThemes) { - if (themes.some(x => x.id === theme.id)) continue; - themes.push(theme); - } - for (const theme of registryThemes) { - if (themes.some(x => x.id === theme.id)) continue; - themes.push(theme); - } - await api('i/registry/set', { scope: ['client'], key: 'themes', value: themes }); - localStorage.setItem(lsCacheKey, JSON.stringify(themes)); - ColdDeviceStorage.set('themes', []); -} -- cgit v1.2.3-freya