forked from mirrors/misskey
* fix
* navhookをbootに移動
* サーバーサイドのbootも分けるように
* 埋め込みページかどうかの判定は最初の一回だけに
* tooltipは出せるように
* fix design
* 埋め込み独自のtooltipを削除
* ロジックの分岐が多かったMkNoteDetailedを分離
* fix indent
* プレビュー用iframeにフォーカスが当たるのを修正
* popupの制御を出す側で行うように
* パラメータが逆になっていたのを修正
* Update MkEmbedCodeGenDialog.vue
* fix
* eliminate misskey-js lint warns
* fix
* add appropriate attributes to embed html
* enhance: サーバーサイドのembed系をさらに分離
* enhance: embed routerを分離(route定義をboot時に変更できるようにする改修を含む)
* type
* lint
* fix indent
* server-side styleを完全に分離
* Revert "refactor: 画面サイズのしきい値をconstにまとめる"
This reverts commit 05ca36f400889456981e89489ae0ae242fa09b67.
* fix
* revert all changes in base.pug
* embedドメインをまとめた
* embedドメインをまとめた
* prevent calling contextmenu in embed page by stopping at the caller
* fix import
* fix import
* improve directory structure
* fix import
* register timeline ui as a container
* wa-
* rename
* wa-
* Update EmMediaList.vue
* Update EmMediaList.vue
* Update EmMediaList.vue
* Update EmMediaImage.vue
* Update EmNote.vue
* revert mkmedialist changes
* 戻し漏れ
* wip
* tweak embed media ui
* revert original media components
* Update boot.embed.js
* rename
* wip
* Update MkNote.vue
* wip
* Update MkSubNoteContent.vue
* Update EmNote.vue
* Update packages/frontend/src/router/definition.ts
* Revert "Update packages/frontend/src/router/definition.ts"
This reverts commit 937ae44521cdb0f250796943b20142b65f8ed944.
* refactor EmMediaImage
* fix import
* remove unused imports
* Update router.ts
* wip
* Update boot.ts
* wip
* wip
* wip
* wip
* Update EmNote.vue
* Update EmNote.vue
* Create EmA.vue
* Create EmAvatar.vue
* Update EmAvatar.vue
* wip
* wip
* wip
* Create EmImgWithBlurhash.vue
* Update EmImgWithBlurhash.vue
* Create EmPagination.vue
* wip
* Update boot.ts
* wip
* wip
* wi@p
* wip
* wip
* wiop
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update boot.ts
* wip
* Update MkMisskeyFlavoredMarkdown.ts
* wip
* wip
* wip
* wip
* wip
* Update post-message.ts
* wip
* Update EmNoteDetailed.vue
* Update EmNoteDetailed.vue
* Create instance.ts
* Update EmNoteDetailed.vue
* wip
* Update EmNoteDetailed.vue
* wip
* wip
* wip
* Update pnpm-lock.yaml
* wip
* wip
* wp
* wip
* Update ClientServerService.ts
* wip
* Update boot.ts
* Update vite.config.local-dev.ts
* Update vite.config.ts
* Create index.html
* wa-
* wip
* Update boot.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Create EmLink.vue
* Create EmMention.vue
* Update EmMfm.ts
* wip
* wip
* wip
* wip
* Update vite.config.ts
* Update boot.ts
* Update EmA.vue
* うぃp
* wip
* wip
* Create EmError.vue
* wip
* Update MkEmbedCodeGenDialog.vue
* Update EmNote.vue
* wip
* wip
* Update user-timeline.vue
* Update check-spdx-license-id.yml
* wip
* wip
* style(frontend-shared): lint fixes on build.js
* fix(frontend-shared): include `*.{js,json}` files in js-built
* wip
* use alias
* refactor
* refactor
* Update scroll.ts
* refactor
* refactor
* refactor
* wip
* wip
* wip
* wip
* Update roles.vue
* Update branding.vue
* wip
* wip
* wip
* Update page.vue
* wip
* fix import
* add missing css variables
* 絵文字をtwemojiに変更
クライアントデフォルトにあわせるため
* force empoll readonly
* fix compiler error
* fix broken imports
* tweak button style
* run api extractor
* fix storybook theme preloads
* fix storybook instance imports
* Update preview.ts
* Update preview.ts
* Update preview.ts
* Revert "Update preview.ts"
This reverts commit 12bab1c6fbd3baf753515df760ff19d027b85155.
* Revert "Update preview.ts"
This reverts commit 5c0ce01dbdf2194ffe94aba950f747a9968f29c4.
* Revert "Update preview.ts"
This reverts commit f4863524d7e5ca0f25470808849c24a72bea000a.
* Revert "fix storybook instance imports"
This reverts commit ed8eabb246edf731d31adffbe3c77c539e53ae9e.
* Revert "wip"
This reverts commit d3c1926519878155193a1654f49141e515d49683.
* Revert "Update page.vue"
This reverts commit 27c7900b0c1ae296b56075e8a9c22585d9cd744b.
* Revert "Update branding.vue"
This reverts commit c08ccb65ba66774c3e2b3dcfc6153004b5c0aa16.
* Revert "Update roles.vue"
This reverts commit 1488b670660cb1803d17d8f5c78f2d79e59fa52d.
* Revert "wip"
This reverts commit aab1c769814b08c257cad3025422a0eea3bfba4f.
* refactor: use common media proxy
* fix imports
* fix
* fix: MediaProxyの初期化を保証する(storybook対策?)
* enhance(frontend-embed): improve embedParams provide
* fix(backend): MK_DEV_PREFER=backendのときにembed viteが読み込めないのを修正
* fix
* embed-pageを共通化
* fix import
* fix import
* fix import
* const.jsを共通化
(たぶんrevertしすぎた)
* fix type error
* fix duplicated import
* fix lint
* fix
* コメントとして残す
* sharedとembedをlint対象にする
* lint
* attempt to fix eslint (frontend-shared)
* lint fixes
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: zyoshoka <107108195+zyoshoka@users.noreply.github.com>
298 lines
13 KiB
Vue
298 lines
13 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<div>
|
|
<MkStickyContainer>
|
|
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
<MkSpacer :contentMax="700">
|
|
<div class="_gaps">
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts._role.baseRole }}</template>
|
|
<div class="_gaps_s">
|
|
<MkInput v-model="baseRoleQ" type="search">
|
|
<template #prefix><i class="ti ti-search"></i></template>
|
|
</MkInput>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.rateLimitFactor, 'rateLimitFactor'])">
|
|
<template #label>{{ i18n.ts._role._options.rateLimitFactor }}</template>
|
|
<template #suffix>{{ Math.floor(policies.rateLimitFactor * 100) }}%</template>
|
|
<MkRange :modelValue="policies.rateLimitFactor * 100" :min="30" :max="300" :step="10" :textConverter="(v) => `${v}%`" @update:modelValue="v => policies.rateLimitFactor = (v / 100)">
|
|
<template #caption>{{ i18n.ts._role._options.descriptionOfRateLimitFactor }}</template>
|
|
</MkRange>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.gtlAvailable, 'gtlAvailable'])">
|
|
<template #label>{{ i18n.ts._role._options.gtlAvailable }}</template>
|
|
<template #suffix>{{ policies.gtlAvailable ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.gtlAvailable">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.ltlAvailable, 'ltlAvailable'])">
|
|
<template #label>{{ i18n.ts._role._options.ltlAvailable }}</template>
|
|
<template #suffix>{{ policies.ltlAvailable ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.ltlAvailable">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canPublicNote, 'canPublicNote'])">
|
|
<template #label>{{ i18n.ts._role._options.canPublicNote }}</template>
|
|
<template #suffix>{{ policies.canPublicNote ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canPublicNote">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.mentionMax, 'mentionLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.mentionMax }}</template>
|
|
<template #suffix>{{ policies.mentionLimit }}</template>
|
|
<MkInput v-model="policies.mentionLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canInvite, 'canInvite'])">
|
|
<template #label>{{ i18n.ts._role._options.canInvite }}</template>
|
|
<template #suffix>{{ policies.canInvite ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canInvite">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.inviteLimit, 'inviteLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.inviteLimit }}</template>
|
|
<template #suffix>{{ policies.inviteLimit }}</template>
|
|
<MkInput v-model="policies.inviteLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.inviteLimitCycle, 'inviteLimitCycle'])">
|
|
<template #label>{{ i18n.ts._role._options.inviteLimitCycle }}</template>
|
|
<template #suffix>{{ policies.inviteLimitCycle + i18n.ts._time.minute }}</template>
|
|
<MkInput v-model="policies.inviteLimitCycle" type="number">
|
|
<template #suffix>{{ i18n.ts._time.minute }}</template>
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.inviteExpirationTime, 'inviteExpirationTime'])">
|
|
<template #label>{{ i18n.ts._role._options.inviteExpirationTime }}</template>
|
|
<template #suffix>{{ policies.inviteExpirationTime + i18n.ts._time.minute }}</template>
|
|
<MkInput v-model="policies.inviteExpirationTime" type="number">
|
|
<template #suffix>{{ i18n.ts._time.minute }}</template>
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canManageAvatarDecorations, 'canManageAvatarDecorations'])">
|
|
<template #label>{{ i18n.ts._role._options.canManageAvatarDecorations }}</template>
|
|
<template #suffix>{{ policies.canManageAvatarDecorations ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canManageAvatarDecorations">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canManageCustomEmojis, 'canManageCustomEmojis'])">
|
|
<template #label>{{ i18n.ts._role._options.canManageCustomEmojis }}</template>
|
|
<template #suffix>{{ policies.canManageCustomEmojis ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canManageCustomEmojis">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canSearchNotes, 'canSearchNotes'])">
|
|
<template #label>{{ i18n.ts._role._options.canSearchNotes }}</template>
|
|
<template #suffix>{{ policies.canSearchNotes ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canSearchNotes">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canUseTranslator, 'canSearchNotes'])">
|
|
<template #label>{{ i18n.ts._role._options.canUseTranslator }}</template>
|
|
<template #suffix>{{ policies.canUseTranslator ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canUseTranslator">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.driveCapacity, 'driveCapacityMb'])">
|
|
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
|
<template #suffix>{{ policies.driveCapacityMb }}MB</template>
|
|
<MkInput v-model="policies.driveCapacityMb" type="number">
|
|
<template #suffix>MB</template>
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.alwaysMarkNsfw, 'alwaysMarkNsfw'])">
|
|
<template #label>{{ i18n.ts._role._options.alwaysMarkNsfw }}</template>
|
|
<template #suffix>{{ policies.alwaysMarkNsfw ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.alwaysMarkNsfw">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canUpdateBioMedia, 'canUpdateBioMedia'])">
|
|
<template #label>{{ i18n.ts._role._options.canUpdateBioMedia }}</template>
|
|
<template #suffix>{{ policies.canUpdateBioMedia ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canUpdateBioMedia">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.pinMax, 'pinLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.pinMax }}</template>
|
|
<template #suffix>{{ policies.pinLimit }}</template>
|
|
<MkInput v-model="policies.pinLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.antennaMax, 'antennaLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.antennaMax }}</template>
|
|
<template #suffix>{{ policies.antennaLimit }}</template>
|
|
<MkInput v-model="policies.antennaLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.wordMuteMax, 'wordMuteLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.wordMuteMax }}</template>
|
|
<template #suffix>{{ policies.wordMuteLimit }}</template>
|
|
<MkInput v-model="policies.wordMuteLimit" type="number">
|
|
<template #suffix>chars</template>
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.webhookMax, 'webhookLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.webhookMax }}</template>
|
|
<template #suffix>{{ policies.webhookLimit }}</template>
|
|
<MkInput v-model="policies.webhookLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.clipMax, 'clipLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.clipMax }}</template>
|
|
<template #suffix>{{ policies.clipLimit }}</template>
|
|
<MkInput v-model="policies.clipLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.noteEachClipsMax, 'noteEachClipsLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.noteEachClipsMax }}</template>
|
|
<template #suffix>{{ policies.noteEachClipsLimit }}</template>
|
|
<MkInput v-model="policies.noteEachClipsLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.userListMax, 'userListLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.userListMax }}</template>
|
|
<template #suffix>{{ policies.userListLimit }}</template>
|
|
<MkInput v-model="policies.userListLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.userEachUserListsMax, 'userEachUserListsLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.userEachUserListsMax }}</template>
|
|
<template #suffix>{{ policies.userEachUserListsLimit }}</template>
|
|
<MkInput v-model="policies.userEachUserListsLimit" type="number">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canHideAds, 'canHideAds'])">
|
|
<template #label>{{ i18n.ts._role._options.canHideAds }}</template>
|
|
<template #suffix>{{ policies.canHideAds ? i18n.ts.yes : i18n.ts.no }}</template>
|
|
<MkSwitch v-model="policies.canHideAds">
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
</MkSwitch>
|
|
</MkFolder>
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.avatarDecorationLimit, 'avatarDecorationLimit'])">
|
|
<template #label>{{ i18n.ts._role._options.avatarDecorationLimit }}</template>
|
|
<template #suffix>{{ policies.avatarDecorationLimit }}</template>
|
|
<MkInput v-model="policies.avatarDecorationLimit" type="number" :min="0">
|
|
</MkInput>
|
|
</MkFolder>
|
|
|
|
<MkButton primary rounded @click="updateBaseRole">{{ i18n.ts.save }}</MkButton>
|
|
</div>
|
|
</MkFolder>
|
|
<MkButton primary rounded @click="create"><i class="ti ti-plus"></i> {{ i18n.ts._role.new }}</MkButton>
|
|
<div class="_gaps_s">
|
|
<MkFoldableSection>
|
|
<template #header>{{ i18n.ts._role.manualRoles }}</template>
|
|
<div class="_gaps_s">
|
|
<MkRolePreview v-for="role in roles.filter(x => x.target === 'manual')" :key="role.id" :role="role" :forModeration="true"/>
|
|
</div>
|
|
</MkFoldableSection>
|
|
<MkFoldableSection>
|
|
<template #header>{{ i18n.ts._role.conditionalRoles }}</template>
|
|
<div class="_gaps_s">
|
|
<MkRolePreview v-for="role in roles.filter(x => x.target === 'conditional')" :key="role.id" :role="role" :forModeration="true"/>
|
|
</div>
|
|
</MkFoldableSection>
|
|
</div>
|
|
</div>
|
|
</MkSpacer>
|
|
</MkStickyContainer>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, reactive, ref } from 'vue';
|
|
import XHeader from './_header_.vue';
|
|
import MkInput from '@/components/MkInput.vue';
|
|
import MkFolder from '@/components/MkFolder.vue';
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
|
import MkButton from '@/components/MkButton.vue';
|
|
import MkRange from '@/components/MkRange.vue';
|
|
import MkRolePreview from '@/components/MkRolePreview.vue';
|
|
import * as os from '@/os.js';
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
|
import { i18n } from '@/i18n.js';
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|
import { instance, fetchInstance } from '@/instance.js';
|
|
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
|
import { ROLE_POLICIES } from '@@/js/const.js';
|
|
import { useRouter } from '@/router/supplier.js';
|
|
|
|
const router = useRouter();
|
|
const baseRoleQ = ref('');
|
|
|
|
const roles = await misskeyApi('admin/roles/list');
|
|
|
|
const policies = reactive<Record<typeof ROLE_POLICIES[number], any>>({});
|
|
for (const ROLE_POLICY of ROLE_POLICIES) {
|
|
policies[ROLE_POLICY] = instance.policies[ROLE_POLICY];
|
|
}
|
|
|
|
function matchQuery(keywords: string[]): boolean {
|
|
if (baseRoleQ.value.trim().length === 0) return true;
|
|
return keywords.some(keyword => keyword.toLowerCase().includes(baseRoleQ.value.toLowerCase()));
|
|
}
|
|
|
|
async function updateBaseRole() {
|
|
await os.apiWithDialog('admin/roles/update-default-policies', {
|
|
policies,
|
|
});
|
|
fetchInstance(true);
|
|
}
|
|
|
|
function create() {
|
|
router.push('/admin/roles/new');
|
|
}
|
|
|
|
const headerActions = computed(() => []);
|
|
|
|
const headerTabs = computed(() => []);
|
|
|
|
definePageMetadata(() => ({
|
|
title: i18n.ts.roles,
|
|
icon: 'ti ti-badges',
|
|
}));
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
|
|
</style>
|