サウンド設定でドライブのファイルを利用可否をロールで制御可能に(デフォルトでオフ)
This commit is contained in:
parent
98f4b69418
commit
90e8b942a3
|
@ -1603,7 +1603,8 @@ _role:
|
||||||
descriptionOfRateLimitFactor: "Lower rate limits are less restrictive, higher ones more restrictive. "
|
descriptionOfRateLimitFactor: "Lower rate limits are less restrictive, higher ones more restrictive. "
|
||||||
canHideAds: "Can hide ads"
|
canHideAds: "Can hide ads"
|
||||||
canSearchNotes: "Usage of note search"
|
canSearchNotes: "Usage of note search"
|
||||||
canUseTranslator: "Translator usage"
|
canUseTranslator: "Can use Translator"
|
||||||
|
canUseDriveFileInSoundSettings: "Can use Drive File in Sound Settings"
|
||||||
_condition:
|
_condition:
|
||||||
isLocal: "Local user"
|
isLocal: "Local user"
|
||||||
isRemote: "Remote user"
|
isRemote: "Remote user"
|
||||||
|
|
1
locales/index.d.ts
vendored
1
locales/index.d.ts
vendored
|
@ -1719,6 +1719,7 @@ export interface Locale {
|
||||||
"canHideAds": string;
|
"canHideAds": string;
|
||||||
"canSearchNotes": string;
|
"canSearchNotes": string;
|
||||||
"canUseTranslator": string;
|
"canUseTranslator": string;
|
||||||
|
"canUseDriveFileInSoundSettings": string;
|
||||||
"avatarDecorationLimit": string;
|
"avatarDecorationLimit": string;
|
||||||
};
|
};
|
||||||
"_condition": {
|
"_condition": {
|
||||||
|
|
|
@ -1628,6 +1628,7 @@ _role:
|
||||||
canHideAds: "広告の非表示"
|
canHideAds: "広告の非表示"
|
||||||
canSearchNotes: "ノート検索の利用"
|
canSearchNotes: "ノート検索の利用"
|
||||||
canUseTranslator: "翻訳機能の利用"
|
canUseTranslator: "翻訳機能の利用"
|
||||||
|
canUseDriveFileInSoundSettings: "サウンド設定でドライブのファイルを利用"
|
||||||
avatarDecorationLimit: "アイコンデコレーションの最大取付個数"
|
avatarDecorationLimit: "アイコンデコレーションの最大取付個数"
|
||||||
_condition:
|
_condition:
|
||||||
isLocal: "ローカルユーザー"
|
isLocal: "ローカルユーザー"
|
||||||
|
|
|
@ -1612,6 +1612,7 @@ _role:
|
||||||
canHideAds: "광고 숨기기"
|
canHideAds: "광고 숨기기"
|
||||||
canSearchNotes: "노트 검색 이용 가능 여부"
|
canSearchNotes: "노트 검색 이용 가능 여부"
|
||||||
canUseTranslator: "번역 기능의 사용"
|
canUseTranslator: "번역 기능의 사용"
|
||||||
|
canUseDriveFileInSoundSettings: "사운드 설정에서 드라이브의 파일 사용 가능 여부"
|
||||||
avatarDecorationLimit: "아바타 장식의 최대 붙임 개수"
|
avatarDecorationLimit: "아바타 장식의 최대 붙임 개수"
|
||||||
_condition:
|
_condition:
|
||||||
isLocal: "로컬 사용자"
|
isLocal: "로컬 사용자"
|
||||||
|
|
|
@ -47,6 +47,7 @@ export type RolePolicies = {
|
||||||
canManageAvatarDecorations: boolean;
|
canManageAvatarDecorations: boolean;
|
||||||
canSearchNotes: boolean;
|
canSearchNotes: boolean;
|
||||||
canUseTranslator: boolean;
|
canUseTranslator: boolean;
|
||||||
|
canUseDriveFileInSoundSettings: boolean;
|
||||||
canHideAds: boolean;
|
canHideAds: boolean;
|
||||||
driveCapacityMb: number;
|
driveCapacityMb: number;
|
||||||
alwaysMarkNsfw: boolean;
|
alwaysMarkNsfw: boolean;
|
||||||
|
@ -77,6 +78,7 @@ export const DEFAULT_POLICIES: RolePolicies = {
|
||||||
canManageAvatarDecorations: false,
|
canManageAvatarDecorations: false,
|
||||||
canSearchNotes: false,
|
canSearchNotes: false,
|
||||||
canUseTranslator: true,
|
canUseTranslator: true,
|
||||||
|
canUseDriveFileInSoundSettings: false,
|
||||||
canHideAds: false,
|
canHideAds: false,
|
||||||
driveCapacityMb: 100,
|
driveCapacityMb: 100,
|
||||||
alwaysMarkNsfw: false,
|
alwaysMarkNsfw: false,
|
||||||
|
@ -341,6 +343,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
||||||
canManageAvatarDecorations: calc('canManageAvatarDecorations', vs => vs.some(v => v === true)),
|
canManageAvatarDecorations: calc('canManageAvatarDecorations', vs => vs.some(v => v === true)),
|
||||||
canSearchNotes: calc('canSearchNotes', vs => vs.some(v => v === true)),
|
canSearchNotes: calc('canSearchNotes', vs => vs.some(v => v === true)),
|
||||||
canUseTranslator: calc('canUseTranslator', vs => vs.some(v => v === true)),
|
canUseTranslator: calc('canUseTranslator', vs => vs.some(v => v === true)),
|
||||||
|
canUseDriveFileInSoundSettings: calc('canUseDriveFileInSoundSettings', vs => vs.some(v => v === true)),
|
||||||
canHideAds: calc('canHideAds', vs => vs.some(v => v === true)),
|
canHideAds: calc('canHideAds', vs => vs.some(v => v === true)),
|
||||||
driveCapacityMb: calc('driveCapacityMb', vs => Math.max(...vs)),
|
driveCapacityMb: calc('driveCapacityMb', vs => Math.max(...vs)),
|
||||||
alwaysMarkNsfw: calc('alwaysMarkNsfw', vs => vs.some(v => v === true)),
|
alwaysMarkNsfw: calc('alwaysMarkNsfw', vs => vs.some(v => v === true)),
|
||||||
|
|
|
@ -144,6 +144,7 @@ export const packedRoleSchema = {
|
||||||
canManageCustomEmojis: rolePolicyValue,
|
canManageCustomEmojis: rolePolicyValue,
|
||||||
userEachUserListsLimit: rolePolicyValue,
|
userEachUserListsLimit: rolePolicyValue,
|
||||||
canManageAvatarDecorations: rolePolicyValue,
|
canManageAvatarDecorations: rolePolicyValue,
|
||||||
|
canUseDriveFileInSoundSettings: rolePolicyValue,
|
||||||
canUseTranslator: rolePolicyValue,
|
canUseTranslator: rolePolicyValue,
|
||||||
avatarDecorationLimit: rolePolicyValue,
|
avatarDecorationLimit: rolePolicyValue,
|
||||||
},
|
},
|
||||||
|
|
|
@ -627,6 +627,10 @@ export const packedMeDetailedOnlySchema = {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
nullable: false, optional: false,
|
||||||
},
|
},
|
||||||
|
canUseDriveFileInSoundSettings: {
|
||||||
|
type: 'boolean',
|
||||||
|
nullable: false, optional: false,
|
||||||
|
},
|
||||||
canHideAds: {
|
canHideAds: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
nullable: false, optional: false,
|
||||||
|
|
|
@ -86,6 +86,7 @@ export const ROLE_POLICIES = [
|
||||||
'canManageAvatarDecorations',
|
'canManageAvatarDecorations',
|
||||||
'canSearchNotes',
|
'canSearchNotes',
|
||||||
'canUseTranslator',
|
'canUseTranslator',
|
||||||
|
'canUseDriveFileInSoundSettings',
|
||||||
'canHideAds',
|
'canHideAds',
|
||||||
'driveCapacityMb',
|
'driveCapacityMb',
|
||||||
'alwaysMarkNsfw',
|
'alwaysMarkNsfw',
|
||||||
|
|
|
@ -379,6 +379,26 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canUseDriveFileInSoundSettings, 'canUseDriveFileInSoundSettings'])">
|
||||||
|
<template #label>{{ i18n.ts._role._options.canUseDriveFileInSoundSettings }}</template>
|
||||||
|
<template #suffix>
|
||||||
|
<span v-if="role.policies.canUseDriveFileInSoundSettings.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
||||||
|
<span v-else>{{ role.policies.canUseDriveFileInSoundSettings.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
||||||
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.canUseDriveFileInSoundSettings)"></i></span>
|
||||||
|
</template>
|
||||||
|
<div class="_gaps">
|
||||||
|
<MkSwitch v-model="role.policies.canUseDriveFileInSoundSettings.useDefault" :readonly="readonly">
|
||||||
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
<MkSwitch v-model="role.policies.canUseDriveFileInSoundSettings.value" :disabled="role.policies.canUseDriveFileInSoundSettings.useDefault" :readonly="readonly">
|
||||||
|
<template #label>{{ i18n.ts.enable }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
<MkRange v-model="role.policies.canUseDriveFileInSoundSettings.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
||||||
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
||||||
|
</MkRange>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder v-if="matchQuery([i18n.ts._role._options.driveCapacity, 'driveCapacityMb'])">
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.driveCapacity, 'driveCapacityMb'])">
|
||||||
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
|
|
|
@ -127,7 +127,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder v-if="matchQuery([i18n.ts._role._options.canUseTranslator, 'canSearchNotes'])">
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canUseTranslator, 'canUseTranslator'])">
|
||||||
<template #label>{{ i18n.ts._role._options.canUseTranslator }}</template>
|
<template #label>{{ i18n.ts._role._options.canUseTranslator }}</template>
|
||||||
<template #suffix>{{ policies.canUseTranslator ? i18n.ts.yes : i18n.ts.no }}</template>
|
<template #suffix>{{ policies.canUseTranslator ? i18n.ts.yes : i18n.ts.no }}</template>
|
||||||
<MkSwitch v-model="policies.canUseTranslator">
|
<MkSwitch v-model="policies.canUseTranslator">
|
||||||
|
@ -135,6 +135,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canUseDriveFileInSoundSettings, 'canUseDriveFileInSoundSettings'])">
|
||||||
|
<template #label>{{ i18n.ts._role._options.canUseDriveFileInSoundSettings }}</template>
|
||||||
|
<template #suffix>{{ policies.canUseDriveFileInSoundSettings ? i18n.ts.yes : i18n.ts.no }}</template>
|
||||||
|
<MkSwitch v-model="policies.canUseDriveFileInSoundSettings">
|
||||||
|
<template #label>{{ i18n.ts.enable }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder v-if="matchQuery([i18n.ts._role._options.driveCapacity, 'driveCapacityMb'])">
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.driveCapacity, 'driveCapacityMb'])">
|
||||||
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
||||||
<template #suffix>{{ policies.driveCapacityMb }}MB</template>
|
<template #suffix>{{ policies.driveCapacityMb }}MB</template>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import type { SoundStore } from '@/store.js';
|
import type { SoundStore } from '@/store.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
|
import { $i } from "@/account.js";
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
|
||||||
let ctx: AudioContext;
|
let ctx: AudioContext;
|
||||||
|
@ -16,7 +17,7 @@ export const soundsTypes = [
|
||||||
null,
|
null,
|
||||||
|
|
||||||
// ドライブの音声
|
// ドライブの音声
|
||||||
'_driveFile_',
|
...($i?.policies.canUseDriveFileInSoundSettings ? ['_driveFile_'] : []),
|
||||||
|
|
||||||
// プリインストール
|
// プリインストール
|
||||||
'syuilo/n-aec',
|
'syuilo/n-aec',
|
||||||
|
@ -156,7 +157,7 @@ export type OperationType = typeof operationTypes[number];
|
||||||
export async function loadAudio(soundStore: SoundStore, options?: { useCache?: boolean; }) {
|
export async function loadAudio(soundStore: SoundStore, options?: { useCache?: boolean; }) {
|
||||||
if (_DEV_) console.log('loading audio. opts:', options);
|
if (_DEV_) console.log('loading audio. opts:', options);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) {
|
if (soundStore.type === null || (soundStore.type === '_driveFile_' && (!$i?.policies.canUseDriveFileInSoundSettings || !soundStore.fileUrl))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.0-io
|
* version: 2023.12.0-io
|
||||||
* generatedAt: 2023-12-23T11:38:40.306Z
|
* generatedAt: 2023-12-27T00:51:15.041Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3698,6 +3698,7 @@ export type components = {
|
||||||
canManageAvatarDecorations: boolean;
|
canManageAvatarDecorations: boolean;
|
||||||
canSearchNotes: boolean;
|
canSearchNotes: boolean;
|
||||||
canUseTranslator: boolean;
|
canUseTranslator: boolean;
|
||||||
|
canUseDriveFileInSoundSettings: boolean;
|
||||||
canHideAds: boolean;
|
canHideAds: boolean;
|
||||||
driveCapacityMb: number;
|
driveCapacityMb: number;
|
||||||
alwaysMarkNsfw: boolean;
|
alwaysMarkNsfw: boolean;
|
||||||
|
@ -4448,6 +4449,11 @@ export type components = {
|
||||||
priority: number;
|
priority: number;
|
||||||
useDefault: boolean;
|
useDefault: boolean;
|
||||||
};
|
};
|
||||||
|
canUseDriveFileInSoundSettings: {
|
||||||
|
value: number | boolean;
|
||||||
|
priority: number;
|
||||||
|
useDefault: boolean;
|
||||||
|
};
|
||||||
canUseTranslator: {
|
canUseTranslator: {
|
||||||
value: number | boolean;
|
value: number | boolean;
|
||||||
priority: number;
|
priority: number;
|
||||||
|
|
Loading…
Reference in a new issue