2020-01-29 12:37:25 -07:00
|
|
|
<template>
|
2021-11-19 03:36:12 -07:00
|
|
|
<div ref="el" class="hiyeyicy" :class="{ wide: !narrow }">
|
|
|
|
<div v-if="!narrow || page == null" class="nav">
|
2021-10-10 00:19:16 -06:00
|
|
|
<MkHeader :info="header"></MkHeader>
|
|
|
|
|
2021-10-24 05:16:55 -06:00
|
|
|
<MkSpacer :content-max="700">
|
|
|
|
<div class="lxpfedzu">
|
|
|
|
<div class="banner">
|
|
|
|
<img :src="$instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
|
|
|
|
</div>
|
2021-10-10 02:48:07 -06:00
|
|
|
|
2021-10-24 05:16:55 -06:00
|
|
|
<MkInfo v-if="noMaintainerInformation" warn class="info">{{ $ts.noMaintainerInformationWarning }} <MkA to="/admin/settings" class="_link">{{ $ts.configure }}</MkA></MkInfo>
|
|
|
|
<MkInfo v-if="noBotProtection" warn class="info">{{ $ts.noBotProtectionWarning }} <MkA to="/admin/bot-protection" class="_link">{{ $ts.configure }}</MkA></MkInfo>
|
2021-10-10 02:48:07 -06:00
|
|
|
|
2021-10-24 05:16:55 -06:00
|
|
|
<MkSuperMenu :def="menuDef" :grid="page == null"></MkSuperMenu>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2021-04-22 07:29:33 -06:00
|
|
|
</div>
|
|
|
|
<div class="main">
|
2021-10-23 13:03:07 -06:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkHeader v-if="childInfo && !childInfo.hideHeader" :info="childInfo"/></template>
|
2021-11-19 03:36:12 -07:00
|
|
|
<component :is="component" :key="page" v-bind="pageProps" @info="onInfo"/>
|
2021-10-23 13:03:07 -06:00
|
|
|
</MkStickyContainer>
|
2021-04-22 07:29:33 -06:00
|
|
|
</div>
|
2020-01-29 12:37:25 -07:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-10-31 04:37:18 -06:00
|
|
|
import { computed, defineAsyncComponent, defineComponent, isRef, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
2021-11-11 10:02:25 -07:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import MkSuperMenu from '@/components/ui/super-menu.vue';
|
|
|
|
import FormGroup from '@/components/debobigego/group.vue';
|
|
|
|
import FormBase from '@/components/debobigego/base.vue';
|
|
|
|
import FormButton from '@/components/debobigego/button.vue';
|
|
|
|
import MkInfo from '@/components/ui/info.vue';
|
|
|
|
import { scroll } from '@/scripts/scroll';
|
|
|
|
import { instance } from '@/instance';
|
|
|
|
import * as symbols from '@/symbols';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { lookupUser } from '@/scripts/lookup-user';
|
2020-02-16 10:21:27 -07:00
|
|
|
|
2020-10-17 05:12:00 -06:00
|
|
|
export default defineComponent({
|
2020-01-29 12:37:25 -07:00
|
|
|
components: {
|
2021-04-22 07:29:33 -06:00
|
|
|
FormBase,
|
2021-10-10 00:19:16 -06:00
|
|
|
MkSuperMenu,
|
2021-04-22 07:29:33 -06:00
|
|
|
FormGroup,
|
|
|
|
FormButton,
|
2021-10-10 00:19:16 -06:00
|
|
|
MkInfo,
|
2020-01-29 12:37:25 -07:00
|
|
|
},
|
|
|
|
|
2021-10-23 13:03:07 -06:00
|
|
|
provide: {
|
|
|
|
shouldOmitHeaderTitle: false,
|
|
|
|
},
|
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
props: {
|
|
|
|
initialPage: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
2020-01-29 12:37:25 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
setup(props, context) {
|
|
|
|
const indexInfo = {
|
2021-10-23 13:03:07 -06:00
|
|
|
title: i18n.locale.controlPanel,
|
2021-10-08 21:33:08 -06:00
|
|
|
icon: 'fas fa-cog',
|
|
|
|
bg: 'var(--bg)',
|
2021-10-23 13:03:07 -06:00
|
|
|
hideHeader: true,
|
2021-04-22 07:29:33 -06:00
|
|
|
};
|
|
|
|
const INFO = ref(indexInfo);
|
2021-10-23 13:03:07 -06:00
|
|
|
const childInfo = ref(null);
|
2021-04-22 07:29:33 -06:00
|
|
|
const page = ref(props.initialPage);
|
|
|
|
const narrow = ref(false);
|
|
|
|
const view = ref(null);
|
|
|
|
const el = ref(null);
|
|
|
|
const onInfo = (viewInfo) => {
|
2021-10-31 04:37:18 -06:00
|
|
|
if (isRef(viewInfo)) {
|
|
|
|
watch(viewInfo, () => {
|
|
|
|
childInfo.value = viewInfo.value;
|
|
|
|
}, { immediate: true });
|
|
|
|
} else {
|
|
|
|
childInfo.value = viewInfo;
|
|
|
|
}
|
2021-04-22 07:29:33 -06:00
|
|
|
};
|
|
|
|
const pageProps = ref({});
|
2021-10-10 00:19:16 -06:00
|
|
|
|
|
|
|
const isEmpty = (x: any) => x == null || x == '';
|
|
|
|
|
|
|
|
const noMaintainerInformation = ref(false);
|
|
|
|
const noBotProtection = ref(false);
|
|
|
|
|
|
|
|
os.api('meta', { detail: true }).then(meta => {
|
|
|
|
// TODO: 設定が完了しても残ったままになるので、ストリーミングでmeta更新イベントを受け取ってよしなに更新する
|
|
|
|
noMaintainerInformation.value = isEmpty(meta.maintainerName) || isEmpty(meta.maintainerEmail);
|
|
|
|
noBotProtection.value = !meta.enableHcaptcha && !meta.enableRecaptcha;
|
|
|
|
});
|
|
|
|
|
|
|
|
const menuDef = computed(() => [{
|
|
|
|
title: i18n.locale.quickAction,
|
|
|
|
items: [{
|
|
|
|
type: 'button',
|
|
|
|
icon: 'fas fa-search',
|
|
|
|
text: i18n.locale.lookup,
|
|
|
|
action: lookup,
|
|
|
|
}, ...(instance.disableRegistration ? [{
|
|
|
|
type: 'button',
|
|
|
|
icon: 'fas fa-user',
|
|
|
|
text: i18n.locale.invite,
|
|
|
|
action: invite,
|
|
|
|
}] : [])],
|
|
|
|
}, {
|
|
|
|
title: i18n.locale.administration,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-tachometer-alt',
|
|
|
|
text: i18n.locale.dashboard,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/overview',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'overview',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-users',
|
|
|
|
text: i18n.locale.users,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/users',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'users',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-laugh',
|
|
|
|
text: i18n.locale.customEmojis,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/emojis',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'emojis',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-globe',
|
|
|
|
text: i18n.locale.federation,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/federation',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'federation',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-clipboard-list',
|
|
|
|
text: i18n.locale.jobQueue,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/queue',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'queue',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-cloud',
|
|
|
|
text: i18n.locale.files,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/files',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'files',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-broadcast-tower',
|
|
|
|
text: i18n.locale.announcements,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/announcements',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'announcements',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-audio-description',
|
|
|
|
text: i18n.locale.ads,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/ads',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'ads',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-exclamation-circle',
|
|
|
|
text: i18n.locale.abuseReports,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/abuses',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'abuses',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.locale.settings,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-cog',
|
|
|
|
text: i18n.locale.general,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/settings',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'settings',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-cloud',
|
|
|
|
text: i18n.locale.files,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/files-settings',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'files-settings',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-envelope',
|
|
|
|
text: i18n.locale.emailServer,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/email-settings',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'email-settings',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-cloud',
|
|
|
|
text: i18n.locale.objectStorage,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/object-storage',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'object-storage',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-lock',
|
|
|
|
text: i18n.locale.security,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/security',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'security',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-bolt',
|
|
|
|
text: 'ServiceWorker',
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/service-worker',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'service-worker',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-globe',
|
|
|
|
text: i18n.locale.relays,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/relays',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'relays',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-share-alt',
|
|
|
|
text: i18n.locale.integration,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/integrations',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'integrations',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-ban',
|
|
|
|
text: i18n.locale.instanceBlocking,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/instance-block',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'instance-block',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-ghost',
|
|
|
|
text: i18n.locale.proxyAccount,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/proxy-account',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'proxy-account',
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-cogs',
|
|
|
|
text: i18n.locale.other,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/other-settings',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'other-settings',
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.locale.info,
|
|
|
|
items: [{
|
|
|
|
icon: 'fas fa-database',
|
|
|
|
text: i18n.locale.database,
|
2021-10-22 02:37:51 -06:00
|
|
|
to: '/admin/database',
|
2021-10-10 00:19:16 -06:00
|
|
|
active: page.value === 'database',
|
|
|
|
}],
|
|
|
|
}]);
|
2021-04-22 07:29:33 -06:00
|
|
|
const component = computed(() => {
|
|
|
|
if (page.value == null) return null;
|
|
|
|
switch (page.value) {
|
|
|
|
case 'overview': return defineAsyncComponent(() => import('./overview.vue'));
|
|
|
|
case 'users': return defineAsyncComponent(() => import('./users.vue'));
|
|
|
|
case 'emojis': return defineAsyncComponent(() => import('./emojis.vue'));
|
2021-08-06 19:24:50 -06:00
|
|
|
case 'federation': return defineAsyncComponent(() => import('../federation.vue'));
|
2021-04-22 07:29:33 -06:00
|
|
|
case 'queue': return defineAsyncComponent(() => import('./queue.vue'));
|
|
|
|
case 'files': return defineAsyncComponent(() => import('./files.vue'));
|
|
|
|
case 'announcements': return defineAsyncComponent(() => import('./announcements.vue'));
|
2021-05-04 06:15:57 -06:00
|
|
|
case 'ads': return defineAsyncComponent(() => import('./ads.vue'));
|
2021-04-22 07:29:33 -06:00
|
|
|
case 'database': return defineAsyncComponent(() => import('./database.vue'));
|
|
|
|
case 'abuses': return defineAsyncComponent(() => import('./abuses.vue'));
|
|
|
|
case 'settings': return defineAsyncComponent(() => import('./settings.vue'));
|
|
|
|
case 'files-settings': return defineAsyncComponent(() => import('./files-settings.vue'));
|
|
|
|
case 'email-settings': return defineAsyncComponent(() => import('./email-settings.vue'));
|
|
|
|
case 'object-storage': return defineAsyncComponent(() => import('./object-storage.vue'));
|
|
|
|
case 'security': return defineAsyncComponent(() => import('./security.vue'));
|
|
|
|
case 'bot-protection': return defineAsyncComponent(() => import('./bot-protection.vue'));
|
|
|
|
case 'service-worker': return defineAsyncComponent(() => import('./service-worker.vue'));
|
|
|
|
case 'relays': return defineAsyncComponent(() => import('./relays.vue'));
|
|
|
|
case 'integrations': return defineAsyncComponent(() => import('./integrations.vue'));
|
|
|
|
case 'integrations/twitter': return defineAsyncComponent(() => import('./integrations-twitter.vue'));
|
|
|
|
case 'integrations/github': return defineAsyncComponent(() => import('./integrations-github.vue'));
|
|
|
|
case 'integrations/discord': return defineAsyncComponent(() => import('./integrations-discord.vue'));
|
|
|
|
case 'instance-block': return defineAsyncComponent(() => import('./instance-block.vue'));
|
|
|
|
case 'proxy-account': return defineAsyncComponent(() => import('./proxy-account.vue'));
|
|
|
|
case 'other-settings': return defineAsyncComponent(() => import('./other-settings.vue'));
|
|
|
|
}
|
|
|
|
});
|
2020-02-10 07:17:42 -07:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
watch(component, () => {
|
|
|
|
pageProps.value = {};
|
2020-08-09 00:51:02 -06:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
nextTick(() => {
|
2021-10-08 21:33:08 -06:00
|
|
|
scroll(el.value, { top: 0 });
|
2021-04-22 07:29:33 -06:00
|
|
|
});
|
|
|
|
}, { immediate: true });
|
|
|
|
|
|
|
|
watch(() => props.initialPage, () => {
|
|
|
|
if (props.initialPage == null && !narrow.value) {
|
|
|
|
page.value = 'overview';
|
|
|
|
} else {
|
|
|
|
page.value = props.initialPage;
|
|
|
|
if (props.initialPage == null) {
|
|
|
|
INFO.value = indexInfo;
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 12:37:25 -07:00
|
|
|
});
|
2020-08-13 02:58:16 -06:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
onMounted(() => {
|
|
|
|
narrow.value = el.value.offsetWidth < 800;
|
|
|
|
if (!narrow.value) {
|
|
|
|
page.value = 'overview';
|
|
|
|
}
|
2020-08-13 02:58:16 -06:00
|
|
|
});
|
2020-02-16 10:21:27 -07:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
const invite = () => {
|
|
|
|
os.api('admin/invite').then(x => {
|
2021-11-18 02:45:58 -07:00
|
|
|
os.alert({
|
2021-04-22 07:29:33 -06:00
|
|
|
type: 'info',
|
|
|
|
text: x.code
|
|
|
|
});
|
|
|
|
}).catch(e => {
|
2021-11-18 02:45:58 -07:00
|
|
|
os.alert({
|
2021-04-22 07:29:33 -06:00
|
|
|
type: 'error',
|
|
|
|
text: e
|
2020-08-10 05:23:51 -06:00
|
|
|
});
|
2020-08-09 00:51:02 -06:00
|
|
|
});
|
2021-04-22 07:29:33 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
const lookup = (ev) => {
|
2021-08-07 21:19:10 -06:00
|
|
|
os.popupMenu([{
|
2021-04-22 07:29:33 -06:00
|
|
|
text: i18n.locale.user,
|
|
|
|
icon: 'fas fa-user',
|
|
|
|
action: () => {
|
|
|
|
lookupUser();
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
text: i18n.locale.note,
|
|
|
|
icon: 'fas fa-pencil-alt',
|
|
|
|
action: () => {
|
|
|
|
alert('TODO');
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
text: i18n.locale.file,
|
|
|
|
icon: 'fas fa-cloud',
|
|
|
|
action: () => {
|
|
|
|
alert('TODO');
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
text: i18n.locale.instance,
|
|
|
|
icon: 'fas fa-globe',
|
|
|
|
action: () => {
|
|
|
|
alert('TODO');
|
|
|
|
}
|
|
|
|
}], ev.currentTarget || ev.target);
|
|
|
|
};
|
2020-08-09 00:51:02 -06:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
return {
|
|
|
|
[symbols.PAGE_INFO]: INFO,
|
2021-10-10 00:19:16 -06:00
|
|
|
menuDef,
|
|
|
|
header: {
|
2021-10-24 05:16:55 -06:00
|
|
|
title: i18n.locale.controlPanel,
|
2021-10-10 00:19:16 -06:00
|
|
|
},
|
|
|
|
noMaintainerInformation,
|
|
|
|
noBotProtection,
|
2021-04-22 07:29:33 -06:00
|
|
|
page,
|
|
|
|
narrow,
|
|
|
|
view,
|
|
|
|
el,
|
|
|
|
onInfo,
|
2021-10-23 13:03:07 -06:00
|
|
|
childInfo,
|
2021-04-22 07:29:33 -06:00
|
|
|
pageProps,
|
|
|
|
component,
|
|
|
|
invite,
|
|
|
|
lookup,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
2020-08-09 00:51:02 -06:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
.hiyeyicy {
|
|
|
|
&.wide {
|
|
|
|
display: flex;
|
|
|
|
margin: 0 auto;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
> .nav {
|
|
|
|
width: 32%;
|
2021-10-10 00:19:16 -06:00
|
|
|
max-width: 280px;
|
2021-04-22 07:29:33 -06:00
|
|
|
box-sizing: border-box;
|
|
|
|
border-right: solid 0.5px var(--divider);
|
|
|
|
overflow: auto;
|
2021-10-10 00:19:16 -06:00
|
|
|
height: 100%;
|
2021-04-22 07:29:33 -06:00
|
|
|
}
|
2020-08-13 08:02:43 -06:00
|
|
|
|
2021-04-22 07:29:33 -06:00
|
|
|
> .main {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
}
|
2020-01-29 12:37:25 -07:00
|
|
|
}
|
2021-10-10 00:19:16 -06:00
|
|
|
|
|
|
|
> .nav {
|
2021-10-24 05:16:55 -06:00
|
|
|
.lxpfedzu {
|
|
|
|
> .info {
|
|
|
|
margin: 16px 0;
|
|
|
|
}
|
2021-04-22 07:29:33 -06:00
|
|
|
|
2021-10-24 05:16:55 -06:00
|
|
|
> .banner {
|
|
|
|
margin: 16px;
|
2021-04-22 07:29:33 -06:00
|
|
|
|
2021-10-24 05:16:55 -06:00
|
|
|
> .icon {
|
|
|
|
display: block;
|
|
|
|
margin: auto;
|
|
|
|
height: 42px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-22 07:29:33 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|