2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2021-11-19 10:36:12 +00:00
|
|
|
<div ref="el" class="hiyeyicy" :class="{ wide: !narrow }">
|
2022-07-20 10:59:27 +00:00
|
|
|
<div v-if="!narrow || currentPage?.route.name == null" class="nav">
|
2021-12-30 12:47:48 +00:00
|
|
|
<MkSpacer :content-max="700" :margin-min="16">
|
2021-10-24 11:16:55 +00:00
|
|
|
<div class="lxpfedzu">
|
|
|
|
<div class="banner">
|
|
|
|
<img :src="$instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
|
|
|
|
</div>
|
2021-10-10 08:48:07 +00:00
|
|
|
|
2022-07-20 13:24:26 +00:00
|
|
|
<MkInfo v-if="thereIsUnresolvedAbuseReport" warn class="info">{{ i18n.ts.thereIsUnresolvedAbuseReportWarning }} <MkA to="/admin/abuses" class="_link">{{ i18n.ts.check }}</MkA></MkInfo>
|
|
|
|
<MkInfo v-if="noMaintainerInformation" warn class="info">{{ i18n.ts.noMaintainerInformationWarning }} <MkA to="/admin/settings" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
|
|
|
<MkInfo v-if="noBotProtection" warn class="info">{{ i18n.ts.noBotProtectionWarning }} <MkA to="/admin/security" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
|
|
|
<MkInfo v-if="noEmailServer" warn class="info">{{ i18n.ts.noEmailServerWarning }} <MkA to="/admin/email-settings" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
2021-10-10 08:48:07 +00:00
|
|
|
|
2022-07-20 10:59:27 +00:00
|
|
|
<MkSuperMenu :def="menuDef" :grid="currentPage?.route.name == null"></MkSuperMenu>
|
2021-10-24 11:16:55 +00:00
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2021-04-22 13:29:33 +00:00
|
|
|
</div>
|
2023-01-03 00:19:54 +00:00
|
|
|
<div v-if="!(narrow && currentPage?.route.name == null)" class="main">
|
2022-07-20 10:59:27 +00:00
|
|
|
<RouterView/>
|
2021-04-22 13:29:33 +00:00
|
|
|
</div>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
<script lang="ts" setup>
|
2023-03-09 17:22:47 +00:00
|
|
|
import { onActivated, onMounted, onUnmounted, provide, watch } from 'vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkSuperMenu from '@/components/MkSuperMenu.vue';
|
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import { instance } from '@/instance';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { lookupUser } from '@/scripts/lookup-user';
|
2022-06-20 08:38:49 +00:00
|
|
|
import { useRouter } from '@/router';
|
2023-02-16 14:09:41 +00:00
|
|
|
import { definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata';
|
2020-02-16 17:21:27 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
const isEmpty = (x: string | null) => x == null || x === '';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
const router = useRouter();
|
2021-10-23 19:03:07 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
const indexInfo = {
|
|
|
|
title: i18n.ts.controlPanel,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-settings',
|
2022-05-17 16:32:21 +00:00
|
|
|
hideHeader: true,
|
|
|
|
};
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
provide('shouldOmitHeaderTitle', false);
|
2021-10-10 06:19:16 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
let INFO = $ref(indexInfo);
|
|
|
|
let childInfo = $ref(null);
|
|
|
|
let narrow = $ref(false);
|
|
|
|
let view = $ref(null);
|
|
|
|
let el = $ref(null);
|
|
|
|
let pageProps = $ref({});
|
|
|
|
let noMaintainerInformation = isEmpty(instance.maintainerName) || isEmpty(instance.maintainerEmail);
|
2022-10-13 00:19:57 +00:00
|
|
|
let noBotProtection = !instance.disableRegistration && !instance.enableHcaptcha && !instance.enableRecaptcha && !instance.enableTurnstile;
|
2022-06-21 10:48:28 +00:00
|
|
|
let noEmailServer = !instance.enableEmail;
|
|
|
|
let thereIsUnresolvedAbuseReport = $ref(false);
|
2022-07-20 10:59:27 +00:00
|
|
|
let currentPage = $computed(() => router.currentRef.value.child);
|
2022-06-21 10:48:28 +00:00
|
|
|
|
|
|
|
os.api('admin/abuse-user-reports', {
|
|
|
|
state: 'unresolved',
|
|
|
|
limit: 1,
|
|
|
|
}).then(reports => {
|
|
|
|
if (reports.length > 0) thereIsUnresolvedAbuseReport = true;
|
|
|
|
});
|
2021-10-10 06:19:16 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
const NARROW_THRESHOLD = 600;
|
|
|
|
const ro = new ResizeObserver((entries, observer) => {
|
|
|
|
if (entries.length === 0) return;
|
|
|
|
narrow = entries[0].borderBoxSize[0].inlineSize < NARROW_THRESHOLD;
|
|
|
|
});
|
2021-10-10 06:19:16 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
const menuDef = $computed(() => [{
|
|
|
|
title: i18n.ts.quickAction,
|
|
|
|
items: [{
|
|
|
|
type: 'button',
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-search',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.lookup,
|
|
|
|
action: lookup,
|
|
|
|
}, ...(instance.disableRegistration ? [{
|
|
|
|
type: 'button',
|
2023-01-13 05:22:53 +00:00
|
|
|
icon: 'ti ti-user-plus',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.invite,
|
|
|
|
action: invite,
|
|
|
|
}] : [])],
|
|
|
|
}, {
|
|
|
|
title: i18n.ts.administration,
|
|
|
|
items: [{
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-dashboard',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.dashboard,
|
|
|
|
to: '/admin/overview',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'overview',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-users',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.users,
|
|
|
|
to: '/admin/users',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'users',
|
2023-01-12 23:16:45 +00:00
|
|
|
}, {
|
|
|
|
icon: 'ti ti-badges',
|
|
|
|
text: i18n.ts.roles,
|
|
|
|
to: '/admin/roles',
|
|
|
|
active: currentPage?.route.name === 'roles',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-31 11:36:49 +00:00
|
|
|
icon: 'ti ti-icons',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.customEmojis,
|
|
|
|
to: '/admin/emojis',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'emojis',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-whirl',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.federation,
|
2023-01-09 01:07:37 +00:00
|
|
|
to: '/admin/federation',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'federation',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-20 06:15:34 +00:00
|
|
|
icon: 'ti ti-clock-play',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.jobQueue,
|
|
|
|
to: '/admin/queue',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'queue',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-cloud',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.files,
|
|
|
|
to: '/admin/files',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'files',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-speakerphone',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.announcements,
|
|
|
|
to: '/admin/announcements',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'announcements',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-ad',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.ads,
|
|
|
|
to: '/admin/ads',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'ads',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-exclamation-circle',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.abuseReports,
|
|
|
|
to: '/admin/abuses',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'abuses',
|
2022-05-17 16:32:21 +00:00
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.ts.settings,
|
|
|
|
items: [{
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-settings',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.general,
|
|
|
|
to: '/admin/settings',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'settings',
|
2023-03-13 08:37:22 +00:00
|
|
|
}, {
|
|
|
|
icon: 'ti ti-shield',
|
|
|
|
text: i18n.ts.moderation,
|
|
|
|
to: '/admin/moderation',
|
|
|
|
active: currentPage?.route.name === 'moderation',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-mail',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.emailServer,
|
|
|
|
to: '/admin/email-settings',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'email-settings',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-cloud',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.objectStorage,
|
|
|
|
to: '/admin/object-storage',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'object-storage',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-lock',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.security,
|
|
|
|
to: '/admin/security',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'security',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-planet',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.relays,
|
|
|
|
to: '/admin/relays',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'relays',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-ban',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.instanceBlocking,
|
|
|
|
to: '/admin/instance-block',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'instance-block',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 23:35:49 +00:00
|
|
|
icon: 'ti ti-ghost',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.proxyAccount,
|
|
|
|
to: '/admin/proxy-account',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'proxy-account',
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-adjustments',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.other,
|
|
|
|
to: '/admin/other-settings',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'other-settings',
|
2022-05-17 16:32:21 +00:00
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
title: i18n.ts.info,
|
|
|
|
items: [{
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-database',
|
2022-05-17 16:32:21 +00:00
|
|
|
text: i18n.ts.database,
|
|
|
|
to: '/admin/database',
|
2022-07-20 10:59:27 +00:00
|
|
|
active: currentPage?.route.name === 'database',
|
2022-05-17 16:32:21 +00:00
|
|
|
}],
|
|
|
|
}]);
|
2020-02-10 14:17:42 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
watch(narrow, () => {
|
2022-07-20 10:59:27 +00:00
|
|
|
if (currentPage?.route.name == null && !narrow) {
|
2022-06-20 08:38:49 +00:00
|
|
|
router.push('/admin/overview');
|
2022-05-17 16:32:21 +00:00
|
|
|
}
|
|
|
|
});
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
onMounted(() => {
|
|
|
|
ro.observe(el);
|
|
|
|
|
|
|
|
narrow = el.offsetWidth < NARROW_THRESHOLD;
|
2022-07-20 10:59:27 +00:00
|
|
|
if (currentPage?.route.name == null && !narrow) {
|
2022-06-20 08:38:49 +00:00
|
|
|
router.push('/admin/overview');
|
2022-05-17 16:32:21 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-03-09 17:22:47 +00:00
|
|
|
onActivated(() => {
|
|
|
|
narrow = el.offsetWidth < NARROW_THRESHOLD;
|
|
|
|
if (currentPage?.route.name == null && !narrow) {
|
|
|
|
router.push('/admin/overview');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
onUnmounted(() => {
|
|
|
|
ro.disconnect();
|
|
|
|
});
|
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
provideMetadataReceiver((info) => {
|
|
|
|
if (info == null) {
|
2022-05-17 16:32:21 +00:00
|
|
|
childInfo = null;
|
|
|
|
} else {
|
2022-06-20 08:38:49 +00:00
|
|
|
childInfo = info;
|
2022-05-17 16:32:21 +00:00
|
|
|
}
|
2022-06-20 08:38:49 +00:00
|
|
|
});
|
2020-08-09 06:51:02 +00:00
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
const invite = () => {
|
2023-01-13 05:22:53 +00:00
|
|
|
os.api('invite').then(x => {
|
2022-05-17 16:32:21 +00:00
|
|
|
os.alert({
|
|
|
|
type: 'info',
|
2022-06-20 08:38:49 +00:00
|
|
|
text: x.code,
|
2022-05-17 16:32:21 +00:00
|
|
|
});
|
2022-05-26 13:53:09 +00:00
|
|
|
}).catch(err => {
|
2022-05-17 16:32:21 +00:00
|
|
|
os.alert({
|
|
|
|
type: 'error',
|
2022-05-26 13:53:09 +00:00
|
|
|
text: err,
|
2022-05-17 16:32:21 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const lookup = (ev) => {
|
|
|
|
os.popupMenu([{
|
|
|
|
text: i18n.ts.user,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-user',
|
2022-05-17 16:32:21 +00:00
|
|
|
action: () => {
|
|
|
|
lookupUser();
|
2022-06-20 08:38:49 +00:00
|
|
|
},
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
|
|
|
text: i18n.ts.note,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-pencil',
|
2022-05-17 16:32:21 +00:00
|
|
|
action: () => {
|
|
|
|
alert('TODO');
|
2022-06-20 08:38:49 +00:00
|
|
|
},
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
|
|
|
text: i18n.ts.file,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-cloud',
|
2022-05-17 16:32:21 +00:00
|
|
|
action: () => {
|
|
|
|
alert('TODO');
|
2022-06-20 08:38:49 +00:00
|
|
|
},
|
2022-05-17 16:32:21 +00:00
|
|
|
}, {
|
|
|
|
text: i18n.ts.instance,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-planet',
|
2022-05-17 16:32:21 +00:00
|
|
|
action: () => {
|
|
|
|
alert('TODO');
|
2022-06-20 08:38:49 +00:00
|
|
|
},
|
2022-05-17 16:32:21 +00:00
|
|
|
}], ev.currentTarget ?? ev.target);
|
|
|
|
};
|
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata(INFO);
|
|
|
|
|
2022-05-17 16:32:21 +00:00
|
|
|
defineExpose({
|
|
|
|
header: {
|
|
|
|
title: i18n.ts.controlPanel,
|
2022-06-20 08:38:49 +00:00
|
|
|
},
|
2021-04-22 13:29:33 +00:00
|
|
|
});
|
|
|
|
</script>
|
2020-08-09 06:51:02 +00:00
|
|
|
|
2022-12-27 09:29:39 +00:00
|
|
|
<style lang="scss" scoped>
|
2021-04-22 13:29:33 +00:00
|
|
|
.hiyeyicy {
|
|
|
|
&.wide {
|
|
|
|
display: flex;
|
|
|
|
margin: 0 auto;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
> .nav {
|
|
|
|
width: 32%;
|
2021-10-10 06:19:16 +00:00
|
|
|
max-width: 280px;
|
2021-04-22 13:29:33 +00:00
|
|
|
box-sizing: border-box;
|
|
|
|
border-right: solid 0.5px var(--divider);
|
|
|
|
overflow: auto;
|
2021-10-10 06:19:16 +00:00
|
|
|
height: 100%;
|
2021-04-22 13:29:33 +00:00
|
|
|
}
|
2020-08-13 14:02:43 +00:00
|
|
|
|
2021-04-22 13:29:33 +00:00
|
|
|
> .main {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
2021-10-10 06:19:16 +00:00
|
|
|
|
|
|
|
> .nav {
|
2021-10-24 11:16:55 +00:00
|
|
|
.lxpfedzu {
|
|
|
|
> .info {
|
|
|
|
margin: 16px 0;
|
|
|
|
}
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2021-10-24 11:16:55 +00:00
|
|
|
> .banner {
|
|
|
|
margin: 16px;
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2021-10-24 11:16:55 +00:00
|
|
|
> .icon {
|
|
|
|
display: block;
|
|
|
|
margin: auto;
|
|
|
|
height: 42px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-22 13:29:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|