Sharkey/packages/frontend/src/pages/admin/other-settings.vue

114 lines
3.9 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
2023-05-19 06:35:46 +02:00
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="init">
2023-07-08 01:46:42 +02:00
<div class="_gaps">
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableServerMachineStats">
<template #label>{{ i18n.ts.enableServerMachineStats }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2023-09-29 00:57:38 +02:00
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableAchievements">
2023-10-18 19:01:50 +02:00
<template #label>{{ i18n.ts.enableAchievements }}</template>
<template #caption>{{ i18n.ts.turnOffAchievements}}</template>
2023-09-29 00:57:38 +02:00
</MkSwitch>
</div>
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableBotTrending">
2023-10-18 19:01:50 +02:00
<template #label>{{ i18n.ts.enableBotTrending }}</template>
<template #caption>{{ i18n.ts.turnOffBotTrending }}</template>
</MkSwitch>
</div>
2023-07-08 01:46:42 +02:00
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableIdenticonGeneration">
<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2023-07-08 01:46:42 +02:00
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableChartsForRemoteUser">
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2023-05-19 06:35:46 +02:00
2023-07-08 01:46:42 +02:00
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableChartsForFederatedInstances">
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2023-05-19 06:35:46 +02:00
</div>
</FormSuspense>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue';
import XHeader from './_header_.vue';
2022-01-04 13:16:41 +01:00
import FormSuspense from '@/components/form/suspense.vue';
2023-09-19 09:37:43 +02:00
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
2023-09-19 09:37:43 +02:00
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
2023-05-19 06:35:46 +02:00
import MkSwitch from '@/components/MkSwitch.vue';
const enableServerMachineStats = ref<boolean>(false);
2023-12-23 02:09:23 +01:00
const enableAchievements = ref<boolean>(false);
const enableBotTrending = ref<boolean>(false);
const enableIdenticonGeneration = ref<boolean>(false);
const enableChartsForRemoteUser = ref<boolean>(false);
const enableChartsForFederatedInstances = ref<boolean>(false);
async function init() {
const meta = await misskeyApi('admin/meta');
enableServerMachineStats.value = meta.enableServerMachineStats;
2023-12-23 02:09:23 +01:00
enableAchievements.value = meta.enableAchievements;
enableBotTrending.value = meta.enableBotTrending;
enableIdenticonGeneration.value = meta.enableIdenticonGeneration;
enableChartsForRemoteUser.value = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances.value = meta.enableChartsForFederatedInstances;
}
function save() {
2023-05-19 06:35:46 +02:00
os.apiWithDialog('admin/update-meta', {
enableServerMachineStats: enableServerMachineStats.value,
2023-12-23 02:09:23 +01:00
enableAchievements: enableAchievements.value,
enableBotTrending: enableBotTrending.value,
enableIdenticonGeneration: enableIdenticonGeneration.value,
enableChartsForRemoteUser: enableChartsForRemoteUser.value,
enableChartsForFederatedInstances: enableChartsForFederatedInstances.value,
2023-05-19 06:35:46 +02:00
}).then(() => {
fetchInstance(true);
});
}
const headerActions = computed(() => [{
asFullButton: true,
2023-09-30 21:53:52 +02:00
icon: 'ph-check ph-bold ph-lg',
text: i18n.ts.save,
handler: save,
}]);
const headerTabs = computed(() => []);
definePageMetadata(() => ({
title: i18n.ts.other,
2023-09-30 21:53:52 +02:00
icon: 'ph-faders ph-bold ph-lg',
}));
</script>