feat: vacation mode & hide counters

This commit is contained in:
オスカー、 2024-08-28 00:23:50 +09:00
parent c2a7ae59e8
commit fa0e7f6413
Signed by: SWREI
GPG Key ID: 139D6573F92DA9F7
19 changed files with 314 additions and 95 deletions

View File

@ -763,6 +763,7 @@ contact: "Contact"
useSystemFont: "Use the system's default font" useSystemFont: "Use the system's default font"
clips: "Clips" clips: "Clips"
experimentalFeatures: "Experimental features" experimentalFeatures: "Experimental features"
misskeyExperimentalFeatures: "Misskey's experimental features"
experimental: "Experimental" experimental: "Experimental"
thisIsExperimentalFeature: "This is an experimental feature. Its functionality is subject to change, and it may not operate as intended." thisIsExperimentalFeature: "This is an experimental feature. Its functionality is subject to change, and it may not operate as intended."
developer: "Developer" developer: "Developer"

36
locales/index.d.ts vendored
View File

@ -3076,6 +3076,10 @@ export interface Locale extends ILocale {
* *
*/ */
"experimentalFeatures": string; "experimentalFeatures": string;
/**
* Misskeyの実験的機能
*/
"misskeyExperimentalFeatures": string;
/** /**
* *
*/ */
@ -5179,6 +5183,38 @@ export interface Locale extends ILocale {
* *
*/ */
"saveThisFile": string; "saveThisFile": string;
/**
*
*/
"vacationMode": string;
/**
* , .
*/
"vacationModeDescription": string;
/**
*
*/
"useVacationMode": string;
/**
*
*/
"mindControl": string;
/**
* , Misskey에서 .
*/
"mindControlDescription": string;
/**
*
*/
"hideCounters": string;
/**
* , , .
*/
"hideCountersDescription": string;
/**
* . .
*/
"youAreOnVacation": string;
"_bubbleGame": { "_bubbleGame": {
/** /**
* *

View File

@ -765,6 +765,7 @@ contact: "連絡先"
useSystemFont: "システムのデフォルトのフォントを使う" useSystemFont: "システムのデフォルトのフォントを使う"
clips: "クリップ" clips: "クリップ"
experimentalFeatures: "実験的機能" experimentalFeatures: "実験的機能"
misskeyExperimentalFeatures: "Misskeyの実験的機能"
experimental: "実験的" experimental: "実験的"
thisIsExperimentalFeature: "これは実験的な機能です。仕様が変更されたり、正常に動作しなかったりする可能性があります。" thisIsExperimentalFeature: "これは実験的な機能です。仕様が変更されたり、正常に動作しなかったりする可能性があります。"
developer: "開発者" developer: "開発者"
@ -1290,6 +1291,14 @@ areYouSureToRemoveAllFollowings: "本当に{host}とのすべてのフォロー
mutualLink: "相互リンク" mutualLink: "相互リンク"
youNeedToEnableTwoFactor: "モデレーター権限を利用するには、まず二要素認証を有効にする必要があります。" youNeedToEnableTwoFactor: "モデレーター権限を利用するには、まず二要素認証を有効にする必要があります。"
saveThisFile: "このファイルをドライブに保存する" saveThisFile: "このファイルをドライブに保存する"
vacationMode: "휴가 모드"
vacationModeDescription: "휴가 모드는, 관리자가 잠시 직무를 내려놓고 일반 유저로 이용할 수 있도록 임시로 권한을 제거하는 모드입니다."
useVacationMode: "휴가 모드를 사용하기"
mindControl: "인터넷과 잠시 거리두기"
mindControlDescription: "필요한 경우, Misskey에서 피로감을 덜 느끼도록 몇 가지 설정을 조정할 수 있습니다."
hideCounters: "모든 카운터를 가리기"
hideCountersDescription: "유저 페이지의 노트, 팔로잉, 팔로워 수 및 이러한 통계를 모두 숨깁니다."
youAreOnVacation: "현재 휴가 모드를 사용 중입니다. 이 메시지를 닫으려면 여기를 클릭하세요."
_bubbleGame: _bubbleGame:
howToPlay: "遊び方" howToPlay: "遊び方"

View File

@ -762,6 +762,7 @@ contact: "연락처"
useSystemFont: "시스템 기본 글꼴을 사용" useSystemFont: "시스템 기본 글꼴을 사용"
clips: "클립" clips: "클립"
experimentalFeatures: "실험실" experimentalFeatures: "실험실"
misskeyExperimentalFeatures: "Misskey 실험실"
experimental: "실험실" experimental: "실험실"
thisIsExperimentalFeature: "이 기능은 실험적인 기능입니다. 사양이 변경되거나 정상적으로 동작하지 않을 가능성이 있습니다." thisIsExperimentalFeature: "이 기능은 실험적인 기능입니다. 사양이 변경되거나 정상적으로 동작하지 않을 가능성이 있습니다."
developer: "개발자" developer: "개발자"
@ -1275,6 +1276,14 @@ areYouSureToRemoveAllFollowings: "정말로 {host}와의 모든 팔로우 관계
mutualLink: "서로링크" mutualLink: "서로링크"
youNeedToEnableTwoFactor: "관리 권한을 이용하려면 먼저 2단계 인증을 활성화해야 합니다." youNeedToEnableTwoFactor: "관리 권한을 이용하려면 먼저 2단계 인증을 활성화해야 합니다."
saveThisFile: "이 파일을 드라이브에 저장" saveThisFile: "이 파일을 드라이브에 저장"
vacationMode: "휴가 모드"
vacationModeDescription: "휴가 모드는, 관리자가 잠시 직무를 내려놓고 일반 유저로 이용할 수 있도록 임시로 권한을 제거하는 모드입니다."
useVacationMode: "휴가 모드를 사용하기"
mindControl: "인터넷과 잠시 거리두기"
mindControlDescription: "필요한 경우, Misskey에서 피로감을 덜 느끼도록 몇 가지 설정을 조정할 수 있습니다."
hideCounters: "모든 카운터를 가리기"
hideCountersDescription: "유저 페이지의 노트, 팔로잉, 팔로워 수 및 이러한 통계를 모두 숨깁니다."
youAreOnVacation: "현재 휴가 모드를 사용 중입니다. 이 메시지를 닫으려면 여기를 클릭하세요."
_bubbleGame: _bubbleGame:
howToPlay: "설명" howToPlay: "설명"
hold: "홀드" hold: "홀드"

View File

@ -412,11 +412,13 @@ export class UserEntityService implements OnModuleInit {
}, options); }, options);
const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src }); const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });
const meObject = await this.usersRepository.findOneByOrFail({ id: me?.id });
const meProfile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
const isDetailed = opts.schema !== 'UserLite'; const isDetailed = opts.schema !== 'UserLite';
const meId = me ? me.id : null; const meId = me ? me.id : null;
const isMe = meId === user.id; const isMe = meId === user.id;
const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false; const iAmModerator = me ? (await this.roleService.isModerator(me as MiUser)) && !meObject.isVacation && meProfile.twoFactorEnabled : false;
if (user.isSuspended && !iAmModerator) throw new IdentifiableError('85ab9bd7-3a41-4530-959d-f07073900109', `User ${user.id} has been suspended.`); if (user.isSuspended && !iAmModerator) throw new IdentifiableError('85ab9bd7-3a41-4530-959d-f07073900109', `User ${user.id} has been suspended.`);
const profile = isDetailed const profile = isDetailed

View File

@ -481,6 +481,10 @@ export const packedMeDetailedOnlySchema = {
type: 'boolean', type: 'boolean',
nullable: true, optional: false, nullable: true, optional: false,
}, },
isVacation: {
type: 'boolean',
nullable: true, optional: false,
},
injectFeaturedNote: { injectFeaturedNote: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false, nullable: false, optional: false,

View File

@ -310,7 +310,7 @@ export class ApiCallService implements OnApplicationShutdown {
} }
} }
if ((ep.meta.requireModerator || ep.meta.requireAdmin) && !user!.isRoot) { if (ep.meta.requireModerator || ep.meta.requireAdmin) {
const myRoles = await this.roleService.getUserRoles(user!.id); const myRoles = await this.roleService.getUserRoles(user!.id);
const isModerator = myRoles.some(r => r.isModerator || r.isAdministrator); const isModerator = myRoles.some(r => r.isModerator || r.isAdministrator);
const isAdmin = myRoles.some(r => r.isAdministrator); const isAdmin = myRoles.some(r => r.isAdministrator);
@ -324,6 +324,14 @@ export class ApiCallService implements OnApplicationShutdown {
id: 'abce13fe-1d9f-4e85-8f00-4a5251155470', id: 'abce13fe-1d9f-4e85-8f00-4a5251155470',
}); });
} }
if (user?.isVacation) {
throw new ApiError({
message: 'You are on vacation.',
code: 'VACATION_MODE',
kind: 'permission',
id: 'bbe5ef78-fab6-46a2-9e29-64639747096c',
});
}
if (ep.meta.requireModerator && !isModerator) { if (ep.meta.requireModerator && !isModerator) {
throw new ApiError({ throw new ApiError({
message: 'You are not assigned to a proper role.', message: 'You are not assigned to a proper role.',

View File

@ -28,12 +28,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
constructor( constructor(
private cacheService: CacheService, private cacheService: CacheService,
private apDbResolverService: ApDbResolverService, private apDbResolverService: ApDbResolverService,
private authenticateService: AuthenticateService,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
this.cacheService.dispose(); this.cacheService.dispose();
this.apDbResolverService.dispose(); this.apDbResolverService.dispose();
this.authenticateService.dispose()
}); });
} }
} }

View File

@ -187,6 +187,7 @@ export const paramDef = {
preventAiLearning: { type: 'boolean' }, preventAiLearning: { type: 'boolean' },
isBot: { type: 'boolean' }, isBot: { type: 'boolean' },
isCat: { type: 'boolean' }, isCat: { type: 'boolean' },
isVacation: { type: 'boolean' },
injectFeaturedNote: { type: 'boolean' }, injectFeaturedNote: { type: 'boolean' },
receiveAnnouncementEmail: { type: 'boolean' }, receiveAnnouncementEmail: { type: 'boolean' },
alwaysMarkNsfw: { type: 'boolean' }, alwaysMarkNsfw: { type: 'boolean' },
@ -341,6 +342,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (typeof ps.noCrawle === 'boolean') profileUpdates.noCrawle = ps.noCrawle; if (typeof ps.noCrawle === 'boolean') profileUpdates.noCrawle = ps.noCrawle;
if (typeof ps.preventAiLearning === 'boolean') profileUpdates.preventAiLearning = ps.preventAiLearning; if (typeof ps.preventAiLearning === 'boolean') profileUpdates.preventAiLearning = ps.preventAiLearning;
if (typeof ps.isCat === 'boolean') updates.isCat = ps.isCat; if (typeof ps.isCat === 'boolean') updates.isCat = ps.isCat;
if (typeof ps.isVacation === 'boolean') updates.isVacation = ps.isVacation;
if (typeof ps.injectFeaturedNote === 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote; if (typeof ps.injectFeaturedNote === 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote;
if (typeof ps.receiveAnnouncementEmail === 'boolean') profileUpdates.receiveAnnouncementEmail = ps.receiveAnnouncementEmail; if (typeof ps.receiveAnnouncementEmail === 'boolean') profileUpdates.receiveAnnouncementEmail = ps.receiveAnnouncementEmail;
if (typeof ps.alwaysMarkNsfw === 'boolean') { if (typeof ps.alwaysMarkNsfw === 'boolean') {

View File

@ -24,8 +24,8 @@ const accountData = miLocalStorage.getItem('account');
// TODO: 外部からはreadonlyに // TODO: 外部からはreadonlyに
export const $i = accountData ? reactive(JSON.parse(accountData) as Account) : null; export const $i = accountData ? reactive(JSON.parse(accountData) as Account) : null;
export const iAmModerator = $i != null && ($i.isAdmin === true || $i.isModerator === true) && $i.twoFactorEnabled; export const iAmModerator = $i != null && ($i.isAdmin === true || $i.isModerator === true) && $i.twoFactorEnabled && !$i.isVacation;
export const iAmAdmin = $i != null && $i.isAdmin && $i.twoFactorEnabled; export const iAmAdmin = $i != null && $i.isAdmin && $i.twoFactorEnabled && !$i.isVacation;
export function signinRequired() { export function signinRequired() {
if ($i == null) throw new Error('signin required'); if ($i == null) throw new Error('signin required');

View File

@ -216,53 +216,6 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
</FormSection> </FormSection>
<FormSection>
<template #label>{{ i18n.ts.hideSensitiveInformation }}</template>
<div class="_gaps_m">
<MkSwitch v-model="privateMode">
{{ i18n.ts._hideSensitiveInformation.use }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.about }}</template>
</MkSwitch>
<MkFolder v-if="privateMode">
<template #label>{{ i18n.ts._hideSensitiveInformation.directMessages }}</template>
<template v-if="hideDirectMessages" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideDirectMessages">
{{ i18n.ts._hideSensitiveInformation.directMessagesUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.directMessagesDescription }}</template>
</MkSwitch>
</MkFolder>
<MkFolder v-if="privateMode">
<template #label>{{ i18n.ts._hideSensitiveInformation.drive }}</template>
<template v-if="hideDriveFileList" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideDriveFileList">
{{ i18n.ts._hideSensitiveInformation.driveUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.driveDescription }}</template>
</MkSwitch>
</MkFolder>
<MkFolder v-if="privateMode && iAmModerator">
<template #label>{{ i18n.ts._hideSensitiveInformation.moderationLog }}</template>
<template v-if="hideModerationLog" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideModerationLog">
{{ i18n.ts._hideSensitiveInformation.moderationLogUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.moderationLogDescription }}</template>
</MkSwitch>
</MkFolder>
<MkFolder v-if="privateMode && iAmModerator">
<template #label>{{ i18n.ts._hideSensitiveInformation.roles }}</template>
<template v-if="hideRoleList" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideRoleList">
{{ i18n.ts._hideSensitiveInformation.rolesUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.rolesDescription }}</template>
</MkSwitch>
</MkFolder>
</div>
</FormSection>
<FormSection> <FormSection>
<template #label>{{ i18n.ts.other }}</template> <template #label>{{ i18n.ts.other }}</template>
@ -370,11 +323,6 @@ const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHori
const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer')); const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer'));
const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow')); const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow'));
const sensitiveDoubleClickRequired = computed(defaultStore.makeGetterSetter('sensitiveDoubleClickRequired')); const sensitiveDoubleClickRequired = computed(defaultStore.makeGetterSetter('sensitiveDoubleClickRequired'));
const privateMode = computed(defaultStore.makeGetterSetter('privateMode'));
const hideDirectMessages = computed(defaultStore.makeGetterSetter('hideDirectMessages'));
const hideDriveFileList = computed(defaultStore.makeGetterSetter('hideDriveFileList'));
const hideModerationLog = computed(defaultStore.makeGetterSetter('hideModerationLog'));
const hideRoleList = computed(defaultStore.makeGetterSetter('hideRoleList'));
watch(lang, () => { watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string); miLocalStorage.setItem('lang', lang.value as string);
@ -418,11 +366,6 @@ watch([
disableStreamingTimeline, disableStreamingTimeline,
enableSeasonalScreenEffect, enableSeasonalScreenEffect,
alwaysConfirmFollow, alwaysConfirmFollow,
privateMode,
hideDirectMessages,
hideDriveFileList,
hideModerationLog,
hideRoleList,
], async () => { ], async () => {
await reloadAsk(); await reloadAsk();
}); });

View File

@ -163,6 +163,11 @@ const menuDef = computed(() => [{
text: `${i18n.ts.accountMigration}`, text: `${i18n.ts.accountMigration}`,
to: '/settings/migration', to: '/settings/migration',
active: currentPage.value?.route.name === 'migration', active: currentPage.value?.route.name === 'migration',
}, {
icon: 'ti ti-barrier-block',
text: i18n.ts.experimentalFeatures,
to: '/settings/laboratory',
active: currentPage.value?.route.name === 'laboratory',
}, { }, {
icon: 'ti ti-dots', icon: 'ti ti-dots',
text: i18n.ts.other, text: i18n.ts.other,

View File

@ -0,0 +1,203 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div class="_gaps_m">
<MkFolder>
<template #icon><i class="ti ti-flask"></i></template>
<template #label>{{ i18n.ts.misskeyExperimentalFeatures }}</template>
<div class="_gaps_m">
<MkSwitch v-model="enableCondensedLineForAcct">
<template #label>Enable condensed line for acct</template>
</MkSwitch>
</div>
</MkFolder>
<FormSection>
<template #label><i class="ti ti-lock-access"></i> {{ i18n.ts.hideSensitiveInformation }}</template>
<template #description>{{ i18n.ts._hideSensitiveInformation.about }}</template>
<div class="_gaps_m">
<MkInfo warn rounded>
{{ i18n.ts.thisIsExperimentalFeature }}
</MkInfo>
<MkSwitch v-model="privateMode">
{{ i18n.ts._hideSensitiveInformation.use }}
</MkSwitch>
<MkFolder v-if="privateMode">
<template #label>{{ i18n.ts._hideSensitiveInformation.directMessages }}</template>
<template v-if="hideDirectMessages" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideDirectMessages">
{{ i18n.ts._hideSensitiveInformation.directMessagesUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.directMessagesDescription }}</template>
</MkSwitch>
</MkFolder>
<MkFolder v-if="privateMode">
<template #label>{{ i18n.ts._hideSensitiveInformation.drive }}</template>
<template v-if="hideDriveFileList" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideDriveFileList">
{{ i18n.ts._hideSensitiveInformation.driveUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.driveDescription }}</template>
</MkSwitch>
</MkFolder>
<MkFolder v-if="privateMode && iAmModerator">
<template #label>{{ i18n.ts._hideSensitiveInformation.moderationLog }}</template>
<template v-if="hideModerationLog" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideModerationLog">
{{ i18n.ts._hideSensitiveInformation.moderationLogUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.moderationLogDescription }}</template>
</MkSwitch>
</MkFolder>
<MkFolder v-if="privateMode && iAmModerator">
<template #label>{{ i18n.ts._hideSensitiveInformation.roles }}</template>
<template v-if="hideRoleList" #suffix>{{ i18n.ts._hideSensitiveInformation.itsHidden }}</template>
<template v-else #suffix>{{ i18n.ts._hideSensitiveInformation.itsNotHidden }}</template>
<MkSwitch v-model="hideRoleList">
{{ i18n.ts._hideSensitiveInformation.rolesUse }}
<template #caption>{{ i18n.ts._hideSensitiveInformation.rolesDescription }}</template>
</MkSwitch>
</MkFolder>
</div>
</FormSection>
<FormSection v-if="$i.isModerator">
<template #label><i class="ti ti-beach"></i> {{ i18n.ts.vacationMode }}</template>
<template #description>{{ i18n.ts.vacationModeDescription }}</template>
<div class="_gaps_m">
<MkInfo warn rounded>
{{ i18n.ts.thisIsExperimentalFeature }}
</MkInfo>
<MkSwitch v-model="isVacation" @update:modelValue="save()">
{{ i18n.ts.useVacationMode }}
</MkSwitch>
</div>
</FormSection>
<FormSection>
<template #label><i class="ti ti-globe-off"></i> {{ i18n.ts.mindControl }}</template>
<template #description></template>
<div class="_gaps_m">
<MkInfo warn rounded>
{{ i18n.ts.thisIsExperimentalFeature }}
</MkInfo>
<MkSwitch v-model="hideCounters">
{{ i18n.ts.hideCounters }}
<template #caption>{{ i18n.ts.hideCountersDescription }}</template>
</MkSwitch>
</div>
</FormSection>
<!--
<MkSelect v-model="followingVisibility" @update:modelValue="save()">
<template #label>{{ i18n.ts.followingVisibility }}</template>
<option value="public">{{ i18n.ts._ffVisibility.public }}</option>
<option value="followers">{{ i18n.ts._ffVisibility.followers }}</option>
<option value="private">{{ i18n.ts._ffVisibility.private }}</option>
</MkSelect>
<MkSelect v-model="followersVisibility" @update:modelValue="save()">
<template #label>{{ i18n.ts.followersVisibility }}</template>
<option value="public">{{ i18n.ts._ffVisibility.public }}</option>
<option value="followers">{{ i18n.ts._ffVisibility.followers }}</option>
<option value="private">{{ i18n.ts._ffVisibility.private }}</option>
</MkSelect>
<MkSwitch v-model="hideOnlineStatus" @update:modelValue="save()">
{{ i18n.ts.hideOnlineStatus }}
<template #caption>{{ i18n.ts.hideOnlineStatusDescription }}</template>
</MkSwitch>
<MkSwitch v-model="noCrawle" @update:modelValue="save()">
{{ i18n.ts.noCrawle }}
<template #caption>{{ i18n.ts.noCrawleDescription }}</template>
</MkSwitch>
<MkSwitch v-model="preventAiLearning" @update:modelValue="save()">
{{ i18n.ts.preventAiLearning }}<span class="_beta">{{ i18n.ts.beta }}</span>
<template #caption>{{ i18n.ts.preventAiLearningDescription }}</template>
</MkSwitch>
<MkSwitch v-model="isExplorable" @update:modelValue="save()">
{{ i18n.ts.makeExplorable }}
<template #caption>{{ i18n.ts.makeExplorableDescription }}</template>
</MkSwitch>
-->
</div>
</template>
<script lang="ts" setup>
import { ref, computed, watch } from 'vue';
import MkSwitch from '@/components/MkSwitch.vue';
// import MkSelect from '@/components/MkSelect.vue';
import FormSection from '@/components/form/section.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkInfo from '@/components/MkInfo.vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { iAmModerator, signinRequired } from '@/account.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { defaultStore } from "@/store.js";
import * as os from "@/os.js";
import { unisonReload } from "@/scripts/unison-reload.js";
const $i = signinRequired();
const isVacation = ref<boolean | undefined>($i.isVacation !== null ? $i.isVacation : undefined);
const hideCounters = computed(defaultStore.makeGetterSetter('hideCounters'));
const enableCondensedLineForAcct = computed(defaultStore.makeGetterSetter('enableCondensedLineForAcct'));
const privateMode = computed(defaultStore.makeGetterSetter('privateMode'));
const hideDirectMessages = computed(defaultStore.makeGetterSetter('hideDirectMessages'));
const hideDriveFileList = computed(defaultStore.makeGetterSetter('hideDriveFileList'));
const hideModerationLog = computed(defaultStore.makeGetterSetter('hideModerationLog'));
const hideRoleList = computed(defaultStore.makeGetterSetter('hideRoleList'));
function save() {
if (isVacation.value === true) {
defaultStore.set('vacationAlert', true);
}
misskeyApi('i/update', {
isVacation: isVacation.value,
});
}
async function reloadAsk() {
const { canceled } = await os.confirm({
type: 'info',
text: i18n.ts.reloadToApplySetting,
});
if (canceled) return;
unisonReload();
}
watch([
isVacation,
enableCondensedLineForAcct,
privateMode,
hideCounters,
hideDirectMessages,
hideDriveFileList,
hideRoleList,
hideModerationLog,
], async () => {
await reloadAsk();
});
const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(() => ({
title: i18n.ts.experimentalFeatures,
icon: 'ti ti-barrier-block',
}));
</script>

View File

@ -51,17 +51,6 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
</MkFolder> </MkFolder>
<MkFolder>
<template #icon><i class="ti ti-flask"></i></template>
<template #label>{{ i18n.ts.experimentalFeatures }}</template>
<div class="_gaps_m">
<MkSwitch v-model="enableCondensedLineForAcct">
<template #label>Enable condensed line for acct</template>
</MkSwitch>
</div>
</MkFolder>
<MkFolder> <MkFolder>
<template #icon><i class="ti ti-code"></i></template> <template #icon><i class="ti ti-code"></i></template>
<template #label>{{ i18n.ts.developer }}</template> <template #label>{{ i18n.ts.developer }}</template>
@ -90,7 +79,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, watch } from 'vue'; import { computed } from 'vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import FormLink from '@/components/form/link.vue'; import FormLink from '@/components/form/link.vue';
import MkFolder from '@/components/MkFolder.vue'; import MkFolder from '@/components/MkFolder.vue';
@ -109,7 +98,6 @@ import FormSection from '@/components/form/section.vue';
const $i = signinRequired(); const $i = signinRequired();
// const reportError = computed(defaultStore.makeGetterSetter('reportError')); // const reportError = computed(defaultStore.makeGetterSetter('reportError'));
const enableCondensedLineForAcct = computed(defaultStore.makeGetterSetter('enableCondensedLineForAcct'));
const devMode = computed(defaultStore.makeGetterSetter('devMode')); const devMode = computed(defaultStore.makeGetterSetter('devMode'));
const defaultWithReplies = computed(defaultStore.makeGetterSetter('defaultWithReplies')); const defaultWithReplies = computed(defaultStore.makeGetterSetter('defaultWithReplies'));
@ -137,16 +125,6 @@ async function deleteAccount() {
await signout(); await signout();
} }
async function reloadAsk() {
const { canceled } = await os.confirm({
type: 'info',
text: i18n.ts.reloadToApplySetting,
});
if (canceled) return;
unisonReload();
}
async function updateRepliesAll(withReplies: boolean) { async function updateRepliesAll(withReplies: boolean) {
const { canceled } = await os.confirm({ const { canceled } = await os.confirm({
type: 'warning', type: 'warning',
@ -157,12 +135,6 @@ async function updateRepliesAll(withReplies: boolean) {
misskeyApi('following/update-all', { withReplies }); misskeyApi('following/update-all', { withReplies });
} }
watch([
enableCondensedLineForAcct,
], async () => {
await reloadAsk();
});
const headerActions = computed(() => []); const headerActions = computed(() => []);
const headerTabs = computed(() => []); const headerTabs = computed(() => []);

View File

@ -168,7 +168,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</dl> </dl>
</div> </div>
<div class="status"> <div class="status" v-if="!hideCounters">
<MkA :to="userPage(user)"> <MkA :to="userPage(user)">
<b>{{ number(user.notesCount) }}</b> <b>{{ number(user.notesCount) }}</b>
<span>{{ i18n.ts.notes }}</span> <span>{{ i18n.ts.notes }}</span>
@ -207,7 +207,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;"> <div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;">
<XFiles :key="user.id" :user="user"/> <XFiles :key="user.id" :user="user"/>
<XActivity :key="user.id" :user="user"/> <XActivity v-if="!hideCounters" :key="user.id" :user="user"/>
</div> </div>
</div> </div>
</MkSpacer> </MkSpacer>
@ -284,6 +284,7 @@ const editModerationNote = ref(false);
const hideModerationNote = !iAmModerator || (defaultStore.state.privateMode && defaultStore.state.hideModerationLog); const hideModerationNote = !iAmModerator || (defaultStore.state.privateMode && defaultStore.state.hideModerationLog);
const hideRoleList = defaultStore.state.privateMode && defaultStore.state.hideRoleList; const hideRoleList = defaultStore.state.privateMode && defaultStore.state.hideRoleList;
const hideCounters = defaultStore.reactiveState.hideCounters;
watch(moderationNote, async () => { watch(moderationNote, async () => {
await misskeyApi('admin/update-user-note', { userId: props.user.id, text: moderationNote.value }); await misskeyApi('admin/update-user-note', { userId: props.user.id, text: moderationNote.value });

View File

@ -176,6 +176,10 @@ const routes: RouteDef[] = [{
path: '/accounts', path: '/accounts',
name: 'profile', name: 'profile',
component: page(() => import('@/pages/settings/accounts.vue')), component: page(() => import('@/pages/settings/accounts.vue')),
}, {
path: '/laboratory',
name: 'laboratory',
component: page(() => import('@/pages/settings/laboratory.vue')),
}, { }, {
path: '/account-stats', path: '/account-stats',
name: 'other', name: 'other',

View File

@ -156,6 +156,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'deviceAccount', where: 'deviceAccount',
default: false, default: false,
}, },
vacationAlert: {
where: 'deviceAccount',
default: true,
},
privateMode: { privateMode: {
where: 'device', where: 'device',
default: false, default: false,
@ -176,6 +180,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device', where: 'device',
default: false, default: false,
}, },
hideCounters: {
where: 'device',
default: false,
},
showPreview: { showPreview: {
where: 'device', where: 'device',
default: false, default: false,

View File

@ -25,10 +25,16 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkA> </MkA>
<MkA v-if="($i?.isModerator ?? $i?.isAdmin) && !$i?.twoFactorEnabled" :class="$style.item" to="/settings/security"> <MkA v-if="($i?.isModerator ?? $i?.isAdmin) && !$i?.twoFactorEnabled" :class="$style.item" to="/settings/security">
<span :class="$style.icon"> <span :class="$style.icon">
<i class="ti ti-circle-key" style="color: var(--error);"></i> <i class="ti ti-circle-key"></i>
</span> </span>
<span :class="$style.title">{{ i18n.ts.youNeedToEnableTwoFactor }}</span> <span :class="$style.title">{{ i18n.ts.youNeedToEnableTwoFactor }}</span>
</MkA> </MkA>
<MkA v-if="($i?.isModerator ?? $i?.isAdmin) && $i?.isVacation && showVacationAlert" :class="$style.item" @click.prevent.stop="removeThisAnnouncement()">
<span :class="$style.icon">
<i class="ti ti-sandbox"></i>
</span>
<span :class="$style.title">{{ i18n.ts.youAreOnVacation }}</span>
</MkA>
<MkA <MkA
v-for="announcement in $i?.unreadAnnouncements.filter(x => x.display === 'banner')" v-for="announcement in $i?.unreadAnnouncements.filter(x => x.display === 'banner')"
:key="announcement.id" :key="announcement.id"
@ -52,10 +58,16 @@ import { ref } from 'vue';
import { instanceName } from '@/config.js'; import { instanceName } from '@/config.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { $i, iAmModerator } from '@/account.js'; import { $i, iAmModerator } from '@/account.js';
import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
const unresolvedReportCount = ref<number>(0); const unresolvedReportCount = ref<number>(0);
const showVacationAlert = defaultStore.reactiveState.vacationAlert;
function removeThisAnnouncement(): void {
defaultStore.set('vacationAlert', false);
}
if (iAmModerator) { if (iAmModerator) {
misskeyApi('admin/abuse-user-reports', { misskeyApi('admin/abuse-user-reports', {

View File

@ -3886,6 +3886,7 @@ export type components = {
isModerator: boolean | null; isModerator: boolean | null;
isAdmin: boolean | null; isAdmin: boolean | null;
isRoot: boolean | null; isRoot: boolean | null;
isVacation: boolean | null;
injectFeaturedNote: boolean; injectFeaturedNote: boolean;
receiveAnnouncementEmail: boolean; receiveAnnouncementEmail: boolean;
alwaysMarkNsfw: boolean; alwaysMarkNsfw: boolean;
@ -20210,6 +20211,7 @@ export type operations = {
preventAiLearning?: boolean; preventAiLearning?: boolean;
isBot?: boolean; isBot?: boolean;
isCat?: boolean; isCat?: boolean;
isVacation?: boolean;
injectFeaturedNote?: boolean; injectFeaturedNote?: boolean;
receiveAnnouncementEmail?: boolean; receiveAnnouncementEmail?: boolean;
alwaysMarkNsfw?: boolean; alwaysMarkNsfw?: boolean;