2020-02-16 19:21:27 +02:00
|
|
|
<template>
|
2021-12-30 14:47:48 +02:00
|
|
|
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
|
2021-04-22 16:29:33 +03:00
|
|
|
<FormSuspense :p="init">
|
2021-12-30 14:47:48 +02:00
|
|
|
<div class="_formRoot">
|
|
|
|
<FormInput v-model="name" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.instanceName }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormTextarea v-model="description" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.instanceDescription }}</template>
|
|
|
|
</FormTextarea>
|
|
|
|
|
|
|
|
<FormInput v-model="iconUrl" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-link"></i></template>
|
|
|
|
<template #label>{{ $ts.iconUrl }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormInput v-model="bannerUrl" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-link"></i></template>
|
|
|
|
<template #label>{{ $ts.bannerUrl }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormInput v-model="backgroundImageUrl" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-link"></i></template>
|
|
|
|
<template #label>{{ $ts.backgroundImageUrl }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
2022-02-09 14:25:48 +02:00
|
|
|
<FormInput v-model="themeColor" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-palette"></i></template>
|
|
|
|
<template #label>{{ $ts.themeColor }}</template>
|
|
|
|
<template #caption>#RRGGBB</template>
|
|
|
|
</FormInput>
|
|
|
|
|
2021-12-30 14:47:48 +02:00
|
|
|
<FormInput v-model="tosUrl" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-link"></i></template>
|
|
|
|
<template #label>{{ $ts.tosUrl }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormSplit :min-width="300">
|
|
|
|
<FormInput v-model="maintainerName" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.maintainerName }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormInput v-model="maintainerEmail" type="email" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-envelope"></i></template>
|
|
|
|
<template #label>{{ $ts.maintainerEmail }}</template>
|
|
|
|
</FormInput>
|
|
|
|
</FormSplit>
|
|
|
|
|
|
|
|
<FormTextarea v-model="pinnedUsers" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.pinnedUsers }}</template>
|
|
|
|
<template #caption>{{ $ts.pinnedUsersDescription }}</template>
|
|
|
|
</FormTextarea>
|
|
|
|
|
|
|
|
<FormInput v-model="maxNoteTextLength" type="number" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-pencil-alt"></i></template>
|
|
|
|
<template #label>{{ $ts.maxNoteTextLength }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
2021-12-30 20:21:26 +02:00
|
|
|
<FormSection>
|
|
|
|
<FormSwitch v-model="enableRegistration" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.enableRegistration }}</template>
|
|
|
|
</FormSwitch>
|
|
|
|
|
|
|
|
<FormSwitch v-model="emailRequiredForSignup" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.emailRequiredForSignup }}</template>
|
|
|
|
</FormSwitch>
|
|
|
|
</FormSection>
|
|
|
|
|
2021-12-30 14:47:48 +02:00
|
|
|
<FormSection>
|
|
|
|
<FormSwitch v-model="enableLocalTimeline" class="_formBlock">{{ $ts.enableLocalTimeline }}</FormSwitch>
|
|
|
|
<FormSwitch v-model="enableGlobalTimeline" class="_formBlock">{{ $ts.enableGlobalTimeline }}</FormSwitch>
|
|
|
|
<FormInfo class="_formBlock">{{ $ts.disablingTimelinesInfo }}</FormInfo>
|
|
|
|
</FormSection>
|
2021-12-30 20:21:26 +02:00
|
|
|
|
|
|
|
<FormSection>
|
|
|
|
<template #label>{{ $ts.files }}</template>
|
|
|
|
|
|
|
|
<FormSwitch v-model="cacheRemoteFiles" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.cacheRemoteFiles }}</template>
|
|
|
|
<template #caption>{{ $ts.cacheRemoteFilesDescription }}</template>
|
|
|
|
</FormSwitch>
|
|
|
|
|
|
|
|
<FormSwitch v-model="proxyRemoteFiles" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.proxyRemoteFiles }}</template>
|
|
|
|
<template #caption>{{ $ts.proxyRemoteFilesDescription }}</template>
|
|
|
|
</FormSwitch>
|
|
|
|
|
|
|
|
<FormSplit :min-width="280">
|
|
|
|
<FormInput v-model="localDriveCapacityMb" type="number" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.driveCapacityPerLocalAccount }}</template>
|
|
|
|
<template #suffix>MB</template>
|
|
|
|
<template #caption>{{ $ts.inMb }}</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormInput v-model="remoteDriveCapacityMb" type="number" :disabled="!cacheRemoteFiles" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.driveCapacityPerRemoteAccount }}</template>
|
|
|
|
<template #suffix>MB</template>
|
|
|
|
<template #caption>{{ $ts.inMb }}</template>
|
|
|
|
</FormInput>
|
|
|
|
</FormSplit>
|
|
|
|
</FormSection>
|
2022-01-04 20:09:20 +02:00
|
|
|
|
|
|
|
<FormSection>
|
|
|
|
<template #label>ServiceWorker</template>
|
|
|
|
|
|
|
|
<FormSwitch v-model="enableServiceWorker" class="_formBlock">
|
|
|
|
<template #label>{{ $ts.enableServiceworker }}</template>
|
|
|
|
<template #caption>{{ $ts.serviceworkerInfo }}</template>
|
|
|
|
</FormSwitch>
|
|
|
|
|
|
|
|
<template v-if="enableServiceWorker">
|
|
|
|
<FormInput v-model="swPublicKey" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-key"></i></template>
|
|
|
|
<template #label>Public key</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormInput v-model="swPrivateKey" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-key"></i></template>
|
|
|
|
<template #label>Private key</template>
|
|
|
|
</FormInput>
|
|
|
|
</template>
|
|
|
|
</FormSection>
|
|
|
|
|
|
|
|
<FormSection>
|
|
|
|
<template #label>DeepL Translation</template>
|
|
|
|
|
|
|
|
<FormInput v-model="deeplAuthKey" class="_formBlock">
|
|
|
|
<template #prefix><i class="fas fa-key"></i></template>
|
|
|
|
<template #label>DeepL Auth Key</template>
|
|
|
|
</FormInput>
|
|
|
|
<FormSwitch v-model="deeplIsPro" class="_formBlock">
|
|
|
|
<template #label>Pro account</template>
|
|
|
|
</FormSwitch>
|
|
|
|
</FormSection>
|
2021-12-30 14:47:48 +02:00
|
|
|
</div>
|
2021-04-22 16:29:33 +03:00
|
|
|
</FormSuspense>
|
2021-12-30 14:47:48 +02:00
|
|
|
</MkSpacer>
|
2020-02-16 19:21:27 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-04-22 16:29:33 +03:00
|
|
|
import { defineComponent } from 'vue';
|
2021-12-30 14:47:48 +02:00
|
|
|
import FormSwitch from '@/components/form/switch.vue';
|
|
|
|
import FormInput from '@/components/form/input.vue';
|
|
|
|
import FormTextarea from '@/components/form/textarea.vue';
|
|
|
|
import FormInfo from '@/components/ui/info.vue';
|
|
|
|
import FormSection from '@/components/form/section.vue';
|
|
|
|
import FormSplit from '@/components/form/split.vue';
|
|
|
|
import FormSuspense from '@/components/form/suspense.vue';
|
2021-11-11 19:02:25 +02:00
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
|
|
|
import { fetchInstance } from '@/instance';
|
2020-02-16 19:21:27 +02:00
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
export default defineComponent({
|
2020-02-16 19:21:27 +02:00
|
|
|
components: {
|
2021-04-22 16:29:33 +03:00
|
|
|
FormSwitch,
|
|
|
|
FormInput,
|
2021-12-30 14:47:48 +02:00
|
|
|
FormSuspense,
|
2021-04-22 16:29:33 +03:00
|
|
|
FormTextarea,
|
|
|
|
FormInfo,
|
2021-12-30 14:47:48 +02:00
|
|
|
FormSection,
|
|
|
|
FormSplit,
|
2020-02-16 19:21:27 +02:00
|
|
|
},
|
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
emits: ['info'],
|
|
|
|
|
2020-02-16 19:21:27 +02:00
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 06:54:12 +03:00
|
|
|
[symbols.PAGE_INFO]: {
|
2021-04-22 16:29:33 +03:00
|
|
|
title: this.$ts.general,
|
2021-10-10 09:19:16 +03:00
|
|
|
icon: 'fas fa-cog',
|
|
|
|
bg: 'var(--bg)',
|
2021-12-30 14:47:48 +02:00
|
|
|
actions: [{
|
|
|
|
asFullButton: true,
|
|
|
|
icon: 'fas fa-check',
|
|
|
|
text: this.$ts.save,
|
|
|
|
handler: this.save,
|
|
|
|
}],
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
2020-02-16 19:21:27 +02:00
|
|
|
name: null,
|
|
|
|
description: null,
|
2020-07-26 05:05:26 +03:00
|
|
|
tosUrl: null as string | null,
|
2021-04-22 16:29:33 +03:00
|
|
|
maintainerName: null,
|
|
|
|
maintainerEmail: null,
|
2020-02-16 19:21:27 +02:00
|
|
|
iconUrl: null,
|
2021-04-22 16:29:33 +03:00
|
|
|
bannerUrl: null,
|
2021-06-08 06:17:17 +03:00
|
|
|
backgroundImageUrl: null,
|
2022-02-09 14:25:48 +02:00
|
|
|
themeColor: null,
|
2020-02-16 19:21:27 +02:00
|
|
|
maxNoteTextLength: 0,
|
|
|
|
enableLocalTimeline: false,
|
|
|
|
enableGlobalTimeline: false,
|
2021-10-10 11:47:57 +03:00
|
|
|
pinnedUsers: '',
|
2021-12-30 20:21:26 +02:00
|
|
|
cacheRemoteFiles: false,
|
|
|
|
proxyRemoteFiles: false,
|
|
|
|
localDriveCapacityMb: 0,
|
|
|
|
remoteDriveCapacityMb: 0,
|
|
|
|
enableRegistration: false,
|
|
|
|
emailRequiredForSignup: false,
|
2022-01-04 20:09:20 +02:00
|
|
|
enableServiceWorker: false,
|
|
|
|
swPublicKey: null,
|
|
|
|
swPrivateKey: null,
|
|
|
|
deeplAuthKey: '',
|
|
|
|
deeplIsPro: false,
|
2020-02-16 19:21:27 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-04-29 03:35:37 +03:00
|
|
|
methods: {
|
2021-04-22 16:29:33 +03:00
|
|
|
async init() {
|
|
|
|
const meta = await os.api('meta', { detail: true });
|
|
|
|
this.name = meta.name;
|
|
|
|
this.description = meta.description;
|
|
|
|
this.tosUrl = meta.tosUrl;
|
|
|
|
this.iconUrl = meta.iconUrl;
|
|
|
|
this.bannerUrl = meta.bannerUrl;
|
2021-06-08 06:17:17 +03:00
|
|
|
this.backgroundImageUrl = meta.backgroundImageUrl;
|
2022-02-09 14:25:48 +02:00
|
|
|
this.themeColor = meta.themeColor;
|
2021-04-22 16:29:33 +03:00
|
|
|
this.maintainerName = meta.maintainerName;
|
|
|
|
this.maintainerEmail = meta.maintainerEmail;
|
|
|
|
this.maxNoteTextLength = meta.maxNoteTextLength;
|
|
|
|
this.enableLocalTimeline = !meta.disableLocalTimeline;
|
|
|
|
this.enableGlobalTimeline = !meta.disableGlobalTimeline;
|
2021-10-10 11:47:57 +03:00
|
|
|
this.pinnedUsers = meta.pinnedUsers.join('\n');
|
2021-12-30 20:21:26 +02:00
|
|
|
this.cacheRemoteFiles = meta.cacheRemoteFiles;
|
|
|
|
this.proxyRemoteFiles = meta.proxyRemoteFiles;
|
|
|
|
this.localDriveCapacityMb = meta.driveCapacityPerLocalUserMb;
|
|
|
|
this.remoteDriveCapacityMb = meta.driveCapacityPerRemoteUserMb;
|
|
|
|
this.enableRegistration = !meta.disableRegistration;
|
|
|
|
this.emailRequiredForSignup = meta.emailRequiredForSignup;
|
2022-01-04 20:09:20 +02:00
|
|
|
this.enableServiceWorker = meta.enableServiceWorker;
|
|
|
|
this.swPublicKey = meta.swPublickey;
|
|
|
|
this.swPrivateKey = meta.swPrivateKey;
|
|
|
|
this.deeplAuthKey = meta.deeplAuthKey;
|
|
|
|
this.deeplIsPro = meta.deeplIsPro;
|
2020-03-21 16:27:54 +02:00
|
|
|
},
|
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
save() {
|
|
|
|
os.apiWithDialog('admin/update-meta', {
|
2020-02-16 19:21:27 +02:00
|
|
|
name: this.name,
|
|
|
|
description: this.description,
|
|
|
|
tosUrl: this.tosUrl,
|
|
|
|
iconUrl: this.iconUrl,
|
2021-04-22 16:29:33 +03:00
|
|
|
bannerUrl: this.bannerUrl,
|
2021-06-08 06:17:17 +03:00
|
|
|
backgroundImageUrl: this.backgroundImageUrl,
|
2022-02-09 14:25:48 +02:00
|
|
|
themeColor: this.themeColor === '' ? null : this.themeColor,
|
2020-02-16 19:21:27 +02:00
|
|
|
maintainerName: this.maintainerName,
|
|
|
|
maintainerEmail: this.maintainerEmail,
|
|
|
|
maxNoteTextLength: this.maxNoteTextLength,
|
|
|
|
disableLocalTimeline: !this.enableLocalTimeline,
|
|
|
|
disableGlobalTimeline: !this.enableGlobalTimeline,
|
2021-10-10 11:47:57 +03:00
|
|
|
pinnedUsers: this.pinnedUsers.split('\n'),
|
2021-12-30 20:21:26 +02:00
|
|
|
cacheRemoteFiles: this.cacheRemoteFiles,
|
|
|
|
proxyRemoteFiles: this.proxyRemoteFiles,
|
|
|
|
localDriveCapacityMb: parseInt(this.localDriveCapacityMb, 10),
|
|
|
|
remoteDriveCapacityMb: parseInt(this.remoteDriveCapacityMb, 10),
|
|
|
|
disableRegistration: !this.enableRegistration,
|
|
|
|
emailRequiredForSignup: this.emailRequiredForSignup,
|
2022-01-04 20:09:20 +02:00
|
|
|
enableServiceWorker: this.enableServiceWorker,
|
|
|
|
swPublicKey: this.swPublicKey,
|
|
|
|
swPrivateKey: this.swPrivateKey,
|
|
|
|
deeplAuthKey: this.deeplAuthKey,
|
|
|
|
deeplIsPro: this.deeplIsPro,
|
2020-02-16 19:21:27 +02:00
|
|
|
}).then(() => {
|
2020-12-19 03:55:52 +02:00
|
|
|
fetchInstance();
|
2020-02-16 19:21:27 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|