diff --git a/CHANGELOG.md b/CHANGELOG.md index b3655536b5..ddf4c4ecc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Feat: マウスでもタイムラインを引っ張って更新できるように - アクセシビリティ設定からオフにすることもできます - Enhance: タイムラインのパフォーマンスを向上 +- Enhance: バックアップされた設定のプロファイルを削除できるように - Fix: 一部のブラウザでアコーディオンメニューのアニメーションが動作しない問題を修正 - Fix: ダイアログのお知らせが画面からはみ出ることがある問題を修正 - Fix: ユーザーポップアップでエラーが生じてもインジケーターが表示され続けてしまう問題を修正 diff --git a/locales/index.d.ts b/locales/index.d.ts index e564b47270..281568a5fd 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5745,6 +5745,10 @@ export interface Locale extends ILocale { * 例: 「メインPC」、「スマホ」など */ "profileNameDescription2": string; + /** + * プロファイルの管理 + */ + "manageProfiles": string; }; "_preferencesBackup": { /** diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 7d2edf7194..f0512925f3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1439,6 +1439,7 @@ _preferencesProfile: profileName: "プロファイル名" profileNameDescription: "このデバイスを識別する名前を設定してください。" profileNameDescription2: "例: 「メインPC」、「スマホ」など" + manageProfiles: "プロファイルの管理" _preferencesBackup: autoBackup: "自動バックアップ" diff --git a/packages/frontend/src/pages/settings/profiles.vue b/packages/frontend/src/pages/settings/profiles.vue new file mode 100644 index 0000000000..4804c11f7a --- /dev/null +++ b/packages/frontend/src/pages/settings/profiles.vue @@ -0,0 +1,47 @@ + + + + + + + {{ backup.name }} + {{ i18n.ts.delete }} + + + + + + + + diff --git a/packages/frontend/src/preferences/utility.ts b/packages/frontend/src/preferences/utility.ts index adba908c3c..af5b178df6 100644 --- a/packages/frontend/src/preferences/utility.ts +++ b/packages/frontend/src/preferences/utility.ts @@ -74,12 +74,17 @@ export function getPreferencesProfileMenu(): MenuItem[] { action: () => { importProfile(); }, + }, { + type: 'divider', + }, { + type: 'link', + text: i18n.ts._preferencesProfile.manageProfiles + '...', + icon: 'ti ti-settings-cog', + to: '/settings/profiles', }]; if (prefer.s.devMode) { menu.push({ - type: 'divider', - }, { text: 'Copy profile as text', icon: 'ti ti-clipboard', action: () => { @@ -145,17 +150,30 @@ export async function cloudBackup() { }); } -export async function restoreFromCloudBackup() { - if ($i == null) return; - - // TODO: 更新日時でソートして取得したい +export async function listCloudBackups() { const keys = await misskeyApi('i/registry/keys', { scope: ['client', 'preferences', 'backups'], }); - if (_DEV_) console.log(keys); + return keys.map(k => ({ + name: k, + })); +} - if (keys.length === 0) { +export async function deleteCloudBackup(key: string) { + await os.apiWithDialog('i/registry/remove', { + scope: ['client', 'preferences', 'backups'], + key, + }); +} + +export async function restoreFromCloudBackup() { + if ($i == null) return; + + // TODO: 更新日時でソートしたい + const backups = await listCloudBackups(); + + if (backups.length === 0) { os.alert({ type: 'warning', title: i18n.ts._preferencesBackup.noBackupsFoundTitle, @@ -166,9 +184,9 @@ export async function restoreFromCloudBackup() { const select = await os.select({ title: i18n.ts._preferencesBackup.selectBackupToRestore, - items: keys.map(k => ({ - text: k, - value: k, + items: backups.map(backup => ({ + text: backup.name, + value: backup.name, })), }); if (select.canceled) return; diff --git a/packages/frontend/src/router.definition.ts b/packages/frontend/src/router.definition.ts index d8bdbb7d02..462b8e713f 100644 --- a/packages/frontend/src/router.definition.ts +++ b/packages/frontend/src/router.definition.ts @@ -180,6 +180,10 @@ export const ROUTE_DEF = [{ path: '/custom-css', name: 'preferences', component: page(() => import('@/pages/settings/custom-css.vue')), + }, { + path: '/profiles', + name: 'profiles', + component: page(() => import('@/pages/settings/profiles.vue')), }, { path: '/accounts', name: 'profile',