2020-10-17 20:12:00 +09:00
|
|
|
<template>
|
|
|
|
<div class="vvcocwet" :class="{ wide: !narrow }" ref="el">
|
2021-04-11 21:09:35 +09:00
|
|
|
<div class="nav" v-if="!narrow || page == null">
|
2021-10-24 20:16:55 +09:00
|
|
|
<MkSpacer :content-max="700">
|
|
|
|
<div class="baaadecd">
|
|
|
|
<div class="title">{{ $ts.settings }}</div>
|
|
|
|
<MkInfo v-if="emailNotConfigured" warn class="info">{{ $ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ $ts.configure }}</MkA></MkInfo>
|
|
|
|
<MkSuperMenu :def="menuDef" :grid="page == null"></MkSuperMenu>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2021-04-11 21:09:35 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="main">
|
2021-10-09 12:33:08 +09:00
|
|
|
<component :is="component" :key="page" v-bind="pageProps"/>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-01-11 20:38:34 +09:00
|
|
|
import { computed, defineAsyncComponent, defineComponent, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
2021-03-23 17:30:14 +09:00
|
|
|
import { i18n } from '@client/i18n';
|
2021-10-02 00:51:37 +09:00
|
|
|
import MkInfo from '@client/components/ui/info.vue';
|
2021-10-10 15:19:16 +09:00
|
|
|
import MkSuperMenu from '@client/components/ui/super-menu.vue';
|
2021-03-23 17:30:14 +09:00
|
|
|
import { scroll } from '@client/scripts/scroll';
|
|
|
|
import { signout } from '@client/account';
|
|
|
|
import { unisonReload } from '@client/scripts/unison-reload';
|
2021-04-10 12:54:12 +09:00
|
|
|
import * as symbols from '@client/symbols';
|
2021-05-04 17:09:57 +09:00
|
|
|
import { instance } from '@client/instance';
|
|
|
|
import { $i } from '@client/account';
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
export default defineComponent({
|
2020-11-25 21:31:34 +09:00
|
|
|
components: {
|
2021-10-02 00:51:37 +09:00
|
|
|
MkInfo,
|
2021-10-10 15:19:16 +09:00
|
|
|
MkSuperMenu,
|
2020-11-25 21:31:34 +09:00
|
|
|
},
|
|
|
|
|
2020-10-25 01:21:41 +09:00
|
|
|
props: {
|
2021-04-11 21:09:35 +09:00
|
|
|
initialPage: {
|
2020-10-25 01:21:41 +09:00
|
|
|
type: String,
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
setup(props, context) {
|
2021-04-11 23:49:13 +09:00
|
|
|
const indexInfo = {
|
2021-10-12 21:41:27 +09:00
|
|
|
title: i18n.locale.settings,
|
2021-09-17 22:39:15 +09:00
|
|
|
icon: 'fas fa-cog',
|
|
|
|
bg: 'var(--bg)',
|
2021-10-24 04:03:07 +09:00
|
|
|
hideHeader: true,
|
2021-04-11 23:49:13 +09:00
|
|
|
};
|
|
|
|
const INFO = ref(indexInfo);
|
2021-04-11 21:09:35 +09:00
|
|
|
const page = ref(props.initialPage);
|
2020-10-17 20:12:00 +09:00
|
|
|
const narrow = ref(false);
|
|
|
|
const view = ref(null);
|
|
|
|
const el = ref(null);
|
2021-10-10 15:19:16 +09:00
|
|
|
const menuDef = computed(() => [{
|
|
|
|
title: i18n.locale.basicSettings,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-user',
|
|
|
|
text: i18n.locale.profile,
|
|
|
|
to: '/settings/profile',
|
|
|
|
active: page.value === 'profile',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-lock-open',
|
|
|
|
text: i18n.locale.privacy,
|
|
|
|
to: '/settings/privacy',
|
|
|
|
active: page.value === 'privacy',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-laugh',
|
|
|
|
text: i18n.locale.reaction,
|
|
|
|
to: '/settings/reaction',
|
|
|
|
active: page.value === 'reaction',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-cloud',
|
|
|
|
text: i18n.locale.drive,
|
|
|
|
to: '/settings/drive',
|
|
|
|
active: page.value === 'drive',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-bell',
|
|
|
|
text: i18n.locale.notifications,
|
|
|
|
to: '/settings/notifications',
|
|
|
|
active: page.value === 'notifications',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-envelope',
|
|
|
|
text: i18n.locale.email,
|
|
|
|
to: '/settings/email',
|
|
|
|
active: page.value === 'email',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-share-alt',
|
|
|
|
text: i18n.locale.integration,
|
|
|
|
to: '/settings/integration',
|
|
|
|
active: page.value === 'integration',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-lock',
|
|
|
|
text: i18n.locale.security,
|
|
|
|
to: '/settings/security',
|
|
|
|
active: page.value === 'security',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.locale.clientSettings,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-cogs',
|
|
|
|
text: i18n.locale.general,
|
|
|
|
to: '/settings/general',
|
|
|
|
active: page.value === 'general',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-palette',
|
|
|
|
text: i18n.locale.theme,
|
|
|
|
to: '/settings/theme',
|
|
|
|
active: page.value === 'theme',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-list-ul',
|
|
|
|
text: i18n.locale.menu,
|
|
|
|
to: '/settings/menu',
|
|
|
|
active: page.value === 'menu',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-music',
|
|
|
|
text: i18n.locale.sounds,
|
|
|
|
to: '/settings/sounds',
|
|
|
|
active: page.value === 'sounds',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-plug',
|
|
|
|
text: i18n.locale.plugins,
|
|
|
|
to: '/settings/plugin',
|
|
|
|
active: page.value === 'plugin',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.locale.otherSettings,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-boxes',
|
|
|
|
text: i18n.locale.importAndExport,
|
|
|
|
to: '/settings/import-export',
|
|
|
|
active: page.value === 'import-export',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-ban',
|
|
|
|
text: i18n.locale.muteAndBlock,
|
|
|
|
to: '/settings/mute-block',
|
|
|
|
active: page.value === 'mute-block',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-comment-slash',
|
|
|
|
text: i18n.locale.wordMute,
|
|
|
|
to: '/settings/word-mute',
|
|
|
|
active: page.value === 'word-mute',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-key',
|
|
|
|
text: 'API',
|
|
|
|
to: '/settings/api',
|
|
|
|
active: page.value === 'api',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-ellipsis-h',
|
|
|
|
text: i18n.locale.other,
|
|
|
|
to: '/settings/other',
|
|
|
|
active: page.value === 'other',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
items: [{
|
|
|
|
type: 'button',
|
|
|
|
icon: 'fas fa-trash',
|
|
|
|
text: i18n.locale.clearCache,
|
|
|
|
action: () => {
|
|
|
|
localStorage.removeItem('locale');
|
|
|
|
localStorage.removeItem('theme');
|
|
|
|
unisonReload();
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
type: 'button',
|
|
|
|
icon: 'fas fa-sign-in-alt fa-flip-horizontal',
|
|
|
|
text: i18n.locale.logout,
|
|
|
|
action: () => {
|
|
|
|
signout();
|
|
|
|
},
|
|
|
|
danger: true,
|
|
|
|
},],
|
|
|
|
}]);
|
2021-10-09 12:33:08 +09:00
|
|
|
|
2021-01-11 20:38:34 +09:00
|
|
|
const pageProps = ref({});
|
2020-10-25 01:21:41 +09:00
|
|
|
const component = computed(() => {
|
2021-04-11 21:09:35 +09:00
|
|
|
if (page.value == null) return null;
|
|
|
|
switch (page.value) {
|
2021-04-23 13:01:52 +09:00
|
|
|
case 'accounts': return defineAsyncComponent(() => import('./accounts.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
case 'profile': return defineAsyncComponent(() => import('./profile.vue'));
|
|
|
|
case 'privacy': return defineAsyncComponent(() => import('./privacy.vue'));
|
|
|
|
case 'reaction': return defineAsyncComponent(() => import('./reaction.vue'));
|
2021-01-23 18:14:57 +09:00
|
|
|
case 'drive': return defineAsyncComponent(() => import('./drive.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
case 'notifications': return defineAsyncComponent(() => import('./notifications.vue'));
|
|
|
|
case 'mute-block': return defineAsyncComponent(() => import('./mute-block.vue'));
|
|
|
|
case 'word-mute': return defineAsyncComponent(() => import('./word-mute.vue'));
|
|
|
|
case 'integration': return defineAsyncComponent(() => import('./integration.vue'));
|
|
|
|
case 'security': return defineAsyncComponent(() => import('./security.vue'));
|
2020-11-25 21:31:34 +09:00
|
|
|
case '2fa': return defineAsyncComponent(() => import('./2fa.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
case 'api': return defineAsyncComponent(() => import('./api.vue'));
|
2020-11-25 21:31:34 +09:00
|
|
|
case 'apps': return defineAsyncComponent(() => import('./apps.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
case 'other': return defineAsyncComponent(() => import('./other.vue'));
|
|
|
|
case 'general': return defineAsyncComponent(() => import('./general.vue'));
|
2020-11-25 21:31:34 +09:00
|
|
|
case 'email': return defineAsyncComponent(() => import('./email.vue'));
|
|
|
|
case 'email/address': return defineAsyncComponent(() => import('./email-address.vue'));
|
2021-02-13 12:28:26 +09:00
|
|
|
case 'email/notification': return defineAsyncComponent(() => import('./email-notification.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
case 'theme': return defineAsyncComponent(() => import('./theme.vue'));
|
2020-11-25 21:31:34 +09:00
|
|
|
case 'theme/install': return defineAsyncComponent(() => import('./theme.install.vue'));
|
|
|
|
case 'theme/manage': return defineAsyncComponent(() => import('./theme.manage.vue'));
|
2021-07-19 11:36:35 +09:00
|
|
|
case 'menu': return defineAsyncComponent(() => import('./menu.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
case 'sounds': return defineAsyncComponent(() => import('./sounds.vue'));
|
2021-07-14 00:11:05 +09:00
|
|
|
case 'custom-css': return defineAsyncComponent(() => import('./custom-css.vue'));
|
2020-11-25 21:31:34 +09:00
|
|
|
case 'deck': return defineAsyncComponent(() => import('./deck.vue'));
|
2021-02-06 21:05:00 +09:00
|
|
|
case 'plugin': return defineAsyncComponent(() => import('./plugin.vue'));
|
|
|
|
case 'plugin/install': return defineAsyncComponent(() => import('./plugin.install.vue'));
|
|
|
|
case 'plugin/manage': return defineAsyncComponent(() => import('./plugin.manage.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
case 'import-export': return defineAsyncComponent(() => import('./import-export.vue'));
|
2020-11-25 21:31:34 +09:00
|
|
|
case 'account-info': return defineAsyncComponent(() => import('./account-info.vue'));
|
2021-01-23 16:52:45 +09:00
|
|
|
case 'update': return defineAsyncComponent(() => import('./update.vue'));
|
2021-01-11 20:38:34 +09:00
|
|
|
case 'registry': return defineAsyncComponent(() => import('./registry.vue'));
|
2021-08-21 12:48:50 +09:00
|
|
|
case 'delete-account': return defineAsyncComponent(() => import('./delete-account.vue'));
|
2020-11-29 18:06:35 +09:00
|
|
|
case 'experimental-features': return defineAsyncComponent(() => import('./experimental-features.vue'));
|
2021-01-11 20:38:34 +09:00
|
|
|
}
|
2021-04-11 21:09:35 +09:00
|
|
|
if (page.value.startsWith('registry/keys/system/')) {
|
2021-01-11 20:38:34 +09:00
|
|
|
return defineAsyncComponent(() => import('./registry.keys.vue'));
|
|
|
|
}
|
2021-04-11 21:09:35 +09:00
|
|
|
if (page.value.startsWith('registry/value/system/')) {
|
2021-01-11 20:38:34 +09:00
|
|
|
return defineAsyncComponent(() => import('./registry.value.vue'));
|
2020-10-25 01:21:41 +09:00
|
|
|
}
|
|
|
|
});
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2020-11-25 21:31:34 +09:00
|
|
|
watch(component, () => {
|
2021-01-11 20:38:34 +09:00
|
|
|
pageProps.value = {};
|
|
|
|
|
2021-04-11 21:09:35 +09:00
|
|
|
if (page.value) {
|
|
|
|
if (page.value.startsWith('registry/keys/system/')) {
|
|
|
|
pageProps.value.scope = page.value.replace('registry/keys/system/', '').split('/');
|
2021-01-11 20:38:34 +09:00
|
|
|
}
|
2021-04-11 21:09:35 +09:00
|
|
|
if (page.value.startsWith('registry/value/system/')) {
|
|
|
|
const path = page.value.replace('registry/value/system/', '').split('/');
|
2021-01-11 20:38:34 +09:00
|
|
|
pageProps.value.xKey = path.pop();
|
|
|
|
pageProps.value.scope = path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-25 21:31:34 +09:00
|
|
|
nextTick(() => {
|
2021-10-09 12:33:08 +09:00
|
|
|
scroll(el.value, { top: 0 });
|
2020-11-25 21:31:34 +09:00
|
|
|
});
|
2021-01-11 20:38:34 +09:00
|
|
|
}, { immediate: true });
|
2020-11-25 21:31:34 +09:00
|
|
|
|
2021-04-11 21:09:35 +09:00
|
|
|
watch(() => props.initialPage, () => {
|
2021-04-11 21:31:38 +09:00
|
|
|
if (props.initialPage == null && !narrow.value) {
|
|
|
|
page.value = 'profile';
|
|
|
|
} else {
|
|
|
|
page.value = props.initialPage;
|
2021-04-11 23:49:13 +09:00
|
|
|
if (props.initialPage == null) {
|
|
|
|
INFO.value = indexInfo;
|
|
|
|
}
|
2021-04-11 21:31:38 +09:00
|
|
|
}
|
2021-04-11 21:09:35 +09:00
|
|
|
});
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
onMounted(() => {
|
2021-04-11 21:09:35 +09:00
|
|
|
narrow.value = el.value.offsetWidth < 800;
|
|
|
|
if (!narrow.value) {
|
|
|
|
page.value = 'profile';
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
});
|
|
|
|
|
2021-05-04 17:09:57 +09:00
|
|
|
const emailNotConfigured = computed(() => instance.enableEmail && ($i.email == null || !$i.emailVerified));
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
return {
|
2021-04-10 12:54:12 +09:00
|
|
|
[symbols.PAGE_INFO]: INFO,
|
2021-04-11 21:09:35 +09:00
|
|
|
page,
|
2021-10-10 15:19:16 +09:00
|
|
|
menuDef,
|
2020-10-17 20:12:00 +09:00
|
|
|
narrow,
|
|
|
|
view,
|
|
|
|
el,
|
2021-01-11 20:38:34 +09:00
|
|
|
pageProps,
|
2020-10-25 01:21:41 +09:00
|
|
|
component,
|
2021-05-04 17:09:57 +09:00
|
|
|
emailNotConfigured,
|
2020-10-17 20:12:00 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.vvcocwet {
|
2021-10-02 00:51:37 +09:00
|
|
|
> .nav {
|
2021-10-24 20:16:55 +09:00
|
|
|
.baaadecd {
|
|
|
|
> .title {
|
|
|
|
margin: 16px;
|
|
|
|
font-size: 1.5em;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
2021-10-16 01:15:22 +09:00
|
|
|
|
2021-10-24 20:16:55 +09:00
|
|
|
> .info {
|
|
|
|
margin: 0 16px;
|
|
|
|
}
|
2021-10-02 23:11:21 +09:00
|
|
|
|
2021-10-24 20:16:55 +09:00
|
|
|
> .accounts {
|
|
|
|
> .avatar {
|
|
|
|
display: block;
|
|
|
|
width: 50px;
|
|
|
|
height: 50px;
|
|
|
|
margin: 8px auto 16px auto;
|
|
|
|
}
|
2021-10-02 00:51:37 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
&.wide {
|
|
|
|
display: flex;
|
2021-09-30 00:50:45 +09:00
|
|
|
max-width: 1000px;
|
2020-11-25 21:31:34 +09:00
|
|
|
margin: 0 auto;
|
2021-04-11 21:09:35 +09:00
|
|
|
height: 100%;
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
> .nav {
|
2020-11-25 21:31:34 +09:00
|
|
|
width: 32%;
|
|
|
|
box-sizing: border-box;
|
2021-04-11 21:09:35 +09:00
|
|
|
overflow: auto;
|
2021-10-16 15:00:55 +09:00
|
|
|
|
2021-10-24 20:16:55 +09:00
|
|
|
.baaadecd {
|
|
|
|
> .title {
|
|
|
|
margin: 24px 0;
|
|
|
|
}
|
2021-10-16 15:00:55 +09:00
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
flex: 1;
|
2020-12-12 12:12:01 +09:00
|
|
|
min-width: 0;
|
2021-04-11 21:09:35 +09:00
|
|
|
overflow: auto;
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|