2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2021-04-22 16:29:33 +03:00
|
|
|
<div class="hiyeyicy" :class="{ wide: !narrow }" ref="el">
|
|
|
|
<div class="nav" v-if="!narrow || page == null">
|
2021-10-02 17:11:21 +03:00
|
|
|
<div class="group">
|
2021-10-02 18:33:29 +03:00
|
|
|
<div class="lxpfedzu">
|
|
|
|
<img :src="$instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
|
2021-10-02 17:11:21 +03:00
|
|
|
</div>
|
|
|
|
<XLink :active="page === 'overview'" replace to="/instance/overview"><template #icon><i class="fas fa-tachometer-alt"></i></template>{{ $ts.overview }}</XLink>
|
|
|
|
</div>
|
|
|
|
<div class="group">
|
|
|
|
<div class="label">{{ $ts.quickAction }}</div>
|
|
|
|
<FormButton @click="lookup"><i class="fas fa-search"></i> {{ $ts.lookup }}</FormButton>
|
|
|
|
<FormButton v-if="$instance.disableRegistration" @click="invite"><i class="fas fa-user"></i> {{ $ts.invite }}</FormButton>
|
|
|
|
</div>
|
|
|
|
<div class="group">
|
|
|
|
<div class="label">{{ $ts.administration }}</div>
|
|
|
|
<XLink :active="page === 'users'" replace to="/instance/users"><template #icon><i class="fas fa-users"></i></template>{{ $ts.users }}</XLink>
|
|
|
|
<XLink :active="page === 'emojis'" replace to="/instance/emojis"><template #icon><i class="fas fa-laugh"></i></template>{{ $ts.customEmojis }}</XLink>
|
|
|
|
<XLink :active="page === 'federation'" replace to="/instance/federation"><template #icon><i class="fas fa-globe"></i></template>{{ $ts.federation }}</XLink>
|
|
|
|
<XLink :active="page === 'queue'" replace to="/instance/queue"><template #icon><i class="fas fa-clipboard-list"></i></template>{{ $ts.jobQueue }}</XLink>
|
|
|
|
<XLink :active="page === 'files'" replace to="/instance/files"><template #icon><i class="fas fa-cloud"></i></template>{{ $ts.files }}</XLink>
|
|
|
|
<XLink :active="page === 'announcements'" replace to="/instance/announcements"><template #icon><i class="fas fa-broadcast-tower"></i></template>{{ $ts.announcements }}</XLink>
|
|
|
|
<XLink :active="page === 'ads'" replace to="/instance/ads"><template #icon><i class="fas fa-audio-description"></i></template>{{ $ts.ads }}</XLink>
|
|
|
|
<XLink :active="page === 'abuses'" replace to="/instance/abuses"><template #icon><i class="fas fa-exclamation-circle"></i></template>{{ $ts.abuseReports }}</XLink>
|
|
|
|
</div>
|
|
|
|
<div class="group">
|
|
|
|
<div class="label">{{ $ts.settings }}</div>
|
|
|
|
<XLink :active="page === 'settings'" replace to="/instance/settings"><template #icon><i class="fas fa-cog"></i></template>{{ $ts.general }}</XLink>
|
|
|
|
<XLink :active="page === 'files-settings'" replace to="/instance/files-settings"><template #icon><i class="fas fa-cloud"></i></template>{{ $ts.files }}</XLink>
|
|
|
|
<XLink :active="page === 'email-settings'" replace to="/instance/email-settings"><template #icon><i class="fas fa-envelope"></i></template>{{ $ts.emailServer }}</XLink>
|
|
|
|
<XLink :active="page === 'object-storage'" replace to="/instance/object-storage"><template #icon><i class="fas fa-cloud"></i></template>{{ $ts.objectStorage }}</XLink>
|
|
|
|
<XLink :active="page === 'security'" replace to="/instance/security"><template #icon><i class="fas fa-lock"></i></template>{{ $ts.security }}</XLink>
|
|
|
|
<XLink :active="page === 'service-worker'" replace to="/instance/service-worker"><template #icon><i class="fas fa-bolt"></i></template>ServiceWorker</XLink>
|
|
|
|
<XLink :active="page === 'relays'" replace to="/instance/relays"><template #icon><i class="fas fa-globe"></i></template>{{ $ts.relays }}</XLink>
|
|
|
|
<XLink :active="page === 'integrations'" replace to="/instance/integrations"><template #icon><i class="fas fa-share-alt"></i></template>{{ $ts.integration }}</XLink>
|
|
|
|
<XLink :active="page === 'instance-block'" replace to="/instance/instance-block"><template #icon><i class="fas fa-ban"></i></template>{{ $ts.instanceBlocking }}</XLink>
|
|
|
|
<XLink :active="page === 'proxy-account'" replace to="/instance/proxy-account"><template #icon><i class="fas fa-ghost"></i></template>{{ $ts.proxyAccount }}</XLink>
|
|
|
|
<XLink :active="page === 'other-settings'" replace to="/instance/other-settings"><template #icon><i class="fas fa-cogs"></i></template>{{ $ts.other }}</XLink>
|
|
|
|
</div>
|
|
|
|
<div class="group">
|
|
|
|
<div class="label">{{ $ts.info }}</div>
|
|
|
|
<XLink :active="page === 'database'" replace to="/instance/database"><template #icon><i class="fas fa-database"></i></template>{{ $ts.database }}</XLink>
|
|
|
|
<XLink :active="page === 'logs'" replace to="/instance/logs"><template #icon><i class="fas fa-stream"></i></template>{{ $ts.logs }}</XLink>
|
|
|
|
</div>
|
2021-04-22 16:29:33 +03:00
|
|
|
</div>
|
|
|
|
<div class="main">
|
|
|
|
<component :is="component" :key="page" @info="onInfo" v-bind="pageProps"/>
|
|
|
|
</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-04-22 16:29:33 +03:00
|
|
|
import { computed, defineAsyncComponent, defineComponent, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
|
|
|
import { i18n } from '@client/i18n';
|
2021-10-02 17:11:21 +03:00
|
|
|
import XLink from './index.link.vue';
|
2021-09-29 18:50:45 +03:00
|
|
|
import FormGroup from '@client/components/debobigego/group.vue';
|
|
|
|
import FormBase from '@client/components/debobigego/base.vue';
|
|
|
|
import FormButton from '@client/components/debobigego/button.vue';
|
2021-04-22 16:29:33 +03:00
|
|
|
import { scroll } from '@client/scripts/scroll';
|
2021-04-10 06:54:12 +03:00
|
|
|
import * as symbols from '@client/symbols';
|
2021-04-22 16:29:33 +03:00
|
|
|
import * as os from '@client/os';
|
|
|
|
import { lookupUser } from '@client/scripts/lookup-user';
|
2020-02-16 19:21:27 +02:00
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
export default defineComponent({
|
2020-01-29 21:37:25 +02:00
|
|
|
components: {
|
2021-04-22 16:29:33 +03:00
|
|
|
FormBase,
|
2021-10-02 17:11:21 +03:00
|
|
|
XLink,
|
2021-04-22 16:29:33 +03:00
|
|
|
FormGroup,
|
|
|
|
FormButton,
|
2020-01-29 21:37:25 +02:00
|
|
|
},
|
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
props: {
|
|
|
|
initialPage: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
setup(props, context) {
|
|
|
|
const indexInfo = {
|
|
|
|
title: i18n.locale.instance,
|
|
|
|
icon: 'fas fa-cog'
|
|
|
|
};
|
|
|
|
const INFO = ref(indexInfo);
|
|
|
|
const page = ref(props.initialPage);
|
|
|
|
const narrow = ref(false);
|
|
|
|
const view = ref(null);
|
|
|
|
const el = ref(null);
|
|
|
|
const onInfo = (viewInfo) => {
|
|
|
|
INFO.value = viewInfo;
|
|
|
|
};
|
|
|
|
const pageProps = ref({});
|
|
|
|
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-07 04:24:50 +03:00
|
|
|
case 'federation': return defineAsyncComponent(() => import('../federation.vue'));
|
2021-04-22 16:29:33 +03: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 15:15:57 +03:00
|
|
|
case 'ads': return defineAsyncComponent(() => import('./ads.vue'));
|
2021-04-22 16:29:33 +03:00
|
|
|
case 'database': return defineAsyncComponent(() => import('./database.vue'));
|
2021-05-11 08:31:20 +03:00
|
|
|
case 'logs': return defineAsyncComponent(() => import('./logs.vue'));
|
2021-04-22 16:29:33 +03:00
|
|
|
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 16:17:42 +02:00
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
watch(component, () => {
|
|
|
|
pageProps.value = {};
|
2020-08-09 09:51:02 +03:00
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
nextTick(() => {
|
|
|
|
scroll(el.value, 0);
|
|
|
|
});
|
|
|
|
}, { 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 21:37:25 +02:00
|
|
|
});
|
2020-08-13 11:58:16 +03:00
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
onMounted(() => {
|
|
|
|
narrow.value = el.value.offsetWidth < 800;
|
|
|
|
if (!narrow.value) {
|
|
|
|
page.value = 'overview';
|
|
|
|
}
|
2020-08-13 11:58:16 +03:00
|
|
|
});
|
2020-02-16 19:21:27 +02:00
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
const invite = () => {
|
|
|
|
os.api('admin/invite').then(x => {
|
|
|
|
os.dialog({
|
|
|
|
type: 'info',
|
|
|
|
text: x.code
|
|
|
|
});
|
|
|
|
}).catch(e => {
|
|
|
|
os.dialog({
|
|
|
|
type: 'error',
|
|
|
|
text: e
|
2020-08-10 14:23:51 +03:00
|
|
|
});
|
2020-08-09 09:51:02 +03:00
|
|
|
});
|
2021-04-22 16:29:33 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
const lookup = (ev) => {
|
2021-08-08 06:19:10 +03:00
|
|
|
os.popupMenu([{
|
2021-04-22 16:29:33 +03: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 09:51:02 +03:00
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
return {
|
|
|
|
[symbols.PAGE_INFO]: INFO,
|
|
|
|
page,
|
|
|
|
narrow,
|
|
|
|
view,
|
|
|
|
el,
|
|
|
|
onInfo,
|
|
|
|
pageProps,
|
|
|
|
component,
|
|
|
|
invite,
|
|
|
|
lookup,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
2020-08-09 09:51:02 +03:00
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
.hiyeyicy {
|
|
|
|
&.wide {
|
|
|
|
display: flex;
|
|
|
|
margin: 0 auto;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
> .nav {
|
|
|
|
width: 32%;
|
2021-10-02 17:11:21 +03:00
|
|
|
max-width: 320px;
|
2021-04-22 16:29:33 +03:00
|
|
|
box-sizing: border-box;
|
|
|
|
border-right: solid 0.5px var(--divider);
|
|
|
|
overflow: auto;
|
2021-10-02 17:11:21 +03:00
|
|
|
|
|
|
|
> .group {
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> .label {
|
|
|
|
font-size: 0.9em;
|
|
|
|
opacity: 0.7;
|
|
|
|
margin: 0 0 8px 12px;
|
|
|
|
}
|
|
|
|
}
|
2021-04-22 16:29:33 +03:00
|
|
|
}
|
2020-08-13 17:02:43 +03:00
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
> .main {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
overflow: auto;
|
|
|
|
--baseContentWidth: 100%;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
2021-04-22 16:29:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
.lxpfedzu {
|
|
|
|
padding: 16px;
|
|
|
|
|
2021-04-23 07:01:52 +03:00
|
|
|
> .icon {
|
2021-04-22 16:29:33 +03:00
|
|
|
display: block;
|
|
|
|
margin: auto;
|
|
|
|
height: 42px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|