Skip to content

Commit

Permalink
コントロールパネルの権限強化
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasina8 committed Dec 22, 2024
1 parent 9ae8d3c commit 266b291
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 126 deletions.
263 changes: 140 additions & 123 deletions packages/frontend/src/pages/admin/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import * as os from '@/os.js';
import { lookupUser, lookupUserByEmail, lookupFile } from '@/scripts/admin-lookup.js';
import { $i } from '@/account.js';
import { lookup } from '@/scripts/lookup.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
Expand Down Expand Up @@ -183,133 +184,149 @@ const menuDef = computed<ISuperMenuDefinitions>(() => [{
}] : [])],
}, {
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-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',
}],
items: [
...($i?.isAdmin || $i?.isModerator ? [
{
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-sparkles',
text: i18n.ts.avatarDecorations,
to: '/admin/avatar-decorations',
active: currentPage.value?.route.name === 'avatarDecorations',
},
...($i?.isAdmin || $i?.isModerator ? [
{

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',
}],
items: [
...($i?.isAdmin ? [
{
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',
}],
items: [
...($i?.isAdmin ? [
{
icon: 'ti ti-database',
text: i18n.ts.database,
to: '/admin/database',
active: currentPage.value?.route.name === 'database',
},
] : []),
],
}]);

function invite() {
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/src/router/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,12 @@ const routes: RouteDef[] = [{
component: iAmModerator ? page(() => import('@/pages/admin-file.vue')) : page(() => import('@/pages/not-found.vue')),
}, {
path: '/admin',
component: iAmModerator ? page(() => import('@/pages/admin/index.vue')) : page(() => import('@/pages/not-found.vue')),
// component: iAmModerator ? page(() => import('@/pages/admin/index.vue')) : page(() => import('@/pages/not-found.vue')),
component: page(() => import('@/pages/admin/index.vue')),
children: [{
path: '/overview',
name: 'overview',
component: page(() => import('@/pages/admin/overview.vue')),
component: iAmModerator ? page(() => import('@/pages/admin/overview.vue')) : page(() => import('@/pages/custom-emojis-manager.vue')),
}, {
path: '/users',
name: 'users',
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/ui/_common_/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</component>
</template>
<div :class="$style.divider"></div>
<MkA v-if="$i?.isAdmin || $i?.isModerator" v-tooltip.noDelay.right="i18n.ts.controlPanel" :class="$style.item" :activeClass="$style.active" to="/admin">
<MkA v-tooltip.noDelay.right="i18n.ts.controlPanel" :class="$style.item" :activeClass="$style.active" to="/admin">
<i :class="$style.itemIcon" class="ti ti-dashboard ti-fw"></i><span :class="$style.itemText">{{ i18n.ts.controlPanel }}</span>
</MkA>
<button class="_button" :class="$style.item" @click="more">
Expand Down

0 comments on commit 266b291

Please sign in to comment.