forked from mirror/misskey
enhance(frontend): improve forms usability
This commit is contained in:
parent
2c615357f2
commit
1ba09e1eee
12
locales/index.d.ts
vendored
12
locales/index.d.ts
vendored
@ -5096,6 +5096,18 @@ export interface Locale extends ILocale {
|
|||||||
* パフォーマンス
|
* パフォーマンス
|
||||||
*/
|
*/
|
||||||
"performance": string;
|
"performance": string;
|
||||||
|
/**
|
||||||
|
* 変更あり
|
||||||
|
*/
|
||||||
|
"modified": string;
|
||||||
|
/**
|
||||||
|
* 破棄
|
||||||
|
*/
|
||||||
|
"discard": string;
|
||||||
|
/**
|
||||||
|
* {n}件の変更があります
|
||||||
|
*/
|
||||||
|
"thereAreNChanges": ParameterizedString<"n">;
|
||||||
"_delivery": {
|
"_delivery": {
|
||||||
/**
|
/**
|
||||||
* 配信状態
|
* 配信状態
|
||||||
|
@ -1270,6 +1270,9 @@ genEmbedCode: "埋め込みコードを生成"
|
|||||||
noteOfThisUser: "このユーザーのノート一覧"
|
noteOfThisUser: "このユーザーのノート一覧"
|
||||||
clipNoteLimitExceeded: "これ以上このクリップにノートを追加できません。"
|
clipNoteLimitExceeded: "これ以上このクリップにノートを追加できません。"
|
||||||
performance: "パフォーマンス"
|
performance: "パフォーマンス"
|
||||||
|
modified: "変更あり"
|
||||||
|
discard: "破棄"
|
||||||
|
thereAreNChanges: "{n}件の変更があります"
|
||||||
|
|
||||||
_delivery:
|
_delivery:
|
||||||
status: "配信状態"
|
status: "配信状態"
|
||||||
|
@ -237,6 +237,8 @@ onMounted(() => {
|
|||||||
background: var(--acrylicBg);
|
background: var(--acrylicBg);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(15px));
|
-webkit-backdrop-filter: var(--blur, blur(15px));
|
||||||
backdrop-filter: var(--blur, blur(15px));
|
backdrop-filter: var(--blur, blur(15px));
|
||||||
|
background-size: auto auto;
|
||||||
|
background-image: repeating-linear-gradient(135deg, transparent, transparent 5px, var(--panel) 5px, var(--panel) 10px);
|
||||||
border-radius: 0 0 6px 6px;
|
border-radius: 0 0 6px 6px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
49
packages/frontend/src/components/MkFormFooter.vue
Normal file
49
packages/frontend/src/components/MkFormFooter.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div :class="$style.root">
|
||||||
|
<div :class="$style.text">{{ i18n.tsx.thereAreNChanges({ n: form.modifiedCount.value }) }}</div>
|
||||||
|
<div style="margin-left: auto;" class="_buttons">
|
||||||
|
<MkButton danger rounded @click="form.discard"><i class="ti ti-x"></i> {{ i18n.ts.discard }}</MkButton>
|
||||||
|
<MkButton primary rounded @click="form.save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { } from 'vue';
|
||||||
|
import MkButton from './MkButton.vue';
|
||||||
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
form: {
|
||||||
|
modifiedCount: {
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
|
discard: () => void;
|
||||||
|
save: () => void;
|
||||||
|
};
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.root {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: var(--warn);
|
||||||
|
font-size: 90%;
|
||||||
|
animation: modified-blink 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes modified-blink {
|
||||||
|
0% { opacity: 1; }
|
||||||
|
50% { opacity: 0.5; }
|
||||||
|
100% { opacity: 1; }
|
||||||
|
}
|
||||||
|
</style>
|
@ -7,103 +7,100 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
||||||
<FormSuspense :p="init">
|
<div class="_gaps">
|
||||||
<div class="_gaps">
|
<div class="_panel" style="padding: 16px;">
|
||||||
<div class="_panel" style="padding: 16px;">
|
<MkSwitch v-model="enableServerMachineStats" @change="onChange_enableServerMachineStats">
|
||||||
<MkSwitch v-model="enableServerMachineStats" @change="onChange_enableServerMachineStats">
|
<template #label>{{ i18n.ts.enableServerMachineStats }}</template>
|
||||||
<template #label>{{ i18n.ts.enableServerMachineStats }}</template>
|
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
||||||
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
</MkSwitch>
|
||||||
</MkSwitch>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="_panel" style="padding: 16px;">
|
|
||||||
<MkSwitch v-model="enableIdenticonGeneration" @change="onChange_enableIdenticonGeneration">
|
|
||||||
<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
|
|
||||||
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
|
||||||
</MkSwitch>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="_panel" style="padding: 16px;">
|
|
||||||
<MkSwitch v-model="enableChartsForRemoteUser" @change="onChange_enableChartsForRemoteUser">
|
|
||||||
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
|
|
||||||
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
|
||||||
</MkSwitch>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="_panel" style="padding: 16px;">
|
|
||||||
<MkSwitch v-model="enableChartsForFederatedInstances" @change="onChange_enableChartsForFederatedInstances">
|
|
||||||
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
|
|
||||||
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
|
||||||
</MkSwitch>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<MkFolder :defaultOpen="true">
|
|
||||||
<template #icon><i class="ti ti-bolt"></i></template>
|
|
||||||
<template #label>Misskey® Fan-out Timeline Technology™ (FTT)</template>
|
|
||||||
<template v-if="enableFanoutTimeline" #suffix>Enabled</template>
|
|
||||||
<template v-else #suffix>Disabled</template>
|
|
||||||
<template v-if="isFttModified" #footer>
|
|
||||||
<MkButton primary rounded @click="saveFtt">{{ i18n.ts.save }}</MkButton>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="_gaps_m">
|
|
||||||
<MkSwitch v-model="enableFanoutTimeline">
|
|
||||||
<template #label>{{ i18n.ts.enable }}</template>
|
|
||||||
<template #caption>
|
|
||||||
<div>{{ i18n.ts._serverSettings.fanoutTimelineDescription }}</div>
|
|
||||||
<div><MkLink target="_blank" url="https://misskey-hub.net/docs/for-admin/features/ftt/">{{ i18n.ts.details }}</MkLink></div>
|
|
||||||
</template>
|
|
||||||
</MkSwitch>
|
|
||||||
|
|
||||||
<MkSwitch v-model="enableFanoutTimelineDbFallback">
|
|
||||||
<template #label>{{ i18n.ts._serverSettings.fanoutTimelineDbFallback }}</template>
|
|
||||||
<template #caption>{{ i18n.ts._serverSettings.fanoutTimelineDbFallbackDescription }}</template>
|
|
||||||
</MkSwitch>
|
|
||||||
|
|
||||||
<MkInput v-model="perLocalUserUserTimelineCacheMax" type="number">
|
|
||||||
<template #label>perLocalUserUserTimelineCacheMax</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="perRemoteUserUserTimelineCacheMax" type="number">
|
|
||||||
<template #label>perRemoteUserUserTimelineCacheMax</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="perUserHomeTimelineCacheMax" type="number">
|
|
||||||
<template #label>perUserHomeTimelineCacheMax</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="perUserListTimelineCacheMax" type="number">
|
|
||||||
<template #label>perUserListTimelineCacheMax</template>
|
|
||||||
</MkInput>
|
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
|
|
||||||
<MkFolder :defaultOpen="true">
|
|
||||||
<template #icon><i class="ti ti-bolt"></i></template>
|
|
||||||
<template #label>Misskey® Reactions Boost Technology™ (RBT)<span class="_beta">{{ i18n.ts.beta }}</span></template>
|
|
||||||
<template v-if="enableReactionsBuffering" #suffix>Enabled</template>
|
|
||||||
<template v-else #suffix>Disabled</template>
|
|
||||||
<template v-if="isRbtModified" #footer>
|
|
||||||
<MkButton primary rounded @click="saveRbt">{{ i18n.ts.save }}</MkButton>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="_gaps_m">
|
|
||||||
<MkSwitch v-model="enableReactionsBuffering">
|
|
||||||
<template #label>{{ i18n.ts.enable }}</template>
|
|
||||||
<template #caption>{{ i18n.ts._serverSettings.reactionsBufferingDescription }}</template>
|
|
||||||
</MkSwitch>
|
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
</div>
|
</div>
|
||||||
</FormSuspense>
|
|
||||||
|
<div class="_panel" style="padding: 16px;">
|
||||||
|
<MkSwitch v-model="enableIdenticonGeneration" @change="onChange_enableIdenticonGeneration">
|
||||||
|
<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="_panel" style="padding: 16px;">
|
||||||
|
<MkSwitch v-model="enableChartsForRemoteUser" @change="onChange_enableChartsForRemoteUser">
|
||||||
|
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="_panel" style="padding: 16px;">
|
||||||
|
<MkSwitch v-model="enableChartsForFederatedInstances" @change="onChange_enableChartsForFederatedInstances">
|
||||||
|
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<MkFolder :defaultOpen="true">
|
||||||
|
<template #icon><i class="ti ti-bolt"></i></template>
|
||||||
|
<template #label>Misskey® Fan-out Timeline Technology™ (FTT)</template>
|
||||||
|
<template v-if="fttForm.savedState.enableFanoutTimeline" #suffix>Enabled</template>
|
||||||
|
<template v-else #suffix>Disabled</template>
|
||||||
|
<template v-if="fttForm.modified.value" #footer>
|
||||||
|
<MkFormFooter :form="fttForm"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="_gaps_m">
|
||||||
|
<MkSwitch v-model="fttForm.state.enableFanoutTimeline">
|
||||||
|
<template #label>{{ i18n.ts.enable }}<span v-if="fttForm.modifiedStates.enableFanoutTimeline" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>
|
||||||
|
<div>{{ i18n.ts._serverSettings.fanoutTimelineDescription }}</div>
|
||||||
|
<div><MkLink target="_blank" url="https://misskey-hub.net/docs/for-admin/features/ftt/">{{ i18n.ts.details }}</MkLink></div>
|
||||||
|
</template>
|
||||||
|
</MkSwitch>
|
||||||
|
|
||||||
|
<MkSwitch v-model="fttForm.state.enableFanoutTimelineDbFallback">
|
||||||
|
<template #label>{{ i18n.ts._serverSettings.fanoutTimelineDbFallback }}<span v-if="fttForm.modifiedStates.enableFanoutTimelineDbFallback" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._serverSettings.fanoutTimelineDbFallbackDescription }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
|
||||||
|
<MkInput v-model="fttForm.state.perLocalUserUserTimelineCacheMax" type="number">
|
||||||
|
<template #label>perLocalUserUserTimelineCacheMax<span v-if="fttForm.modifiedStates.perLocalUserUserTimelineCacheMax" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="fttForm.state.perRemoteUserUserTimelineCacheMax" type="number">
|
||||||
|
<template #label>perRemoteUserUserTimelineCacheMax<span v-if="fttForm.modifiedStates.perRemoteUserUserTimelineCacheMax" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="fttForm.state.perUserHomeTimelineCacheMax" type="number">
|
||||||
|
<template #label>perUserHomeTimelineCacheMax<span v-if="fttForm.modifiedStates.perUserHomeTimelineCacheMax" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="fttForm.state.perUserListTimelineCacheMax" type="number">
|
||||||
|
<template #label>perUserListTimelineCacheMax<span v-if="fttForm.modifiedStates.perUserListTimelineCacheMax" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
</MkInput>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder :defaultOpen="true">
|
||||||
|
<template #icon><i class="ti ti-bolt"></i></template>
|
||||||
|
<template #label>Misskey® Reactions Boost Technology™ (RBT)<span class="_beta">{{ i18n.ts.beta }}</span></template>
|
||||||
|
<template v-if="rbtForm.savedState.enableReactionsBuffering" #suffix>Enabled</template>
|
||||||
|
<template v-else #suffix>Disabled</template>
|
||||||
|
<template v-if="rbtForm.modified.value" #footer>
|
||||||
|
<MkFormFooter :form="rbtForm"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="_gaps_m">
|
||||||
|
<MkSwitch v-model="rbtForm.state.enableReactionsBuffering">
|
||||||
|
<template #label>{{ i18n.ts.enable }}<span v-if="rbtForm.modifiedStates.enableReactionsBuffering" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._serverSettings.reactionsBufferingDescription }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
</div>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</MkStickyContainer>
|
</MkStickyContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, watch } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import XHeader from './_header_.vue';
|
import XHeader from './_header_.vue';
|
||||||
import FormSuspense from '@/components/form/suspense.vue';
|
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { fetchInstance } from '@/instance.js';
|
import { fetchInstance } from '@/instance.js';
|
||||||
@ -114,45 +111,15 @@ import MkFolder from '@/components/MkFolder.vue';
|
|||||||
import MkInput from '@/components/MkInput.vue';
|
import MkInput from '@/components/MkInput.vue';
|
||||||
import MkLink from '@/components/MkLink.vue';
|
import MkLink from '@/components/MkLink.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
import { useForm } from '@/scripts/use-form.js';
|
||||||
|
import MkFormFooter from '@/components/MkFormFooter.vue';
|
||||||
|
|
||||||
const enableServerMachineStats = ref<boolean>(false);
|
const meta = await misskeyApi('admin/meta');
|
||||||
const enableIdenticonGeneration = ref<boolean>(false);
|
|
||||||
const enableChartsForRemoteUser = ref<boolean>(false);
|
|
||||||
const enableChartsForFederatedInstances = ref<boolean>(false);
|
|
||||||
const enableFanoutTimeline = ref<boolean>(false);
|
|
||||||
const enableFanoutTimelineDbFallback = ref<boolean>(false);
|
|
||||||
const perLocalUserUserTimelineCacheMax = ref<number>(0);
|
|
||||||
const perRemoteUserUserTimelineCacheMax = ref<number>(0);
|
|
||||||
const perUserHomeTimelineCacheMax = ref<number>(0);
|
|
||||||
const perUserListTimelineCacheMax = ref<number>(0);
|
|
||||||
const enableReactionsBuffering = ref<boolean>(false);
|
|
||||||
|
|
||||||
const isFttModified = ref<boolean>(false);
|
const enableServerMachineStats = ref(meta.enableServerMachineStats);
|
||||||
|
const enableIdenticonGeneration = ref(meta.enableIdenticonGeneration);
|
||||||
const isRbtModified = ref<boolean>(false);
|
const enableChartsForRemoteUser = ref(meta.enableChartsForRemoteUser);
|
||||||
|
const enableChartsForFederatedInstances = ref(meta.enableChartsForFederatedInstances);
|
||||||
async function init() {
|
|
||||||
const meta = await misskeyApi('admin/meta');
|
|
||||||
enableServerMachineStats.value = meta.enableServerMachineStats;
|
|
||||||
enableIdenticonGeneration.value = meta.enableIdenticonGeneration;
|
|
||||||
enableChartsForRemoteUser.value = meta.enableChartsForRemoteUser;
|
|
||||||
enableChartsForFederatedInstances.value = meta.enableChartsForFederatedInstances;
|
|
||||||
enableFanoutTimeline.value = meta.enableFanoutTimeline;
|
|
||||||
enableFanoutTimelineDbFallback.value = meta.enableFanoutTimelineDbFallback;
|
|
||||||
perLocalUserUserTimelineCacheMax.value = meta.perLocalUserUserTimelineCacheMax;
|
|
||||||
perRemoteUserUserTimelineCacheMax.value = meta.perRemoteUserUserTimelineCacheMax;
|
|
||||||
perUserHomeTimelineCacheMax.value = meta.perUserHomeTimelineCacheMax;
|
|
||||||
perUserListTimelineCacheMax.value = meta.perUserListTimelineCacheMax;
|
|
||||||
enableReactionsBuffering.value = meta.enableReactionsBuffering;
|
|
||||||
|
|
||||||
watch([enableFanoutTimeline, enableFanoutTimelineDbFallback, perLocalUserUserTimelineCacheMax, perRemoteUserUserTimelineCacheMax, perUserHomeTimelineCacheMax, perUserListTimelineCacheMax], () => {
|
|
||||||
isFttModified.value = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(enableReactionsBuffering, () => {
|
|
||||||
isRbtModified.value = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onChange_enableServerMachineStats(value: boolean) {
|
function onChange_enableServerMachineStats(value: boolean) {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
@ -186,28 +153,33 @@ function onChange_enableChartsForFederatedInstances(value: boolean) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveFtt() {
|
const fttForm = useForm({
|
||||||
os.apiWithDialog('admin/update-meta', {
|
enableFanoutTimeline: meta.enableFanoutTimeline,
|
||||||
enableFanoutTimeline: enableFanoutTimeline.value,
|
enableFanoutTimelineDbFallback: meta.enableFanoutTimelineDbFallback,
|
||||||
enableFanoutTimelineDbFallback: enableFanoutTimelineDbFallback.value,
|
perLocalUserUserTimelineCacheMax: meta.perLocalUserUserTimelineCacheMax,
|
||||||
perLocalUserUserTimelineCacheMax: perLocalUserUserTimelineCacheMax.value,
|
perRemoteUserUserTimelineCacheMax: meta.perRemoteUserUserTimelineCacheMax,
|
||||||
perRemoteUserUserTimelineCacheMax: perRemoteUserUserTimelineCacheMax.value,
|
perUserHomeTimelineCacheMax: meta.perUserHomeTimelineCacheMax,
|
||||||
perUserHomeTimelineCacheMax: perUserHomeTimelineCacheMax.value,
|
perUserListTimelineCacheMax: meta.perUserListTimelineCacheMax,
|
||||||
perUserListTimelineCacheMax: perUserListTimelineCacheMax.value,
|
}, async (state) => {
|
||||||
}).then(() => {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
isFttModified.value = false;
|
enableFanoutTimeline: state.enableFanoutTimeline,
|
||||||
fetchInstance(true);
|
enableFanoutTimelineDbFallback: state.enableFanoutTimelineDbFallback,
|
||||||
|
perLocalUserUserTimelineCacheMax: state.perLocalUserUserTimelineCacheMax,
|
||||||
|
perRemoteUserUserTimelineCacheMax: state.perRemoteUserUserTimelineCacheMax,
|
||||||
|
perUserHomeTimelineCacheMax: state.perUserHomeTimelineCacheMax,
|
||||||
|
perUserListTimelineCacheMax: state.perUserListTimelineCacheMax,
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
function saveRbt() {
|
const rbtForm = useForm({
|
||||||
os.apiWithDialog('admin/update-meta', {
|
enableReactionsBuffering: meta.enableReactionsBuffering,
|
||||||
enableReactionsBuffering: enableReactionsBuffering.value,
|
}, async (state) => {
|
||||||
}).then(() => {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
isRbtModified.value = false;
|
enableReactionsBuffering: state.enableReactionsBuffering,
|
||||||
fetchInstance(true);
|
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
const headerActions = computed(() => []);
|
const headerActions = computed(() => []);
|
||||||
|
|
||||||
|
@ -8,223 +8,221 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><XHeader :tabs="headerTabs"/></template>
|
<template #header><XHeader :tabs="headerTabs"/></template>
|
||||||
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
||||||
<FormSuspense :p="init">
|
<div class="_gaps_m">
|
||||||
<div class="_gaps_m">
|
<MkFolder :defaultOpen="true">
|
||||||
<MkFolder :defaultOpen="true">
|
<template #icon><i class="ti ti-info-circle"></i></template>
|
||||||
<template #icon><i class="ti ti-info-circle"></i></template>
|
<template #label>{{ i18n.ts.info }}</template>
|
||||||
<template #label>{{ i18n.ts.info }}</template>
|
<template v-if="infoForm.modified.value" #footer>
|
||||||
<template #footer>
|
<MkFormFooter :form="infoForm"/>
|
||||||
<MkButton primary rounded @click="saveInfo">{{ i18n.ts.save }}</MkButton>
|
</template>
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="_gaps">
|
<div class="_gaps">
|
||||||
<MkInput v-model="name">
|
<MkInput v-model="infoForm.state.name">
|
||||||
<template #label>{{ i18n.ts.instanceName }}</template>
|
<template #label>{{ i18n.ts.instanceName }}<span v-if="infoForm.modifiedStates.name" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
|
|
||||||
<MkInput v-model="shortName">
|
<MkInput v-model="infoForm.state.shortName">
|
||||||
<template #label>{{ i18n.ts._serverSettings.shortName }} ({{ i18n.ts.optional }})</template>
|
<template #label>{{ i18n.ts._serverSettings.shortName }} ({{ i18n.ts.optional }})<span v-if="infoForm.modifiedStates.shortName" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
<template #caption>{{ i18n.ts._serverSettings.shortNameDescription }}</template>
|
<template #caption>{{ i18n.ts._serverSettings.shortNameDescription }}</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
|
|
||||||
<MkTextarea v-model="description">
|
<MkTextarea v-model="infoForm.state.description">
|
||||||
<template #label>{{ i18n.ts.instanceDescription }}</template>
|
<template #label>{{ i18n.ts.instanceDescription }}<span v-if="infoForm.modifiedStates.description" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
</MkTextarea>
|
|
||||||
|
|
||||||
<FormSplit :minWidth="300">
|
|
||||||
<MkInput v-model="maintainerName">
|
|
||||||
<template #label>{{ i18n.ts.maintainerName }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="maintainerEmail" type="email">
|
|
||||||
<template #prefix><i class="ti ti-mail"></i></template>
|
|
||||||
<template #label>{{ i18n.ts.maintainerEmail }}</template>
|
|
||||||
</MkInput>
|
|
||||||
</FormSplit>
|
|
||||||
|
|
||||||
<MkInput v-model="tosUrl" type="url">
|
|
||||||
<template #prefix><i class="ti ti-link"></i></template>
|
|
||||||
<template #label>{{ i18n.ts.tosUrl }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="privacyPolicyUrl" type="url">
|
|
||||||
<template #prefix><i class="ti ti-link"></i></template>
|
|
||||||
<template #label>{{ i18n.ts.privacyPolicyUrl }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="inquiryUrl" type="url">
|
|
||||||
<template #prefix><i class="ti ti-link"></i></template>
|
|
||||||
<template #label>{{ i18n.ts._serverSettings.inquiryUrl }}</template>
|
|
||||||
<template #caption>{{ i18n.ts._serverSettings.inquiryUrlDescription }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="repositoryUrl" type="url">
|
|
||||||
<template #label>{{ i18n.ts.repositoryUrl }}</template>
|
|
||||||
<template #prefix><i class="ti ti-link"></i></template>
|
|
||||||
<template #caption>{{ i18n.ts.repositoryUrlDescription }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInfo v-if="!instance.providesTarball && !repositoryUrl" warn>
|
|
||||||
{{ i18n.ts.repositoryUrlOrTarballRequired }}
|
|
||||||
</MkInfo>
|
|
||||||
|
|
||||||
<MkInput v-model="impressumUrl" type="url">
|
|
||||||
<template #label>{{ i18n.ts.impressumUrl }}</template>
|
|
||||||
<template #prefix><i class="ti ti-link"></i></template>
|
|
||||||
<template #caption>{{ i18n.ts.impressumDescription }}</template>
|
|
||||||
</MkInput>
|
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
|
|
||||||
<MkFolder>
|
|
||||||
<template #icon><i class="ti ti-user-star"></i></template>
|
|
||||||
<template #label>{{ i18n.ts.pinnedUsers }}</template>
|
|
||||||
<template #footer>
|
|
||||||
<MkButton primary rounded @click="save_pinnedUsers">{{ i18n.ts.save }}</MkButton>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<MkTextarea v-model="pinnedUsers">
|
|
||||||
<template #label>{{ i18n.ts.pinnedUsers }}</template>
|
|
||||||
<template #caption>{{ i18n.ts.pinnedUsersDescription }}</template>
|
|
||||||
</MkTextarea>
|
</MkTextarea>
|
||||||
</MkFolder>
|
|
||||||
|
|
||||||
<MkFolder>
|
<FormSplit :minWidth="300">
|
||||||
<template #icon><i class="ti ti-cloud"></i></template>
|
<MkInput v-model="infoForm.state.maintainerName">
|
||||||
<template #label>{{ i18n.ts.files }}</template>
|
<template #label>{{ i18n.ts.maintainerName }}<span v-if="infoForm.modifiedStates.maintainerName" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
<template #footer>
|
</MkInput>
|
||||||
<MkButton primary rounded @click="saveFiles">{{ i18n.ts.save }}</MkButton>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="_gaps">
|
<MkInput v-model="infoForm.state.maintainerEmail" type="email">
|
||||||
<MkSwitch v-model="cacheRemoteFiles">
|
<template #label>{{ i18n.ts.maintainerEmail }}<span v-if="infoForm.modifiedStates.maintainerEmail" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
<template #label>{{ i18n.ts.cacheRemoteFiles }}</template>
|
<template #prefix><i class="ti ti-mail"></i></template>
|
||||||
<template #caption>{{ i18n.ts.cacheRemoteFilesDescription }}{{ i18n.ts.youCanCleanRemoteFilesCache }}</template>
|
</MkInput>
|
||||||
|
</FormSplit>
|
||||||
|
|
||||||
|
<MkInput v-model="infoForm.state.tosUrl" type="url">
|
||||||
|
<template #label>{{ i18n.ts.tosUrl }}<span v-if="infoForm.modifiedStates.tosUrl" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #prefix><i class="ti ti-link"></i></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="infoForm.state.privacyPolicyUrl" type="url">
|
||||||
|
<template #label>{{ i18n.ts.privacyPolicyUrl }}<span v-if="infoForm.modifiedStates.privacyPolicyUrl" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #prefix><i class="ti ti-link"></i></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="infoForm.state.inquiryUrl" type="url">
|
||||||
|
<template #label>{{ i18n.ts._serverSettings.inquiryUrl }}<span v-if="infoForm.modifiedStates.inquiryUrl" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._serverSettings.inquiryUrlDescription }}</template>
|
||||||
|
<template #prefix><i class="ti ti-link"></i></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="infoForm.state.repositoryUrl" type="url">
|
||||||
|
<template #label>{{ i18n.ts.repositoryUrl }}<span v-if="infoForm.modifiedStates.repositoryUrl" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts.repositoryUrlDescription }}</template>
|
||||||
|
<template #prefix><i class="ti ti-link"></i></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInfo v-if="!instance.providesTarball && !infoForm.state.repositoryUrl" warn>
|
||||||
|
{{ i18n.ts.repositoryUrlOrTarballRequired }}
|
||||||
|
</MkInfo>
|
||||||
|
|
||||||
|
<MkInput v-model="infoForm.state.impressumUrl" type="url">
|
||||||
|
<template #label>{{ i18n.ts.impressumUrl }}<span v-if="infoForm.modifiedStates.impressumUrl" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts.impressumDescription }}</template>
|
||||||
|
<template #prefix><i class="ti ti-link"></i></template>
|
||||||
|
</MkInput>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder>
|
||||||
|
<template #icon><i class="ti ti-user-star"></i></template>
|
||||||
|
<template #label>{{ i18n.ts.pinnedUsers }}</template>
|
||||||
|
<template v-if="pinnedUsersForm.modified.value" #footer>
|
||||||
|
<MkFormFooter :form="pinnedUsersForm"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<MkTextarea v-model="pinnedUsersForm.state.pinnedUsers">
|
||||||
|
<template #label>{{ i18n.ts.pinnedUsers }}<span v-if="pinnedUsersForm.modifiedStates.pinnedUsers" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts.pinnedUsersDescription }}</template>
|
||||||
|
</MkTextarea>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder>
|
||||||
|
<template #icon><i class="ti ti-cloud"></i></template>
|
||||||
|
<template #label>{{ i18n.ts.files }}</template>
|
||||||
|
<template v-if="filesForm.modified.value" #footer>
|
||||||
|
<MkFormFooter :form="filesForm"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="_gaps">
|
||||||
|
<MkSwitch v-model="filesForm.state.cacheRemoteFiles">
|
||||||
|
<template #label>{{ i18n.ts.cacheRemoteFiles }}<span v-if="filesForm.modifiedStates.cacheRemoteFiles" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts.cacheRemoteFilesDescription }}{{ i18n.ts.youCanCleanRemoteFilesCache }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
|
||||||
|
<template v-if="filesForm.state.cacheRemoteFiles">
|
||||||
|
<MkSwitch v-model="filesForm.state.cacheRemoteSensitiveFiles">
|
||||||
|
<template #label>{{ i18n.ts.cacheRemoteSensitiveFiles }}<span v-if="filesForm.modifiedStates.cacheRemoteSensitiveFiles" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts.cacheRemoteSensitiveFilesDescription }}</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
|
|
||||||
<template v-if="cacheRemoteFiles">
|
|
||||||
<MkSwitch v-model="cacheRemoteSensitiveFiles">
|
|
||||||
<template #label>{{ i18n.ts.cacheRemoteSensitiveFiles }}</template>
|
|
||||||
<template #caption>{{ i18n.ts.cacheRemoteSensitiveFilesDescription }}</template>
|
|
||||||
</MkSwitch>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
|
|
||||||
<MkFolder>
|
|
||||||
<template #icon><i class="ti ti-world-cog"></i></template>
|
|
||||||
<template #label>ServiceWorker</template>
|
|
||||||
<template #footer>
|
|
||||||
<MkButton primary rounded @click="saveServiceWorker">{{ i18n.ts.save }}</MkButton>
|
|
||||||
</template>
|
</template>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<div class="_gaps">
|
<MkFolder>
|
||||||
<MkSwitch v-model="enableServiceWorker">
|
<template #icon><i class="ti ti-world-cog"></i></template>
|
||||||
<template #label>{{ i18n.ts.enableServiceworker }}</template>
|
<template #label>ServiceWorker</template>
|
||||||
<template #caption>{{ i18n.ts.serviceworkerInfo }}</template>
|
<template v-if="serviceWorkerForm.modified.value" #footer>
|
||||||
</MkSwitch>
|
<MkFormFooter :form="serviceWorkerForm"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-if="enableServiceWorker">
|
<div class="_gaps">
|
||||||
<MkInput v-model="swPublicKey">
|
<MkSwitch v-model="serviceWorkerForm.state.enableServiceWorker">
|
||||||
<template #prefix><i class="ti ti-key"></i></template>
|
<template #label>{{ i18n.ts.enableServiceworker }}<span v-if="serviceWorkerForm.modifiedStates.enableServiceWorker" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
<template #label>Public key</template>
|
<template #caption>{{ i18n.ts.serviceworkerInfo }}</template>
|
||||||
</MkInput>
|
</MkSwitch>
|
||||||
|
|
||||||
<MkInput v-model="swPrivateKey">
|
<template v-if="serviceWorkerForm.state.enableServiceWorker">
|
||||||
<template #prefix><i class="ti ti-key"></i></template>
|
<MkInput v-model="serviceWorkerForm.state.swPublicKey">
|
||||||
<template #label>Private key</template>
|
<template #label>Public key<span v-if="serviceWorkerForm.modifiedStates.swPublicKey" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
</MkInput>
|
<template #prefix><i class="ti ti-key"></i></template>
|
||||||
</template>
|
</MkInput>
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
|
|
||||||
<MkFolder>
|
<MkInput v-model="serviceWorkerForm.state.swPrivateKey">
|
||||||
<template #icon><i class="ti ti-ad"></i></template>
|
<template #label>Private key<span v-if="serviceWorkerForm.modifiedStates.swPrivateKey" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
<template #label>{{ i18n.ts._ad.adsSettings }}</template>
|
<template #prefix><i class="ti ti-key"></i></template>
|
||||||
<template #footer>
|
</MkInput>
|
||||||
<MkButton primary rounded @click="saveAd">{{ i18n.ts.save }}</MkButton>
|
|
||||||
</template>
|
</template>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<div class="_gaps">
|
<MkFolder>
|
||||||
<div class="_gaps_s">
|
<template #icon><i class="ti ti-ad"></i></template>
|
||||||
<MkInput v-model="notesPerOneAd" :min="0" type="number">
|
<template #label>{{ i18n.ts._ad.adsSettings }}</template>
|
||||||
<template #label>{{ i18n.ts._ad.notesPerOneAd }}</template>
|
<template v-if="adForm.modified.value" #footer>
|
||||||
<template #caption>{{ i18n.ts._ad.setZeroToDisable }}</template>
|
<MkFormFooter :form="adForm"/>
|
||||||
</MkInput>
|
</template>
|
||||||
<MkInfo v-if="notesPerOneAd > 0 && notesPerOneAd < 20" :warn="true">
|
|
||||||
{{ i18n.ts._ad.adsTooClose }}
|
<div class="_gaps">
|
||||||
</MkInfo>
|
<div class="_gaps_s">
|
||||||
|
<MkInput v-model="adForm.state.notesPerOneAd" :min="0" type="number">
|
||||||
|
<template #label>{{ i18n.ts._ad.notesPerOneAd }}<span v-if="adForm.modifiedStates.notesPerOneAd" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._ad.setZeroToDisable }}</template>
|
||||||
|
</MkInput>
|
||||||
|
<MkInfo v-if="adForm.state.notesPerOneAd > 0 && adForm.state.notesPerOneAd < 20" :warn="true">
|
||||||
|
{{ i18n.ts._ad.adsTooClose }}
|
||||||
|
</MkInfo>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder>
|
||||||
|
<template #icon><i class="ti ti-world-search"></i></template>
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.title }}</template>
|
||||||
|
<template v-if="urlPreviewForm.modified.value" #footer>
|
||||||
|
<MkFormFooter :form="urlPreviewForm"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="_gaps">
|
||||||
|
<MkSwitch v-model="urlPreviewForm.state.urlPreviewEnabled">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.enable }}<span v-if="urlPreviewForm.modifiedStates.urlPreviewEnabled" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
</MkSwitch>
|
||||||
|
|
||||||
|
<MkSwitch v-model="urlPreviewForm.state.urlPreviewRequireContentLength">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.requireContentLength }}<span v-if="urlPreviewForm.modifiedStates.urlPreviewRequireContentLength" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.requireContentLengthDescription }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
|
||||||
|
<MkInput v-model="urlPreviewForm.state.urlPreviewMaximumContentLength" type="number">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.maximumContentLength }}<span v-if="urlPreviewForm.modifiedStates.urlPreviewMaximumContentLength" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.maximumContentLengthDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="urlPreviewForm.state.urlPreviewTimeout" type="number">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.timeout }}<span v-if="urlPreviewForm.modifiedStates.urlPreviewTimeout" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.timeoutDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="urlPreviewForm.state.urlPreviewUserAgent" type="text">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.userAgent }}<span v-if="urlPreviewForm.modifiedStates.urlPreviewUserAgent" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.userAgentDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<MkInput v-model="urlPreviewForm.state.urlPreviewSummaryProxyUrl" type="text">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.summaryProxy }}<span v-if="urlPreviewForm.modifiedStates.urlPreviewSummaryProxyUrl" class="_modified">{{ i18n.ts.modified }}</span></template>
|
||||||
|
<template #caption>[{{ i18n.ts.notUsePleaseLeaveBlank }}] {{ i18n.ts._urlPreviewSetting.summaryProxyDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<div :class="$style.subCaption">
|
||||||
|
{{ i18n.ts._urlPreviewSetting.summaryProxyDescription2 }}
|
||||||
|
<ul style="padding-left: 20px; margin: 4px 0">
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.timeout }} / key:timeout</li>
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.maximumContentLength }} / key:contentLengthLimit</li>
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.requireContentLength }} / key:contentLengthRequired</li>
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.userAgent }} / key:userAgent</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
<template #icon><i class="ti ti-world-search"></i></template>
|
<template #icon><i class="ti ti-ghost"></i></template>
|
||||||
<template #label>{{ i18n.ts._urlPreviewSetting.title }}</template>
|
<template #label>{{ i18n.ts.proxyAccount }}</template>
|
||||||
<template #footer>
|
|
||||||
<MkButton primary rounded @click="saveUrlPreview">{{ i18n.ts.save }}</MkButton>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="_gaps">
|
<div class="_gaps">
|
||||||
<MkSwitch v-model="urlPreviewEnabled">
|
<MkInfo>{{ i18n.ts.proxyAccountDescription }}</MkInfo>
|
||||||
<template #label>{{ i18n.ts._urlPreviewSetting.enable }}</template>
|
<MkKeyValue>
|
||||||
</MkSwitch>
|
<template #key>{{ i18n.ts.proxyAccount }}</template>
|
||||||
|
<template #value>{{ proxyAccount ? `@${proxyAccount.username}` : i18n.ts.none }}</template>
|
||||||
|
</MkKeyValue>
|
||||||
|
|
||||||
<MkSwitch v-model="urlPreviewRequireContentLength">
|
<MkButton primary @click="chooseProxyAccount">{{ i18n.ts.selectAccount }}</MkButton>
|
||||||
<template #label>{{ i18n.ts._urlPreviewSetting.requireContentLength }}</template>
|
</div>
|
||||||
<template #caption>{{ i18n.ts._urlPreviewSetting.requireContentLengthDescription }}</template>
|
</MkFolder>
|
||||||
</MkSwitch>
|
</div>
|
||||||
|
|
||||||
<MkInput v-model="urlPreviewMaximumContentLength" type="number">
|
|
||||||
<template #label>{{ i18n.ts._urlPreviewSetting.maximumContentLength }}</template>
|
|
||||||
<template #caption>{{ i18n.ts._urlPreviewSetting.maximumContentLengthDescription }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="urlPreviewTimeout" type="number">
|
|
||||||
<template #label>{{ i18n.ts._urlPreviewSetting.timeout }}</template>
|
|
||||||
<template #caption>{{ i18n.ts._urlPreviewSetting.timeoutDescription }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkInput v-model="urlPreviewUserAgent" type="text">
|
|
||||||
<template #label>{{ i18n.ts._urlPreviewSetting.userAgent }}</template>
|
|
||||||
<template #caption>{{ i18n.ts._urlPreviewSetting.userAgentDescription }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<MkInput v-model="urlPreviewSummaryProxyUrl" type="text">
|
|
||||||
<template #label>{{ i18n.ts._urlPreviewSetting.summaryProxy }}</template>
|
|
||||||
<template #caption>[{{ i18n.ts.notUsePleaseLeaveBlank }}] {{ i18n.ts._urlPreviewSetting.summaryProxyDescription }}</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<div :class="$style.subCaption">
|
|
||||||
{{ i18n.ts._urlPreviewSetting.summaryProxyDescription2 }}
|
|
||||||
<ul style="padding-left: 20px; margin: 4px 0">
|
|
||||||
<li>{{ i18n.ts._urlPreviewSetting.timeout }} / key:timeout</li>
|
|
||||||
<li>{{ i18n.ts._urlPreviewSetting.maximumContentLength }} / key:contentLengthLimit</li>
|
|
||||||
<li>{{ i18n.ts._urlPreviewSetting.requireContentLength }} / key:contentLengthRequired</li>
|
|
||||||
<li>{{ i18n.ts._urlPreviewSetting.userAgent }} / key:userAgent</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
|
|
||||||
<MkFolder>
|
|
||||||
<template #icon><i class="ti ti-ghost"></i></template>
|
|
||||||
<template #label>{{ i18n.ts.proxyAccount }}</template>
|
|
||||||
|
|
||||||
<div class="_gaps">
|
|
||||||
<MkInfo>{{ i18n.ts.proxyAccountDescription }}</MkInfo>
|
|
||||||
<MkKeyValue>
|
|
||||||
<template #key>{{ i18n.ts.proxyAccount }}</template>
|
|
||||||
<template #value>{{ proxyAccount ? `@${proxyAccount.username}` : i18n.ts.none }}</template>
|
|
||||||
</MkKeyValue>
|
|
||||||
|
|
||||||
<MkButton primary @click="chooseProxyAccount">{{ i18n.ts.selectAccount }}</MkButton>
|
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
</div>
|
|
||||||
</FormSuspense>
|
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</MkStickyContainer>
|
</MkStickyContainer>
|
||||||
</div>
|
</div>
|
||||||
@ -239,7 +237,6 @@ import MkInput from '@/components/MkInput.vue';
|
|||||||
import MkTextarea from '@/components/MkTextarea.vue';
|
import MkTextarea from '@/components/MkTextarea.vue';
|
||||||
import MkInfo from '@/components/MkInfo.vue';
|
import MkInfo from '@/components/MkInfo.vue';
|
||||||
import FormSplit from '@/components/form/split.vue';
|
import FormSplit from '@/components/form/split.vue';
|
||||||
import FormSuspense from '@/components/form/suspense.vue';
|
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { fetchInstance, instance } from '@/instance.js';
|
import { fetchInstance, instance } from '@/instance.js';
|
||||||
@ -249,143 +246,109 @@ import MkButton from '@/components/MkButton.vue';
|
|||||||
import MkFolder from '@/components/MkFolder.vue';
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
import MkSelect from '@/components/MkSelect.vue';
|
import MkSelect from '@/components/MkSelect.vue';
|
||||||
import MkKeyValue from '@/components/MkKeyValue.vue';
|
import MkKeyValue from '@/components/MkKeyValue.vue';
|
||||||
|
import { useForm } from '@/scripts/use-form.js';
|
||||||
|
import MkFormFooter from '@/components/MkFormFooter.vue';
|
||||||
|
|
||||||
const proxyAccount = ref<Misskey.entities.UserDetailed | null>(null);
|
const meta = await misskeyApi('admin/meta');
|
||||||
|
|
||||||
const name = ref<string | null>(null);
|
const proxyAccount = ref(meta.proxyAccountId ? await misskeyApi('users/show', { userId: meta.proxyAccountId }) : null);
|
||||||
const shortName = ref<string | null>(null);
|
|
||||||
const description = ref<string | null>(null);
|
|
||||||
const maintainerName = ref<string | null>(null);
|
|
||||||
const maintainerEmail = ref<string | null>(null);
|
|
||||||
const tosUrl = ref<string | null>(null);
|
|
||||||
const privacyPolicyUrl = ref<string | null>(null);
|
|
||||||
const inquiryUrl = ref<string | null>(null);
|
|
||||||
const repositoryUrl = ref<string | null>(null);
|
|
||||||
const impressumUrl = ref<string | null>(null);
|
|
||||||
const pinnedUsers = ref<string>('');
|
|
||||||
const cacheRemoteFiles = ref<boolean>(false);
|
|
||||||
const cacheRemoteSensitiveFiles = ref<boolean>(false);
|
|
||||||
const enableServiceWorker = ref<boolean>(false);
|
|
||||||
const swPublicKey = ref<string | null>(null);
|
|
||||||
const swPrivateKey = ref<string | null>(null);
|
|
||||||
const notesPerOneAd = ref<number>(0);
|
|
||||||
const urlPreviewEnabled = ref<boolean>(true);
|
|
||||||
const urlPreviewTimeout = ref<number>(10000);
|
|
||||||
const urlPreviewMaximumContentLength = ref<number>(1024 * 1024 * 10);
|
|
||||||
const urlPreviewRequireContentLength = ref<boolean>(true);
|
|
||||||
const urlPreviewUserAgent = ref<string | null>(null);
|
|
||||||
const urlPreviewSummaryProxyUrl = ref<string | null>(null);
|
|
||||||
const proxyAccountId = ref<string | null>(null);
|
|
||||||
|
|
||||||
async function init(): Promise<void> {
|
const infoForm = useForm({
|
||||||
const meta = await misskeyApi('admin/meta');
|
name: meta.name ?? '',
|
||||||
name.value = meta.name;
|
shortName: meta.shortName ?? '',
|
||||||
shortName.value = meta.shortName;
|
description: meta.description ?? '',
|
||||||
description.value = meta.description;
|
maintainerName: meta.maintainerName ?? '',
|
||||||
maintainerName.value = meta.maintainerName;
|
maintainerEmail: meta.maintainerEmail ?? '',
|
||||||
maintainerEmail.value = meta.maintainerEmail;
|
tosUrl: meta.tosUrl ?? '',
|
||||||
tosUrl.value = meta.tosUrl;
|
privacyPolicyUrl: meta.privacyPolicyUrl ?? '',
|
||||||
privacyPolicyUrl.value = meta.privacyPolicyUrl;
|
inquiryUrl: meta.inquiryUrl ?? '',
|
||||||
inquiryUrl.value = meta.inquiryUrl;
|
repositoryUrl: meta.repositoryUrl ?? '',
|
||||||
repositoryUrl.value = meta.repositoryUrl;
|
impressumUrl: meta.impressumUrl ?? '',
|
||||||
impressumUrl.value = meta.impressumUrl;
|
}, async (state) => {
|
||||||
pinnedUsers.value = meta.pinnedUsers.join('\n');
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
cacheRemoteFiles.value = meta.cacheRemoteFiles;
|
name: state.name,
|
||||||
cacheRemoteSensitiveFiles.value = meta.cacheRemoteSensitiveFiles;
|
shortName: state.shortName === '' ? null : state.shortName,
|
||||||
enableServiceWorker.value = meta.enableServiceWorker;
|
description: state.description,
|
||||||
swPublicKey.value = meta.swPublickey;
|
maintainerName: state.maintainerName,
|
||||||
swPrivateKey.value = meta.swPrivateKey;
|
maintainerEmail: state.maintainerEmail,
|
||||||
notesPerOneAd.value = meta.notesPerOneAd;
|
tosUrl: state.tosUrl,
|
||||||
urlPreviewEnabled.value = meta.urlPreviewEnabled;
|
privacyPolicyUrl: state.privacyPolicyUrl,
|
||||||
urlPreviewTimeout.value = meta.urlPreviewTimeout;
|
inquiryUrl: state.inquiryUrl,
|
||||||
urlPreviewMaximumContentLength.value = meta.urlPreviewMaximumContentLength;
|
repositoryUrl: state.repositoryUrl,
|
||||||
urlPreviewRequireContentLength.value = meta.urlPreviewRequireContentLength;
|
impressumUrl: state.impressumUrl,
|
||||||
urlPreviewUserAgent.value = meta.urlPreviewUserAgent;
|
|
||||||
urlPreviewSummaryProxyUrl.value = meta.urlPreviewSummaryProxyUrl;
|
|
||||||
proxyAccountId.value = meta.proxyAccountId;
|
|
||||||
if (proxyAccountId.value) {
|
|
||||||
proxyAccount.value = await misskeyApi('users/show', { userId: proxyAccountId.value });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveInfo() {
|
|
||||||
os.apiWithDialog('admin/update-meta', {
|
|
||||||
name: name.value,
|
|
||||||
shortName: shortName.value === '' ? null : shortName.value,
|
|
||||||
description: description.value,
|
|
||||||
maintainerName: maintainerName.value,
|
|
||||||
maintainerEmail: maintainerEmail.value,
|
|
||||||
tosUrl: tosUrl.value,
|
|
||||||
privacyPolicyUrl: privacyPolicyUrl.value,
|
|
||||||
inquiryUrl: inquiryUrl.value,
|
|
||||||
repositoryUrl: repositoryUrl.value,
|
|
||||||
impressumUrl: impressumUrl.value,
|
|
||||||
}).then(() => {
|
|
||||||
fetchInstance(true);
|
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
function save_pinnedUsers() {
|
const pinnedUsersForm = useForm({
|
||||||
os.apiWithDialog('admin/update-meta', {
|
pinnedUsers: meta.pinnedUsers.join('\n'),
|
||||||
pinnedUsers: pinnedUsers.value.split('\n'),
|
}, async (state) => {
|
||||||
}).then(() => {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
fetchInstance(true);
|
pinnedUsers: state.pinnedUsers.split('\n'),
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
function saveFiles() {
|
const filesForm = useForm({
|
||||||
os.apiWithDialog('admin/update-meta', {
|
cacheRemoteFiles: meta.cacheRemoteFiles,
|
||||||
cacheRemoteFiles: cacheRemoteFiles.value,
|
cacheRemoteSensitiveFiles: meta.cacheRemoteSensitiveFiles,
|
||||||
cacheRemoteSensitiveFiles: cacheRemoteSensitiveFiles.value,
|
}, async (state) => {
|
||||||
}).then(() => {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
fetchInstance(true);
|
cacheRemoteFiles: state.cacheRemoteFiles,
|
||||||
|
cacheRemoteSensitiveFiles: state.cacheRemoteSensitiveFiles,
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
function saveServiceWorker() {
|
const serviceWorkerForm = useForm({
|
||||||
os.apiWithDialog('admin/update-meta', {
|
enableServiceWorker: meta.enableServiceWorker,
|
||||||
enableServiceWorker: enableServiceWorker.value,
|
swPublicKey: meta.swPublickey ?? '',
|
||||||
swPublicKey: swPublicKey.value,
|
swPrivateKey: meta.swPrivateKey ?? '',
|
||||||
swPrivateKey: swPrivateKey.value,
|
}, async (state) => {
|
||||||
}).then(() => {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
fetchInstance(true);
|
enableServiceWorker: state.enableServiceWorker,
|
||||||
|
swPublicKey: state.swPublicKey,
|
||||||
|
swPrivateKey: state.swPrivateKey,
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
function saveAd() {
|
const adForm = useForm({
|
||||||
os.apiWithDialog('admin/update-meta', {
|
notesPerOneAd: meta.notesPerOneAd,
|
||||||
notesPerOneAd: notesPerOneAd.value,
|
}, async (state) => {
|
||||||
}).then(() => {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
fetchInstance(true);
|
notesPerOneAd: state.notesPerOneAd,
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
function saveUrlPreview() {
|
const urlPreviewForm = useForm({
|
||||||
os.apiWithDialog('admin/update-meta', {
|
urlPreviewEnabled: meta.urlPreviewEnabled,
|
||||||
urlPreviewEnabled: urlPreviewEnabled.value,
|
urlPreviewTimeout: meta.urlPreviewTimeout,
|
||||||
urlPreviewTimeout: urlPreviewTimeout.value,
|
urlPreviewMaximumContentLength: meta.urlPreviewMaximumContentLength,
|
||||||
urlPreviewMaximumContentLength: urlPreviewMaximumContentLength.value,
|
urlPreviewRequireContentLength: meta.urlPreviewRequireContentLength,
|
||||||
urlPreviewRequireContentLength: urlPreviewRequireContentLength.value,
|
urlPreviewUserAgent: meta.urlPreviewUserAgent ?? '',
|
||||||
urlPreviewUserAgent: urlPreviewUserAgent.value,
|
urlPreviewSummaryProxyUrl: meta.urlPreviewSummaryProxyUrl ?? '',
|
||||||
urlPreviewSummaryProxyUrl: urlPreviewSummaryProxyUrl.value,
|
}, async (state) => {
|
||||||
}).then(() => {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
fetchInstance(true);
|
urlPreviewEnabled: state.urlPreviewEnabled,
|
||||||
|
urlPreviewTimeout: state.urlPreviewTimeout,
|
||||||
|
urlPreviewMaximumContentLength: state.urlPreviewMaximumContentLength,
|
||||||
|
urlPreviewRequireContentLength: state.urlPreviewRequireContentLength,
|
||||||
|
urlPreviewUserAgent: state.urlPreviewUserAgent,
|
||||||
|
urlPreviewSummaryProxyUrl: state.urlPreviewSummaryProxyUrl,
|
||||||
});
|
});
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
|
||||||
function chooseProxyAccount() {
|
function chooseProxyAccount() {
|
||||||
os.selectUser({ localOnly: true }).then(user => {
|
os.selectUser({ localOnly: true }).then(user => {
|
||||||
proxyAccount.value = user;
|
proxyAccount.value = user;
|
||||||
proxyAccountId.value = user.id;
|
os.apiWithDialog('admin/update-meta', {
|
||||||
saveProxyAccount();
|
proxyAccountId: user.id,
|
||||||
});
|
}).then(() => {
|
||||||
}
|
fetchInstance(true);
|
||||||
|
});
|
||||||
function saveProxyAccount() {
|
|
||||||
os.apiWithDialog('admin/update-meta', {
|
|
||||||
proxyAccountId: proxyAccountId.value,
|
|
||||||
}).then(() => {
|
|
||||||
fetchInstance(true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
55
packages/frontend/src/scripts/use-form.ts
Normal file
55
packages/frontend/src/scripts/use-form.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { computed, Reactive, reactive, watch } from 'vue';
|
||||||
|
|
||||||
|
function copy<T>(v: T): T {
|
||||||
|
return JSON.parse(JSON.stringify(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
function unwrapReactive<T>(v: Reactive<T>): T {
|
||||||
|
return JSON.parse(JSON.stringify(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useForm<T extends Record<string, any>>(initialState: T, save: (newState: T) => Promise<void>) {
|
||||||
|
const currentState = reactive<T>(copy(initialState));
|
||||||
|
const previousState = reactive<T>(copy(initialState));
|
||||||
|
|
||||||
|
const modifiedStates = reactive<Record<keyof T, boolean>>({} as any);
|
||||||
|
for (const key in currentState) {
|
||||||
|
modifiedStates[key] = false;
|
||||||
|
}
|
||||||
|
const modified = computed(() => Object.values(modifiedStates).some(v => v));
|
||||||
|
const modifiedCount = computed(() => Object.values(modifiedStates).filter(v => v).length);
|
||||||
|
|
||||||
|
watch([currentState, previousState], () => {
|
||||||
|
for (const key in modifiedStates) {
|
||||||
|
modifiedStates[key] = currentState[key] !== previousState[key];
|
||||||
|
}
|
||||||
|
}, { deep: true });
|
||||||
|
|
||||||
|
async function _save() {
|
||||||
|
await save(unwrapReactive(currentState));
|
||||||
|
for (const key in currentState) {
|
||||||
|
previousState[key] = copy(currentState[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function discard() {
|
||||||
|
for (const key in currentState) {
|
||||||
|
currentState[key] = copy(previousState[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
state: currentState,
|
||||||
|
savedState: previousState,
|
||||||
|
modifiedStates,
|
||||||
|
modified,
|
||||||
|
modifiedCount,
|
||||||
|
save: _save,
|
||||||
|
discard,
|
||||||
|
};
|
||||||
|
}
|
@ -378,6 +378,16 @@ rt {
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
._modified {
|
||||||
|
margin-left: 0.7em;
|
||||||
|
font-size: 65%;
|
||||||
|
padding: 2px 3px;
|
||||||
|
color: var(--warn);
|
||||||
|
border: solid 1px var(--warn);
|
||||||
|
border-radius: 4px;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
._table {
|
._table {
|
||||||
> ._row {
|
> ._row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Loading…
Reference in New Issue
Block a user