This commit is contained in:
syuilo 2023-05-19 13:35:46 +09:00
parent 0c0ae6ff90
commit 95b9284e79
2 changed files with 24 additions and 25 deletions

View file

@ -1,9 +1,17 @@
<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="init">
none
<div class="_gaps_s">
<MkSwitch v-model="enableChartsForRemoteUser">
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
</MkSwitch>
<MkSwitch v-model="enableChartsForFederatedInstances">
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
</MkSwitch>
</div>
</FormSuspense>
</MkSpacer>
</MkStickyContainer>
@ -17,13 +25,22 @@ import * as os from '@/os';
import { fetchInstance } from '@/instance';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import MkSwitch from '@/components/MkSwitch.vue';
let enableChartsForRemoteUser: boolean = $ref(false);
let enableChartsForFederatedInstances: boolean = $ref(false);
async function init() {
await os.api('admin/meta');
const meta = await os.api('admin/meta');
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
}
function save() {
os.apiWithDialog('admin/update-meta').then(() => {
os.apiWithDialog('admin/update-meta', {
enableChartsForRemoteUser,
enableChartsForFederatedInstances,
}).then(() => {
fetchInstance();
});
}

View file

@ -2,7 +2,7 @@
<div>
<MkStickyContainer>
<template #header><XHeader :tabs="headerTabs"/></template>
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="init">
<div class="_gaps_m">
<MkInput v-model="name">
@ -13,7 +13,7 @@
<template #label>{{ i18n.ts.instanceDescription }}</template>
</MkTextarea>
<FormSplit :min-width="300">
<FormSplit :minWidth="300">
<MkInput v-model="maintainerName">
<template #label>{{ i18n.ts.maintainerName }}</template>
</MkInput>
@ -29,18 +29,6 @@
<template #caption>{{ i18n.ts.pinnedUsersDescription }}</template>
</MkTextarea>
<FormSection>
<div class="_gaps_s">
<MkSwitch v-model="enableChartsForRemoteUser">
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
</MkSwitch>
<MkSwitch v-model="enableChartsForFederatedInstances">
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
</MkSwitch>
</div>
</FormSection>
<FormSection>
<template #label>{{ i18n.ts.theme }}</template>
@ -128,7 +116,7 @@
</MkSpacer>
<template #footer>
<div :class="$style.footer">
<MkSpacer :content-max="700" :margin-min="16" :margin-max="16">
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="16">
<MkButton primary rounded @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
</MkSpacer>
</div>
@ -166,8 +154,6 @@ let defaultDarkTheme: any = $ref(null);
let pinnedUsers: string = $ref('');
let cacheRemoteFiles: boolean = $ref(false);
let enableServiceWorker: boolean = $ref(false);
let enableChartsForRemoteUser: boolean = $ref(false);
let enableChartsForFederatedInstances: boolean = $ref(false);
let swPublicKey: any = $ref(null);
let swPrivateKey: any = $ref(null);
let deeplAuthKey: string = $ref('');
@ -188,8 +174,6 @@ async function init() {
pinnedUsers = meta.pinnedUsers.join('\n');
cacheRemoteFiles = meta.cacheRemoteFiles;
enableServiceWorker = meta.enableServiceWorker;
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
swPublicKey = meta.swPublickey;
swPrivateKey = meta.swPrivateKey;
deeplAuthKey = meta.deeplAuthKey;
@ -211,8 +195,6 @@ function save() {
pinnedUsers: pinnedUsers.split('\n'),
cacheRemoteFiles,
enableServiceWorker,
enableChartsForRemoteUser,
enableChartsForFederatedInstances,
swPublicKey,
swPrivateKey,
deeplAuthKey,