diff options
| author | Julia <julia@insertdomain.name> | 2025-06-19 21:35:18 +0000 |
|---|---|---|
| committer | Julia <julia@insertdomain.name> | 2025-06-19 21:35:18 +0000 |
| commit | a77c32b17da63d3932b219f74152cce023a30f4a (patch) | |
| tree | d2a05796e942c8f250bbd01369eab0cbe5a14531 /packages/frontend/src/pref-migrate.ts | |
| parent | merge: release 2025.4.2 (!1051) (diff) | |
| parent | Merge branch 'develop' into release/2025.4.3 (diff) | |
| download | sharkey-a77c32b17da63d3932b219f74152cce023a30f4a.tar.gz sharkey-a77c32b17da63d3932b219f74152cce023a30f4a.tar.bz2 sharkey-a77c32b17da63d3932b219f74152cce023a30f4a.zip | |
merge: prepare release 2025.4.3 (!1125)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1125
Approved-by: Marie <github@yuugi.dev>
Approved-by: Julia <julia@insertdomain.name>
Diffstat (limited to 'packages/frontend/src/pref-migrate.ts')
| -rw-r--r-- | packages/frontend/src/pref-migrate.ts | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/packages/frontend/src/pref-migrate.ts b/packages/frontend/src/pref-migrate.ts index a7bb82a5f0..ccd4472ca2 100644 --- a/packages/frontend/src/pref-migrate.ts +++ b/packages/frontend/src/pref-migrate.ts @@ -13,15 +13,18 @@ import { deckStore } from '@/ui/deck/deck-store.js'; import { unisonReload } from '@/utility/unison-reload.js'; import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; +import { miLocalStorage } from '@/local-storage'; // TODO: そのうち消す export function migrateOldSettings() { os.waiting(i18n.ts.settingsMigrating); store.loaded.then(async () => { - misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []).then((themes: Theme[]) => { - if (themes.length > 0) { - prefer.commit('themes', themes); + prefer.suppressReload(); + + await misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []).then(themes => { + if (Array.isArray(themes) && themes.length > 0) { + prefer.commit('themes', themes as Theme[]); } }); @@ -33,7 +36,7 @@ export function migrateOldSettings() { }))); prefer.commit('deck.profile', deckStore.s.profile); - misskeyApi('i/registry/keys', { + await misskeyApi('i/registry/keys', { scope: ['client', 'deck', 'profiles'], }).then(async keys => { const profiles: DeckProfile[] = []; @@ -41,16 +44,18 @@ export function migrateOldSettings() { const deck = await misskeyApi('i/registry/get', { scope: ['client', 'deck', 'profiles'], key: key, - }); - profiles.push({ - id: uuid(), - name: key, - columns: deck.columns, - layout: deck.layout, - }); + }).catch(() => null); + if (deck) { + profiles.push({ + id: uuid(), + name: key, + columns: (deck as DeckProfile).columns, + layout: (deck as DeckProfile).layout, + }); + } } prefer.commit('deck.profiles', profiles); - }); + }).catch(() => null); prefer.commit('lightTheme', ColdDeviceStorage.get('lightTheme')); prefer.commit('darkTheme', ColdDeviceStorage.get('darkTheme')); @@ -164,8 +169,17 @@ export function migrateOldSettings() { prefer.commit('warnMissingAltText', store.s.warnMissingAltText); //#endregion - window.setTimeout(() => { - unisonReload(); - }, 10000); + //#region Hybrid migrations + prefer.commit('fontSize', miLocalStorage.getItem('fontSize') ?? '0'); + prefer.commit('useSystemFont', miLocalStorage.getItem('useSystemFont') != null); + prefer.commit('cornerRadius', miLocalStorage.getItem('cornerRadius') ?? 'sharkey'); + prefer.commit('lang', miLocalStorage.getItem('lang') ?? 'en-US'); + prefer.commit('customCss', miLocalStorage.getItem('customCss') ?? ''); + prefer.commit('neverShowDonationInfo', miLocalStorage.getItem('neverShowDonationInfo') != null); + prefer.commit('neverShowLocalOnlyInfo', miLocalStorage.getItem('neverShowLocalOnlyInfo') != null); + //#endregion + + prefer.allowReload(); + unisonReload(); }); } |