mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-27 02:34:11 +02:00
* wip * wip * wip * wip * wip * wip * wip * wip * fix * fix * fix * fix size * fix register logs * fix img autosize * fix row selection * support delete * fix border rendering * fix display:none * tweak comments * support choose pc file and drive file * support directory drag-drop * fix * fix comment * support context menu on data area * fix autogen * wip イベント整理 * イベントの整理 * refactor grid * fix cell re-render bugs * fix row remove * fix comment * fix validation * fix utils * list maximum * add mimetype check * fix * fix number cell focus * fix over 100 file drop * remove log * fix patchData * fix performance * fix * support update and delete * support remote import * fix layout * heightやめる * fix performance * add list v2 endpoint * support pagination * fix api call * fix no clickable input text * fix limit * fix paging * fix * fix * support search * tweak logs * tweak cell selection * fix range select * block delete * add comment * fix * support import log * fix dialog * refactor * add confirm dialog * fix name * fix autogen * wip * support image change and highlight row * add columns * wip * support sort * add role name * add index to emoji * refine context menu setting * support role select * remove unused buttons * fix url * fix MkRoleSelectDialog.vue * add route * refine remote page * enter key search * fix paste bugs * fix copy/paste * fix keyEvent * fix copy/paste and delete * fix comment * fix MkRoleSelectDialog.vue and storybook scenario * fix MkRoleSelectDialog.vue and storybook scenario * add MkGrid.stories.impl.ts * fix * [wip] add custom-emojis-manager2.stories.impl.ts * [wip] add custom-emojis-manager2.stories.impl.ts * wip * 課題はまだ残っているが、ひとまず完了 * fix validation and register roles * fix upload * optimize import * patch from dev * i18n * revert excess fixes * separate sort order component * add SPDX * revert excess fixes * fix pre test * fix bugs * add type column * fix types * fix CHANGELOG.md * fix lit * lint * tweak style * refactor * fix ci * autogen * Update types.ts * CSS Module化 * fix log * 縦スクロールを無効化 * MkStickyContainer化 * regenerate locales index.d.ts * fix * fix * テスト * ランダム値によるUI変更の抑制 * テスト * tableタグやめる * fix last-child css * fix overflow css * fix endpoint.ts * tweak css * 最新への追従とレイアウト微調整 * ソートキーの指定方法を他と合わせた * fix focus * fix layout * v2エンドポイントのルールに対応 * 表示条件などを微調整 * fix MkDataCell.vue * fix error code * fix error * add comment to MkModal.vue * Update index.d.ts * fix CHANGELOG.md * fix color theme * fix CHANGELOG.md * fix CHANGELOG.md * fix center * fix: テーブルにフォーカスがあり、通常状態であるときはキーイベントの伝搬を止める * fix: ロール選択用のダイアログにてコンディショナルロールを×ボタンで除外できなかったのを修正 * fix remote list folder * sticky footers * chore: fix ci error(just single line-break diff) * fix loading * fix like * comma to space * fix ci * fix ci * removed align-center --------- Co-authored-by: osamu <46447427+sam-osamu@users.noreply.github.com> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
366 lines
9.6 KiB
Vue
366 lines
9.6 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<div ref="el" class="hiyeyicy" :class="{ wide: !narrow }">
|
|
<div v-if="!narrow || currentPage?.route.name == null" class="nav">
|
|
<MkSpacer :contentMax="700" :marginMin="16">
|
|
<div class="lxpfedzu _gaps">
|
|
<div class="banner">
|
|
<img :src="instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
|
|
</div>
|
|
|
|
<div class="_gaps_s">
|
|
<MkInfo v-if="thereIsUnresolvedAbuseReport" warn>{{ i18n.ts.thereIsUnresolvedAbuseReportWarning }} <MkA to="/admin/abuses" class="_link">{{ i18n.ts.check }}</MkA></MkInfo>
|
|
<MkInfo v-if="noMaintainerInformation" warn>{{ i18n.ts.noMaintainerInformationWarning }} <MkA to="/admin/settings" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
|
<MkInfo v-if="noInquiryUrl" warn>{{ i18n.ts.noInquiryUrlWarning }} <MkA to="/admin/settings" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
|
<MkInfo v-if="noBotProtection" warn>{{ i18n.ts.noBotProtectionWarning }} <MkA to="/admin/security" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
|
<MkInfo v-if="noEmailServer" warn>{{ i18n.ts.noEmailServerWarning }} <MkA to="/admin/email-settings" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
|
|
</div>
|
|
|
|
<MkSuperMenu :def="menuDef" :grid="narrow"></MkSuperMenu>
|
|
</div>
|
|
</MkSpacer>
|
|
</div>
|
|
<div v-if="!(narrow && currentPage?.route.name == null)" class="main">
|
|
<RouterView nested/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { onActivated, onMounted, onUnmounted, provide, watch, ref, computed } from 'vue';
|
|
import { i18n } from '@/i18n.js';
|
|
import MkSuperMenu from '@/components/MkSuperMenu.vue';
|
|
import MkInfo from '@/components/MkInfo.vue';
|
|
import { instance } from '@/instance.js';
|
|
import { lookup } from '@/scripts/lookup.js';
|
|
import * as os from '@/os.js';
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
|
import { lookupUser, lookupUserByEmail, lookupFile } from '@/scripts/admin-lookup.js';
|
|
import { PageMetadata, definePageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
|
|
import { useRouter } from '@/router/supplier.js';
|
|
|
|
const isEmpty = (x: string | null) => x == null || x === '';
|
|
|
|
const router = useRouter();
|
|
|
|
const indexInfo = {
|
|
title: i18n.ts.controlPanel,
|
|
icon: 'ti ti-settings',
|
|
hideHeader: true,
|
|
};
|
|
|
|
provide('shouldOmitHeaderTitle', false);
|
|
|
|
const INFO = ref(indexInfo);
|
|
const childInfo = ref<null | PageMetadata>(null);
|
|
const narrow = ref(false);
|
|
const view = ref(null);
|
|
const el = ref<HTMLDivElement | null>(null);
|
|
const pageProps = ref({});
|
|
const noMaintainerInformation = computed(() => isEmpty(instance.maintainerName) || isEmpty(instance.maintainerEmail));
|
|
const noBotProtection = computed(() => !instance.disableRegistration && !instance.enableHcaptcha && !instance.enableRecaptcha && !instance.enableTurnstile && !instance.enableMcaptcha);
|
|
const noEmailServer = computed(() => !instance.enableEmail);
|
|
const noInquiryUrl = computed(() => isEmpty(instance.inquiryUrl));
|
|
const thereIsUnresolvedAbuseReport = ref(false);
|
|
const currentPage = computed(() => router.currentRef.value.child);
|
|
|
|
misskeyApi('admin/abuse-user-reports', {
|
|
state: 'unresolved',
|
|
limit: 1,
|
|
}).then(reports => {
|
|
if (reports.length > 0) thereIsUnresolvedAbuseReport.value = true;
|
|
});
|
|
|
|
const NARROW_THRESHOLD = 600;
|
|
const ro = new ResizeObserver((entries, observer) => {
|
|
if (entries.length === 0) return;
|
|
narrow.value = entries[0].borderBoxSize[0].inlineSize < NARROW_THRESHOLD;
|
|
});
|
|
|
|
const menuDef = computed(() => [{
|
|
title: i18n.ts.quickAction,
|
|
items: [{
|
|
type: 'button',
|
|
icon: 'ti ti-search',
|
|
text: i18n.ts.lookup,
|
|
action: adminLookup,
|
|
}, ...(instance.disableRegistration ? [{
|
|
type: 'button',
|
|
icon: 'ti ti-user-plus',
|
|
text: i18n.ts.createInviteCode,
|
|
action: invite,
|
|
}] : [])],
|
|
}, {
|
|
title: i18n.ts.administration,
|
|
items: [{
|
|
icon: 'ti ti-dashboard',
|
|
text: i18n.ts.dashboard,
|
|
to: '/admin/overview',
|
|
active: currentPage.value?.route.name === 'overview',
|
|
}, {
|
|
icon: 'ti ti-users',
|
|
text: i18n.ts.users,
|
|
to: '/admin/users',
|
|
active: currentPage.value?.route.name === 'users',
|
|
}, {
|
|
icon: 'ti ti-user-plus',
|
|
text: i18n.ts.invite,
|
|
to: '/admin/invites',
|
|
active: currentPage.value?.route.name === 'invites',
|
|
}, {
|
|
icon: 'ti ti-badges',
|
|
text: i18n.ts.roles,
|
|
to: '/admin/roles',
|
|
active: currentPage.value?.route.name === 'roles',
|
|
}, {
|
|
icon: 'ti ti-icons',
|
|
text: i18n.ts.customEmojis,
|
|
to: '/admin/emojis',
|
|
active: currentPage.value?.route.name === 'emojis',
|
|
}, {
|
|
icon: 'ti ti-icons',
|
|
text: i18n.ts.customEmojis + '(beta)',
|
|
to: '/admin/emojis2',
|
|
active: currentPage.value?.route.name === 'emojis2',
|
|
}, {
|
|
icon: 'ti ti-sparkles',
|
|
text: i18n.ts.avatarDecorations,
|
|
to: '/admin/avatar-decorations',
|
|
active: currentPage.value?.route.name === 'avatarDecorations',
|
|
}, {
|
|
icon: 'ti ti-whirl',
|
|
text: i18n.ts.federation,
|
|
to: '/admin/federation',
|
|
active: currentPage.value?.route.name === 'federation',
|
|
}, {
|
|
icon: 'ti ti-clock-play',
|
|
text: i18n.ts.jobQueue,
|
|
to: '/admin/queue',
|
|
active: currentPage.value?.route.name === 'queue',
|
|
}, {
|
|
icon: 'ti ti-cloud',
|
|
text: i18n.ts.files,
|
|
to: '/admin/files',
|
|
active: currentPage.value?.route.name === 'files',
|
|
}, {
|
|
icon: 'ti ti-speakerphone',
|
|
text: i18n.ts.announcements,
|
|
to: '/admin/announcements',
|
|
active: currentPage.value?.route.name === 'announcements',
|
|
}, {
|
|
icon: 'ti ti-ad',
|
|
text: i18n.ts.ads,
|
|
to: '/admin/ads',
|
|
active: currentPage.value?.route.name === 'ads',
|
|
}, {
|
|
icon: 'ti ti-exclamation-circle',
|
|
text: i18n.ts.abuseReports,
|
|
to: '/admin/abuses',
|
|
active: currentPage.value?.route.name === 'abuses',
|
|
}, {
|
|
icon: 'ti ti-list-search',
|
|
text: i18n.ts.moderationLogs,
|
|
to: '/admin/modlog',
|
|
active: currentPage.value?.route.name === 'modlog',
|
|
}],
|
|
}, {
|
|
title: i18n.ts.settings,
|
|
items: [{
|
|
icon: 'ti ti-settings',
|
|
text: i18n.ts.general,
|
|
to: '/admin/settings',
|
|
active: currentPage.value?.route.name === 'settings',
|
|
}, {
|
|
icon: 'ti ti-paint',
|
|
text: i18n.ts.branding,
|
|
to: '/admin/branding',
|
|
active: currentPage.value?.route.name === 'branding',
|
|
}, {
|
|
icon: 'ti ti-shield',
|
|
text: i18n.ts.moderation,
|
|
to: '/admin/moderation',
|
|
active: currentPage.value?.route.name === 'moderation',
|
|
}, {
|
|
icon: 'ti ti-mail',
|
|
text: i18n.ts.emailServer,
|
|
to: '/admin/email-settings',
|
|
active: currentPage.value?.route.name === 'email-settings',
|
|
}, {
|
|
icon: 'ti ti-cloud',
|
|
text: i18n.ts.objectStorage,
|
|
to: '/admin/object-storage',
|
|
active: currentPage.value?.route.name === 'object-storage',
|
|
}, {
|
|
icon: 'ti ti-lock',
|
|
text: i18n.ts.security,
|
|
to: '/admin/security',
|
|
active: currentPage.value?.route.name === 'security',
|
|
}, {
|
|
icon: 'ti ti-planet',
|
|
text: i18n.ts.relays,
|
|
to: '/admin/relays',
|
|
active: currentPage.value?.route.name === 'relays',
|
|
}, {
|
|
icon: 'ti ti-link',
|
|
text: i18n.ts.externalServices,
|
|
to: '/admin/external-services',
|
|
active: currentPage.value?.route.name === 'external-services',
|
|
}, {
|
|
icon: 'ti ti-webhook',
|
|
text: 'Webhook',
|
|
to: '/admin/system-webhook',
|
|
active: currentPage.value?.route.name === 'system-webhook',
|
|
}, {
|
|
icon: 'ti ti-bolt',
|
|
text: i18n.ts.performance,
|
|
to: '/admin/performance',
|
|
active: currentPage.value?.route.name === 'performance',
|
|
}],
|
|
}, {
|
|
title: i18n.ts.info,
|
|
items: [{
|
|
icon: 'ti ti-database',
|
|
text: i18n.ts.database,
|
|
to: '/admin/database',
|
|
active: currentPage.value?.route.name === 'database',
|
|
}],
|
|
}]);
|
|
|
|
onMounted(() => {
|
|
if (el.value != null) {
|
|
ro.observe(el.value);
|
|
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
|
|
}
|
|
if (currentPage.value?.route.name == null && !narrow.value) {
|
|
router.replace('/admin/overview');
|
|
}
|
|
});
|
|
|
|
onActivated(() => {
|
|
if (el.value != null) {
|
|
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
|
|
}
|
|
if (currentPage.value?.route.name == null && !narrow.value) {
|
|
router.replace('/admin/overview');
|
|
}
|
|
});
|
|
|
|
onUnmounted(() => {
|
|
ro.disconnect();
|
|
});
|
|
|
|
watch(router.currentRef, (to) => {
|
|
if (to.route.path === '/admin' && to.child?.route.name == null && !narrow.value) {
|
|
router.replace('/admin/overview');
|
|
}
|
|
});
|
|
|
|
provideMetadataReceiver((metadataGetter) => {
|
|
const info = metadataGetter();
|
|
if (info == null) {
|
|
childInfo.value = null;
|
|
} else {
|
|
childInfo.value = info;
|
|
INFO.value.needWideArea = info.needWideArea ?? undefined;
|
|
}
|
|
});
|
|
provideReactiveMetadata(INFO);
|
|
|
|
function invite() {
|
|
misskeyApi('admin/invite/create').then(x => {
|
|
os.alert({
|
|
type: 'info',
|
|
text: x[0].code,
|
|
});
|
|
}).catch(err => {
|
|
os.alert({
|
|
type: 'error',
|
|
text: err,
|
|
});
|
|
});
|
|
}
|
|
|
|
function adminLookup(ev: MouseEvent) {
|
|
os.popupMenu([{
|
|
text: i18n.ts.user,
|
|
icon: 'ti ti-user',
|
|
action: () => {
|
|
lookupUser();
|
|
},
|
|
}, {
|
|
text: `${i18n.ts.user} (${i18n.ts.email})`,
|
|
icon: 'ti ti-user',
|
|
action: () => {
|
|
lookupUserByEmail();
|
|
},
|
|
}, {
|
|
text: i18n.ts.file,
|
|
icon: 'ti ti-cloud',
|
|
action: () => {
|
|
lookupFile();
|
|
},
|
|
}, {
|
|
text: i18n.ts.lookup,
|
|
icon: 'ti ti-world-search',
|
|
action: () => {
|
|
lookup();
|
|
},
|
|
}], ev.currentTarget ?? ev.target);
|
|
}
|
|
|
|
const headerActions = computed(() => []);
|
|
|
|
const headerTabs = computed(() => []);
|
|
|
|
definePageMetadata(() => INFO.value);
|
|
|
|
defineExpose({
|
|
header: {
|
|
title: i18n.ts.controlPanel,
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.hiyeyicy {
|
|
&.wide {
|
|
display: flex;
|
|
margin: 0 auto;
|
|
height: 100%;
|
|
|
|
> .nav {
|
|
width: 32%;
|
|
max-width: 280px;
|
|
box-sizing: border-box;
|
|
border-right: solid 0.5px var(--MI_THEME-divider);
|
|
overflow: auto;
|
|
height: 100%;
|
|
}
|
|
|
|
> .main {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
}
|
|
|
|
> .nav {
|
|
.lxpfedzu {
|
|
> .banner {
|
|
margin: 16px;
|
|
|
|
> .icon {
|
|
display: block;
|
|
margin: auto;
|
|
height: 42px;
|
|
border-radius: 8px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|