fix(frontend): 設定マイグレーション周りの修正
This commit is contained in:
parent
81bf139e3e
commit
1ae1299f44
|
@ -29,7 +29,6 @@ import { prefer } from '@/preferences.js';
|
|||
import { launchPlugins } from '@/plugin.js';
|
||||
import { updateCurrentAccountPartial } from '@/accounts.js';
|
||||
import { signout } from '@/signout.js';
|
||||
import { migrateOldSettings } from '@/pref-migrate.js';
|
||||
|
||||
export async function mainBoot() {
|
||||
const { isClientUpdated, lastVersion } = await common(async () => {
|
||||
|
@ -75,6 +74,8 @@ export async function mainBoot() {
|
|||
if (lastVersion && (compareVersions('2025.3.2-alpha.0', lastVersion) === 1)) {
|
||||
console.log('Preferences migration');
|
||||
|
||||
const { migrateOldSettings } = await import('@/pref-migrate.js');
|
||||
|
||||
migrateOldSettings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,15 +14,17 @@ import * as os from '@/os.js';
|
|||
import { i18n } from '@/i18n.js';
|
||||
|
||||
// TODO: そのうち消す
|
||||
export function migrateOldSettings() {
|
||||
export async function migrateOldSettings() {
|
||||
os.waiting(i18n.ts.settingsMigrating);
|
||||
|
||||
store.loaded.then(async () => {
|
||||
misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []).then((themes: any) => {
|
||||
await store.loaded.then(async () => {
|
||||
const migrationPromises: Promise<any>[] = [];
|
||||
|
||||
migrationPromises.push(misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []).then((themes: any) => {
|
||||
if (themes.length > 0) {
|
||||
prefer.commit('themes', themes);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const plugins = ColdDeviceStorage.get('plugins');
|
||||
prefer.commit('plugins', plugins.map(p => ({
|
||||
|
@ -32,7 +34,7 @@ export function migrateOldSettings() {
|
|||
})));
|
||||
|
||||
prefer.commit('deck.profile', deckStore.s.profile);
|
||||
misskeyApi('i/registry/keys', {
|
||||
migrationPromises.push(misskeyApi('i/registry/keys', {
|
||||
scope: ['client', 'deck', 'profiles'],
|
||||
}).then(async keys => {
|
||||
const profiles: DeckProfile[] = [];
|
||||
|
@ -49,7 +51,7 @@ export function migrateOldSettings() {
|
|||
});
|
||||
}
|
||||
prefer.commit('deck.profiles', profiles);
|
||||
});
|
||||
}));
|
||||
|
||||
prefer.commit('lightTheme', ColdDeviceStorage.get('lightTheme'));
|
||||
prefer.commit('darkTheme', ColdDeviceStorage.get('darkTheme'));
|
||||
|
@ -139,8 +141,8 @@ export function migrateOldSettings() {
|
|||
prefer.commit('defaultNoteVisibility', store.s.defaultNoteVisibility);
|
||||
prefer.commit('defaultNoteLocalOnly', store.s.defaultNoteLocalOnly);
|
||||
|
||||
window.setTimeout(() => {
|
||||
unisonReload();
|
||||
}, 10000);
|
||||
await Promise.all(migrationPromises);
|
||||
});
|
||||
|
||||
unisonReload();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue