2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-07-31 14:55:20 +02:00
|
|
|
<template>
|
2023-01-06 05:40:17 +01:00
|
|
|
<div class="_gaps_m">
|
2022-07-31 14:55:20 +02:00
|
|
|
<div :class="$style.buttons">
|
|
|
|
<MkButton inline primary @click="saveNew">{{ ts._preferencesBackups.saveNew }}</MkButton>
|
|
|
|
<MkButton inline @click="loadFile">{{ ts._preferencesBackups.loadFile }}</MkButton>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<FormSection>
|
|
|
|
<template #label>{{ ts._preferencesBackups.list }}</template>
|
|
|
|
<template v-if="profiles && Object.keys(profiles).length > 0">
|
2023-01-06 05:40:17 +01:00
|
|
|
<div class="_gaps_s">
|
2023-01-05 13:04:56 +01:00
|
|
|
<div
|
|
|
|
v-for="(profile, id) in profiles"
|
|
|
|
:key="id"
|
|
|
|
class="_panel"
|
|
|
|
:class="$style.profile"
|
|
|
|
@click="$event => menu($event, id)"
|
|
|
|
@contextmenu.prevent.stop="$event => menu($event, id)"
|
|
|
|
>
|
|
|
|
<div :class="$style.profileName">{{ profile.name }}</div>
|
|
|
|
<div :class="$style.profileTime">{{ t('_preferencesBackups.createdAt', { date: (new Date(profile.createdAt)).toLocaleDateString(), time: (new Date(profile.createdAt)).toLocaleTimeString() }) }}</div>
|
|
|
|
<div v-if="profile.updatedAt" :class="$style.profileTime">{{ t('_preferencesBackups.updatedAt', { date: (new Date(profile.updatedAt)).toLocaleDateString(), time: (new Date(profile.updatedAt)).toLocaleTimeString() }) }}</div>
|
|
|
|
</div>
|
2022-07-31 14:55:20 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<div v-else-if="profiles">
|
|
|
|
<MkInfo>{{ ts._preferencesBackups.noBackups }}</MkInfo>
|
|
|
|
</div>
|
|
|
|
<MkLoading v-else/>
|
|
|
|
</FormSection>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-07-26 14:40:45 +02:00
|
|
|
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
2022-07-31 14:55:20 +02:00
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
import FormSection from '@/components/form/section.vue';
|
2022-09-06 11:21:49 +02:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { ColdDeviceStorage, defaultStore } from '@/store.js';
|
|
|
|
import { unisonReload } from '@/scripts/unison-reload.js';
|
|
|
|
import { useStream } from '@/stream.js';
|
|
|
|
import { $i } from '@/account.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { version, host } from '@/config.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|
|
|
import { miLocalStorage } from '@/local-storage.js';
|
2022-07-31 14:55:20 +02:00
|
|
|
const { t, ts } = i18n;
|
|
|
|
|
|
|
|
const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
|
|
|
|
'menu',
|
|
|
|
'visibility',
|
|
|
|
'localOnly',
|
|
|
|
'statusbars',
|
|
|
|
'widgets',
|
|
|
|
'tl',
|
|
|
|
'overridedDeviceKind',
|
|
|
|
'serverDisconnectedBehavior',
|
2023-02-28 12:53:32 +01:00
|
|
|
'collapseRenotes',
|
|
|
|
'showNoteActionsOnlyHover',
|
2022-07-31 14:55:20 +02:00
|
|
|
'nsfw',
|
|
|
|
'animation',
|
|
|
|
'animatedMfm',
|
2023-02-11 03:31:18 +01:00
|
|
|
'advancedMfm',
|
2022-07-31 14:55:20 +02:00
|
|
|
'loadRawImages',
|
|
|
|
'imageNewTab',
|
|
|
|
'disableShowingAnimatedImages',
|
2022-12-26 08:04:56 +01:00
|
|
|
'emojiStyle',
|
2022-07-31 14:55:20 +02:00
|
|
|
'disableDrawer',
|
|
|
|
'useBlurEffectForModal',
|
|
|
|
'useBlurEffect',
|
|
|
|
'showFixedPostForm',
|
2023-03-04 02:34:54 +01:00
|
|
|
'showFixedPostFormInChannel',
|
2022-07-31 14:55:20 +02:00
|
|
|
'enableInfiniteScroll',
|
|
|
|
'useReactionPickerForContextMenu',
|
|
|
|
'showGapBetweenNotesInTimeline',
|
|
|
|
'instanceTicker',
|
|
|
|
'reactionPickerSize',
|
|
|
|
'reactionPickerWidth',
|
|
|
|
'reactionPickerHeight',
|
|
|
|
'reactionPickerUseDrawerForMobile',
|
|
|
|
'defaultSideView',
|
|
|
|
'menuDisplay',
|
|
|
|
'reportError',
|
|
|
|
'squareAvatars',
|
|
|
|
'numberOfPageCache',
|
|
|
|
'aiChanMode',
|
2023-04-15 14:35:19 +02:00
|
|
|
'mediaListWithOneImageAppearance',
|
2022-07-31 14:55:20 +02:00
|
|
|
];
|
|
|
|
const coldDeviceStorageSaveKeys: (keyof typeof ColdDeviceStorage.default)[] = [
|
|
|
|
'lightTheme',
|
|
|
|
'darkTheme',
|
|
|
|
'syncDeviceDarkMode',
|
|
|
|
'plugins',
|
|
|
|
];
|
|
|
|
|
|
|
|
const scope = ['clientPreferencesProfiles'];
|
|
|
|
|
2022-12-31 07:18:23 +01:00
|
|
|
const profileProps = ['name', 'createdAt', 'updatedAt', 'misskeyVersion', 'settings', 'host'];
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
type Profile = {
|
|
|
|
name: string;
|
|
|
|
createdAt: string;
|
|
|
|
updatedAt: string | null;
|
|
|
|
misskeyVersion: string;
|
|
|
|
host: string;
|
|
|
|
settings: {
|
|
|
|
hot: Record<keyof typeof defaultStoreSaveKeys, unknown>;
|
|
|
|
cold: Record<keyof typeof coldDeviceStorageSaveKeys, unknown>;
|
|
|
|
fontSize: string | null;
|
|
|
|
useSystemFont: 't' | null;
|
|
|
|
wallpaper: string | null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-05-15 12:08:46 +02:00
|
|
|
const connection = $i && useStream().useChannel('main');
|
2022-07-31 14:55:20 +02:00
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
const profiles = ref<Record<string, Profile> | null>(null);
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
os.api('i/registry/get-all', { scope })
|
|
|
|
.then(res => {
|
2023-07-26 14:40:45 +02:00
|
|
|
profiles.value = res || {};
|
2022-07-31 14:55:20 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
function isObject(value: unknown): value is Record<string, unknown> {
|
|
|
|
return value != null && typeof value === 'object' && !Array.isArray(value);
|
|
|
|
}
|
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
function validate(profile: any): void {
|
2022-08-01 10:44:53 +02:00
|
|
|
if (!isObject(profile)) throw new Error('not an object');
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
// Check if unnecessary properties exist
|
2022-08-01 10:44:53 +02:00
|
|
|
if (Object.keys(profile).some(key => !profileProps.includes(key))) throw new Error('Unnecessary properties exist');
|
2022-07-31 14:55:20 +02:00
|
|
|
|
2022-08-01 10:44:53 +02:00
|
|
|
if (!profile.name) throw new Error('Missing required prop: name');
|
|
|
|
if (!profile.misskeyVersion) throw new Error('Missing required prop: misskeyVersion');
|
2023-07-08 00:08:16 +02:00
|
|
|
|
2022-07-31 14:55:20 +02:00
|
|
|
// Check if createdAt and updatedAt is Date
|
|
|
|
// https://zenn.dev/lollipop_onl/articles/eoz-judge-js-invalid-date
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profile.createdAt || Number.isNaN(new Date(profile.createdAt as any).getTime())) throw new Error('createdAt is falsy or not Date');
|
2022-07-31 14:55:20 +02:00
|
|
|
if (profile.updatedAt) {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (Number.isNaN(new Date(profile.updatedAt as any).getTime())) {
|
2022-08-01 10:44:53 +02:00
|
|
|
throw new Error('updatedAt is not Date');
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
} else if (profile.updatedAt !== null) {
|
2022-08-01 10:44:53 +02:00
|
|
|
throw new Error('updatedAt is not null');
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
|
2022-08-01 10:44:53 +02:00
|
|
|
if (!profile.settings) throw new Error('Missing required prop: settings');
|
|
|
|
if (!isObject(profile.settings)) throw new Error('Invalid prop: settings');
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function getSettings(): Profile['settings'] {
|
|
|
|
const hot = {} as Record<keyof typeof defaultStoreSaveKeys, unknown>;
|
|
|
|
for (const key of defaultStoreSaveKeys) {
|
|
|
|
hot[key] = defaultStore.state[key];
|
|
|
|
}
|
|
|
|
|
|
|
|
const cold = {} as Record<keyof typeof coldDeviceStorageSaveKeys, unknown>;
|
|
|
|
for (const key of coldDeviceStorageSaveKeys) {
|
|
|
|
cold[key] = ColdDeviceStorage.get(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
hot,
|
|
|
|
cold,
|
2023-01-07 02:13:02 +01:00
|
|
|
fontSize: miLocalStorage.getItem('fontSize'),
|
|
|
|
useSystemFont: miLocalStorage.getItem('useSystemFont') as 't' | null,
|
|
|
|
wallpaper: miLocalStorage.getItem('wallpaper'),
|
2022-07-31 14:55:20 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
async function saveNew(): Promise<void> {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
const { canceled, result: name } = await os.inputText({
|
|
|
|
title: ts._preferencesBackups.inputName,
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
if (Object.values(profiles.value).some(x => x.name === name)) {
|
2022-07-31 14:55:20 +02:00
|
|
|
return os.alert({
|
|
|
|
title: ts._preferencesBackups.cannotSave,
|
|
|
|
text: t('_preferencesBackups.nameAlreadyExists', { name }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const id = uuid();
|
|
|
|
const profile: Profile = {
|
|
|
|
name,
|
|
|
|
createdAt: (new Date()).toISOString(),
|
|
|
|
updatedAt: null,
|
|
|
|
misskeyVersion: version,
|
|
|
|
host,
|
|
|
|
settings: getSettings(),
|
|
|
|
};
|
|
|
|
await os.apiWithDialog('i/registry/set', { scope, key: id, value: profile });
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadFile(): void {
|
|
|
|
const input = document.createElement('input');
|
|
|
|
input.type = 'file';
|
|
|
|
input.multiple = false;
|
|
|
|
input.onchange = async () => {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
if (!input.files || input.files.length === 0) return;
|
|
|
|
|
|
|
|
const file = input.files[0];
|
|
|
|
|
|
|
|
if (file.type !== 'application/json') {
|
|
|
|
return os.alert({
|
|
|
|
type: 'error',
|
|
|
|
title: ts._preferencesBackups.cannotLoad,
|
|
|
|
text: ts._preferencesBackups.invalidFile,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
let profile: Profile;
|
|
|
|
try {
|
|
|
|
profile = JSON.parse(await file.text()) as unknown as Profile;
|
|
|
|
validate(profile);
|
|
|
|
} catch (err) {
|
|
|
|
return os.alert({
|
|
|
|
type: 'error',
|
|
|
|
title: ts._preferencesBackups.cannotLoad,
|
2023-07-26 14:40:45 +02:00
|
|
|
text: (err as any)?.message ?? '',
|
2022-07-31 14:55:20 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const id = uuid();
|
|
|
|
await os.apiWithDialog('i/registry/set', { scope, key: id, value: profile });
|
|
|
|
|
|
|
|
// 一応廃棄
|
|
|
|
(window as any).__misskey_input_ref__ = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
// https://qiita.com/fukasawah/items/b9dc732d95d99551013d
|
|
|
|
// iOS Safari で正常に動かす為のおまじない
|
|
|
|
(window as any).__misskey_input_ref__ = input;
|
|
|
|
|
|
|
|
input.click();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function applyProfile(id: string): Promise<void> {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
const profile = profiles.value[id];
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
const { canceled: cancel1 } = await os.confirm({
|
|
|
|
type: 'warning',
|
|
|
|
title: ts._preferencesBackups.apply,
|
|
|
|
text: t('_preferencesBackups.applyConfirm', { name: profile.name }),
|
|
|
|
});
|
|
|
|
if (cancel1) return;
|
|
|
|
|
|
|
|
// TODO: バージョン or ホストが違ったらさらに警告を表示
|
|
|
|
|
|
|
|
const settings = profile.settings;
|
|
|
|
|
|
|
|
// defaultStore
|
|
|
|
for (const key of defaultStoreSaveKeys) {
|
|
|
|
if (settings.hot[key] !== undefined) {
|
|
|
|
defaultStore.set(key, settings.hot[key]);
|
|
|
|
}
|
|
|
|
}
|
2023-07-08 00:08:16 +02:00
|
|
|
|
2022-07-31 14:55:20 +02:00
|
|
|
// coldDeviceStorage
|
|
|
|
for (const key of coldDeviceStorageSaveKeys) {
|
|
|
|
if (settings.cold[key] !== undefined) {
|
|
|
|
ColdDeviceStorage.set(key, settings.cold[key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// fontSize
|
|
|
|
if (settings.fontSize) {
|
2023-01-07 02:13:02 +01:00
|
|
|
miLocalStorage.setItem('fontSize', settings.fontSize);
|
2022-07-31 14:55:20 +02:00
|
|
|
} else {
|
2023-01-07 02:13:02 +01:00
|
|
|
miLocalStorage.removeItem('fontSize');
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// useSystemFont
|
|
|
|
if (settings.useSystemFont) {
|
2023-01-07 02:13:02 +01:00
|
|
|
miLocalStorage.setItem('useSystemFont', settings.useSystemFont);
|
2022-07-31 14:55:20 +02:00
|
|
|
} else {
|
2023-01-07 02:13:02 +01:00
|
|
|
miLocalStorage.removeItem('useSystemFont');
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// wallpaper
|
|
|
|
if (settings.wallpaper != null) {
|
2023-01-07 02:13:02 +01:00
|
|
|
miLocalStorage.setItem('wallpaper', settings.wallpaper);
|
2022-07-31 14:55:20 +02:00
|
|
|
} else {
|
2023-01-07 02:13:02 +01:00
|
|
|
miLocalStorage.removeItem('wallpaper');
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const { canceled: cancel2 } = await os.confirm({
|
|
|
|
type: 'info',
|
|
|
|
text: ts.reloadToApplySetting,
|
|
|
|
});
|
|
|
|
if (cancel2) return;
|
|
|
|
|
|
|
|
unisonReload();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function deleteProfile(id: string): Promise<void> {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
const { canceled } = await os.confirm({
|
|
|
|
type: 'info',
|
|
|
|
title: ts.delete,
|
2023-07-26 14:40:45 +02:00
|
|
|
text: t('deleteAreYouSure', { x: profiles.value[id].name }),
|
2022-07-31 14:55:20 +02:00
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
|
|
|
|
await os.apiWithDialog('i/registry/remove', { scope, key: id });
|
2023-07-26 14:40:45 +02:00
|
|
|
delete profiles.value[id];
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async function save(id: string): Promise<void> {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
const { name, createdAt } = profiles.value[id];
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
const { canceled } = await os.confirm({
|
|
|
|
type: 'info',
|
|
|
|
title: ts._preferencesBackups.save,
|
|
|
|
text: t('_preferencesBackups.saveConfirm', { name }),
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
|
|
|
|
const profile: Profile = {
|
|
|
|
name,
|
|
|
|
createdAt,
|
|
|
|
updatedAt: (new Date()).toISOString(),
|
|
|
|
misskeyVersion: version,
|
|
|
|
host,
|
|
|
|
settings: getSettings(),
|
|
|
|
};
|
|
|
|
await os.apiWithDialog('i/registry/set', { scope, key: id, value: profile });
|
|
|
|
}
|
|
|
|
|
|
|
|
async function rename(id: string): Promise<void> {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
const { canceled: cancel1, result: name } = await os.inputText({
|
|
|
|
title: ts._preferencesBackups.inputName,
|
|
|
|
});
|
2023-07-26 14:40:45 +02:00
|
|
|
if (cancel1 || profiles.value[id].name === name) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
if (Object.values(profiles.value).some(x => x.name === name)) {
|
2022-07-31 14:55:20 +02:00
|
|
|
return os.alert({
|
|
|
|
title: ts._preferencesBackups.cannotSave,
|
|
|
|
text: t('_preferencesBackups.nameAlreadyExists', { name }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
const registry = Object.assign({}, { ...profiles.value[id] });
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
const { canceled: cancel2 } = await os.confirm({
|
|
|
|
type: 'info',
|
2023-07-26 14:40:45 +02:00
|
|
|
title: ts.rename,
|
2022-07-31 14:55:20 +02:00
|
|
|
text: t('_preferencesBackups.renameConfirm', { old: registry.name, new: name }),
|
|
|
|
});
|
|
|
|
if (cancel2) return;
|
|
|
|
|
|
|
|
registry.name = name;
|
|
|
|
await os.apiWithDialog('i/registry/set', { scope, key: id, value: registry });
|
|
|
|
}
|
|
|
|
|
|
|
|
function menu(ev: MouseEvent, profileId: string) {
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
|
|
|
return os.popupMenu([{
|
|
|
|
text: ts._preferencesBackups.apply,
|
2023-09-30 21:53:52 +02:00
|
|
|
icon: 'ph-check ph-bold ph-lg',
|
2022-07-31 14:55:20 +02:00
|
|
|
action: () => applyProfile(profileId),
|
|
|
|
}, {
|
|
|
|
type: 'a',
|
|
|
|
text: ts.download,
|
2023-09-30 21:53:52 +02:00
|
|
|
icon: 'ph-download ph-bold ph-lg',
|
2023-07-26 14:40:45 +02:00
|
|
|
href: URL.createObjectURL(new Blob([JSON.stringify(profiles.value[profileId], null, 2)], { type: 'application/json' })),
|
|
|
|
download: `${profiles.value[profileId].name}.json`,
|
2022-07-31 14:55:20 +02:00
|
|
|
}, null, {
|
|
|
|
text: ts.rename,
|
2023-09-30 21:53:52 +02:00
|
|
|
icon: 'ph-textbox ph-bold ph-lg',
|
2022-07-31 14:55:20 +02:00
|
|
|
action: () => rename(profileId),
|
|
|
|
}, {
|
|
|
|
text: ts._preferencesBackups.save,
|
2023-09-30 21:53:52 +02:00
|
|
|
icon: 'ph-floppy-disk ph-bold pg-lg',
|
2022-07-31 14:55:20 +02:00
|
|
|
action: () => save(profileId),
|
|
|
|
}, null, {
|
2023-04-10 03:23:56 +02:00
|
|
|
text: ts.delete,
|
2023-09-30 21:53:52 +02:00
|
|
|
icon: 'ph-trash ph-bold ph-lg',
|
2022-07-31 14:55:20 +02:00
|
|
|
action: () => deleteProfile(profileId),
|
|
|
|
danger: true,
|
2023-07-26 14:40:45 +02:00
|
|
|
}], (ev.currentTarget ?? ev.target ?? undefined) as unknown as HTMLElement | undefined);
|
2022-07-31 14:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
// streamingのuser storage updateイベントを監視して更新
|
|
|
|
connection?.on('registryUpdated', ({ scope: recievedScope, key, value }) => {
|
|
|
|
if (!recievedScope || recievedScope.length !== scope.length || recievedScope[0] !== scope[0]) return;
|
2023-07-26 14:40:45 +02:00
|
|
|
if (!profiles.value) return;
|
2022-07-31 14:55:20 +02:00
|
|
|
|
2023-07-26 14:40:45 +02:00
|
|
|
profiles.value[key] = value;
|
2022-07-31 14:55:20 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
connection?.off('registryUpdated');
|
|
|
|
});
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: ts.preferencesBackups,
|
2023-09-30 21:53:52 +02:00
|
|
|
icon: 'ph-floppy-disk ph-bold pg-lg',
|
2022-07-31 14:55:20 +02:00
|
|
|
})));
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.buttons {
|
|
|
|
display: flex;
|
|
|
|
gap: var(--margin);
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.profile {
|
|
|
|
padding: 20px;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&Name {
|
|
|
|
font-weight: 700;
|
|
|
|
}
|
|
|
|
|
|
|
|
&Time {
|
|
|
|
font-size: .85em;
|
|
|
|
opacity: .7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|