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