This commit is contained in:
かっこかり 2025-09-25 08:08:37 +09:00 committed by GitHub
commit a731783009
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 10 deletions

View File

@ -15,6 +15,7 @@
- Enhance: 絵文字ピッカーのサイズをより大きくできるように
- Enhance: 時刻計算のための基準値を一か所で管理するようにし、パフォーマンスを向上
- Fix: iOSで、デバイスがダークモードだと初回読み込み時にエラーになる問題を修正
- Fix: 設定データの移行が完了しているクライアントでは、設定データ移行用のプログラムの読み込みをスキップするように
### Server
- Enhance: ユーザーIPを確実に取得できるために設定ファイルにFastifyOptions.trustProxyを追加しました

View File

@ -27,7 +27,6 @@ import { makeHotkey } from '@/utility/hotkey.js';
import { addCustomEmoji, removeCustomEmojis, updateCustomEmojis } from '@/custom-emojis.js';
import { prefer } from '@/preferences.js';
import { updateCurrentAccountPartial } from '@/accounts.js';
import { migrateOldSettings } from '@/pref-migrate.js';
import { unisonReload } from '@/utility/unison-reload.js';
export async function mainBoot() {
@ -74,6 +73,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();
}
}

View File

@ -14,15 +14,23 @@ import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
// TODO: そのうち消す
export function migrateOldSettings() {
export async function migrateOldSettings() {
os.waiting({ text: i18n.ts.settingsMigrating });
store.loaded.then(async () => {
misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []).then((themes: any) => {
const minWait = new Promise<void>(resolve => {
window.setTimeout(() => {
resolve();
}, 5000);
});
const migratePromise = 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 => {
@ -35,7 +43,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[] = [];
@ -52,7 +60,7 @@ export function migrateOldSettings() {
});
}
prefer.commit('deck.profiles', profiles);
});
}));
prefer.commit('lightTheme', ColdDeviceStorage.get('lightTheme'));
prefer.commit('darkTheme', ColdDeviceStorage.get('darkTheme'));
@ -146,8 +154,11 @@ export function migrateOldSettings() {
prefer.commit('defaultNoteVisibility', store.s.defaultNoteVisibility);
prefer.commit('defaultNoteLocalOnly', store.s.defaultNoteLocalOnly);
window.setTimeout(() => {
unisonReload();
}, 10000);
await Promise.all(migrationPromises);
});
// 最低5秒 or 設定移行が完了するまで待つ
await Promise.all([migratePromise, minWait]);
unisonReload();
}