summaryrefslogtreecommitdiff
path: root/src/client/pages/instance/settings.vue
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-04-22 22:29:33 +0900
committerGitHub <noreply@github.com>2021-04-22 22:29:33 +0900
commit246693b8484b72048cb515b76aa5f094f5fdeb56 (patch)
tree703f7636c363b480b20690495353691e09c98a27 /src/client/pages/instance/settings.vue
parentfix style (diff)
downloadmisskey-246693b8484b72048cb515b76aa5f094f5fdeb56.tar.gz
misskey-246693b8484b72048cb515b76aa5f094f5fdeb56.tar.bz2
misskey-246693b8484b72048cb515b76aa5f094f5fdeb56.zip
インスタンス管理画面作り直し (#7473)
* wip * wip * wip * wip
Diffstat (limited to 'src/client/pages/instance/settings.vue')
-rw-r--r--src/client/pages/instance/settings.vue607
1 files changed, 79 insertions, 528 deletions
diff --git a/src/client/pages/instance/settings.vue b/src/client/pages/instance/settings.vue
index b827a77649..66f01c42c7 100644
--- a/src/client/pages/instance/settings.vue
+++ b/src/client/pages/instance/settings.vue
@@ -1,581 +1,132 @@
<template>
-<div v-if="meta" class="_section">
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-info-circle"></i> {{ $ts.basicInfo }}</div>
- <div class="_content">
- <MkInput v-model:value="name">{{ $ts.instanceName }}</MkInput>
- <MkTextarea v-model:value="description">{{ $ts.instanceDescription }}</MkTextarea>
- <MkInput v-model:value="iconUrl"><template #icon><i class="fas fa-link"></i></template>{{ $ts.iconUrl }}</MkInput>
- <MkInput v-model:value="bannerUrl"><template #icon><i class="fas fa-link"></i></template>{{ $ts.bannerUrl }}</MkInput>
- <MkInput v-model:value="backgroundImageUrl"><template #icon><i class="fas fa-link"></i></template>{{ $ts.backgroundImageUrl }}</MkInput>
- <MkInput v-model:value="logoImageUrl"><template #icon><i class="fas fa-link"></i></template>{{ $ts.logoImageUrl }}</MkInput>
- <MkInput v-model:value="tosUrl"><template #icon><i class="fas fa-link"></i></template>{{ $ts.tosUrl }}</MkInput>
- <MkInput v-model:value="maintainerName">{{ $ts.maintainerName }}</MkInput>
- <MkInput v-model:value="maintainerEmail" type="email"><template #icon><i class="fas fa-envelope"></i></template>{{ $ts.maintainerEmail }}</MkInput>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
+<FormBase>
+ <FormSuspense :p="init">
+ <FormInput v-model:value="name">
+ <span>{{ $ts.instanceName }}</span>
+ </FormInput>
- <MkInput v-model:value="pinnedClipId">{{ $ts.pinnedClipId }}</MkInput>
+ <FormTextarea v-model:value="description">
+ <span>{{ $ts.instanceDescription }}</span>
+ </FormTextarea>
- <section class="_card _gap">
- <div class="_content">
- <MkInput v-model:value="maxNoteTextLength" type="number" :save="() => save()"><template #icon><i class="fas fa-pencil-alt"></i></template>{{ $ts.maxNoteTextLength }}</MkInput>
- </div>
- <div class="_content">
- <MkSwitch v-model:value="enableLocalTimeline" @update:value="save()">{{ $ts.enableLocalTimeline }}</MkSwitch>
- <MkSwitch v-model:value="enableGlobalTimeline" @update:value="save()">{{ $ts.enableGlobalTimeline }}</MkSwitch>
- <MkInfo>{{ $ts.disablingTimelinesInfo }}</MkInfo>
- </div>
- <div class="_content">
- <MkSwitch v-model:value="useStarForReactionFallback" @update:value="save()">{{ $ts.useStarForReactionFallback }}</MkSwitch>
- </div>
- </section>
+ <FormInput v-model:value="iconUrl">
+ <template #prefix><i class="fas fa-link"></i></template>
+ <span>{{ $ts.iconUrl }}</span>
+ </FormInput>
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-user"></i> {{ $ts.registration }}</div>
- <div class="_content">
- <MkSwitch v-model:value="enableRegistration" @update:value="save()">{{ $ts.enableRegistration }}</MkSwitch>
- <MkButton v-if="!enableRegistration" @click="invite">{{ $ts.invite }}</MkButton>
- </div>
- </section>
+ <FormInput v-model:value="bannerUrl">
+ <template #prefix><i class="fas fa-link"></i></template>
+ <span>{{ $ts.bannerUrl }}</span>
+ </FormInput>
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-shield-alt"></i> {{ $ts.hcaptcha }}</div>
- <div class="_content">
- <MkSwitch v-model:value="enableHcaptcha">{{ $ts.enableHcaptcha }}</MkSwitch>
- <template v-if="enableHcaptcha">
- <MkInput v-model:value="hcaptchaSiteKey" :disabled="!enableHcaptcha"><template #icon><i class="fas fa-key"></i></template>{{ $ts.hcaptchaSiteKey }}</MkInput>
- <MkInput v-model:value="hcaptchaSecretKey" :disabled="!enableHcaptcha"><template #icon><i class="fas fa-key"></i></template>{{ $ts.hcaptchaSecretKey }}</MkInput>
- </template>
- </div>
- <div class="_content" v-if="enableHcaptcha">
- <header>{{ $ts.preview }}</header>
- <captcha v-if="enableHcaptcha" provider="hcaptcha" :sitekey="hcaptchaSiteKey || '10000000-ffff-ffff-ffff-000000000001'"/>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
+ <FormInput v-model:value="tosUrl">
+ <template #prefix><i class="fas fa-link"></i></template>
+ <span>{{ $ts.tosUrl }}</span>
+ </FormInput>
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-shield-alt"></i> {{ $ts.recaptcha }}</div>
- <div class="_content">
- <MkSwitch v-model:value="enableRecaptcha" ref="enableRecaptcha">{{ $ts.enableRecaptcha }}</MkSwitch>
- <template v-if="enableRecaptcha">
- <MkInput v-model:value="recaptchaSiteKey" :disabled="!enableRecaptcha"><template #icon><i class="fas fa-key"></i></template>{{ $ts.recaptchaSiteKey }}</MkInput>
- <MkInput v-model:value="recaptchaSecretKey" :disabled="!enableRecaptcha"><template #icon><i class="fas fa-key"></i></template>{{ $ts.recaptchaSecretKey }}</MkInput>
- </template>
- </div>
- <div class="_content" v-if="enableRecaptcha && recaptchaSiteKey">
- <header>{{ $ts.preview }}</header>
- <captcha v-if="enableRecaptcha" provider="grecaptcha" :sitekey="recaptchaSiteKey"/>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
+ <FormInput v-model:value="maintainerName">
+ <span>{{ $ts.maintainerName }}</span>
+ </FormInput>
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-envelope"></i> {{ $ts.emailConfig }}</div>
- <div class="_content">
- <MkSwitch v-model:value="enableEmail" @update:value="save()">{{ $ts.enableEmail }}<template #desc>{{ $ts.emailConfigInfo }}</template></MkSwitch>
- <MkInput v-model:value="email" type="email" :disabled="!enableEmail">{{ $ts.email }}</MkInput>
- <div><b>{{ $ts.smtpConfig }}</b></div>
- <div class="_inputs">
- <MkInput v-model:value="smtpHost" :disabled="!enableEmail">{{ $ts.smtpHost }}</MkInput>
- <MkInput v-model:value="smtpPort" type="number" :disabled="!enableEmail">{{ $ts.smtpPort }}</MkInput>
- </div>
- <div class="_inputs">
- <MkInput v-model:value="smtpUser" :disabled="!enableEmail">{{ $ts.smtpUser }}</MkInput>
- <MkInput v-model:value="smtpPass" type="password" :disabled="!enableEmail">{{ $ts.smtpPass }}</MkInput>
- </div>
- <MkInfo>{{ $ts.emptyToDisableSmtpAuth }}</MkInfo>
- <MkSwitch v-model:value="smtpSecure" :disabled="!enableEmail">{{ $ts.smtpSecure }}<template #desc>{{ $ts.smtpSecureInfo }}</template></MkSwitch>
- <div>
- <MkButton :disabled="!enableEmail" primary inline @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- <MkButton :disabled="!enableEmail" inline @click="testEmail()">{{ $ts.testEmail }}</MkButton>
- </div>
- </div>
- </section>
+ <FormInput v-model:value="maintainerEmail" type="email">
+ <template #prefix><i class="fas fa-envelope"></i></template>
+ <span>{{ $ts.maintainerEmail }}</span>
+ </FormInput>
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-bolt"></i> {{ $ts.serviceworker }}</div>
- <div class="_content">
- <MkSwitch v-model:value="enableServiceWorker">{{ $ts.enableServiceworker }}<template #desc>{{ $ts.serviceworkerInfo }}</template></MkSwitch>
- <template v-if="enableServiceWorker">
- <div class="_inputs">
- <MkInput v-model:value="swPublicKey" :disabled="!enableServiceWorker"><template #icon><i class="fas fa-key"></i></template>Public key</MkInput>
- <MkInput v-model:value="swPrivateKey" :disabled="!enableServiceWorker"><template #icon><i class="fas fa-key"></i></template>Private key</MkInput>
- </div>
- </template>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
+ <FormInput v-model:value="maxNoteTextLength" type="number">
+ <template #prefix><i class="fas fa-pencil-alt"></i></template>
+ <span>{{ $ts.maxNoteTextLength }}</span>
+ </FormInput>
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-thumbtack"></i> {{ $ts.pinnedUsers }}</div>
- <div class="_content">
- <MkTextarea v-model:value="pinnedUsers">
- <template #desc>{{ $ts.pinnedUsersDescription }} <button class="_textButton" @click="addPinUser">{{ $ts.addUser }}</button></template>
- </MkTextarea>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
+ <FormSwitch v-model:value="enableLocalTimeline">{{ $ts.enableLocalTimeline }}</FormSwitch>
+ <FormSwitch v-model:value="enableGlobalTimeline">{{ $ts.enableGlobalTimeline }}</FormSwitch>
+ <FormInfo>{{ $ts.disablingTimelinesInfo }}</FormInfo>
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-thumbtack"></i> {{ $ts.pinnedPages }}</div>
- <div class="_content">
- <MkTextarea v-model:value="pinnedPages">
- <template #desc>{{ $ts.pinnedPagesDescription }}</template>
- </MkTextarea>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
-
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-cloud"></i> {{ $ts.files }}</div>
- <div class="_content">
- <MkSwitch v-model:value="cacheRemoteFiles">{{ $ts.cacheRemoteFiles }}<template #desc>{{ $ts.cacheRemoteFilesDescription }}</template></MkSwitch>
- <MkSwitch v-model:value="proxyRemoteFiles">{{ $ts.proxyRemoteFiles }}<template #desc>{{ $ts.proxyRemoteFilesDescription }}</template></MkSwitch>
- <MkInput v-model:value="localDriveCapacityMb" type="number">{{ $ts.driveCapacityPerLocalAccount }}<template #suffix>MB</template><template #desc>{{ $ts.inMb }}</template></MkInput>
- <MkInput v-model:value="remoteDriveCapacityMb" type="number" :disabled="!cacheRemoteFiles">{{ $ts.driveCapacityPerRemoteAccount }}<template #suffix>MB</template><template #desc>{{ $ts.inMb }}</template></MkInput>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
-
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-cloud"></i> {{ $ts.objectStorage }}</div>
- <div class="_content">
- <MkSwitch v-model:value="useObjectStorage">{{ $ts.useObjectStorage }}</MkSwitch>
- <template v-if="useObjectStorage">
- <MkInput v-model:value="objectStorageBaseUrl" :disabled="!useObjectStorage">{{ $ts.objectStorageBaseUrl }}<template #desc>{{ $ts.objectStorageBaseUrlDesc }}</template></MkInput>
- <div class="_inputs">
- <MkInput v-model:value="objectStorageBucket" :disabled="!useObjectStorage">{{ $ts.objectStorageBucket }}<template #desc>{{ $ts.objectStorageBucketDesc }}</template></MkInput>
- <MkInput v-model:value="objectStoragePrefix" :disabled="!useObjectStorage">{{ $ts.objectStoragePrefix }}<template #desc>{{ $ts.objectStoragePrefixDesc }}</template></MkInput>
- </div>
- <MkInput v-model:value="objectStorageEndpoint" :disabled="!useObjectStorage">{{ $ts.objectStorageEndpoint }}<template #desc>{{ $ts.objectStorageEndpointDesc }}</template></MkInput>
- <div class="_inputs">
- <MkInput v-model:value="objectStorageRegion" :disabled="!useObjectStorage">{{ $ts.objectStorageRegion }}<template #desc>{{ $ts.objectStorageRegionDesc }}</template></MkInput>
- </div>
- <div class="_inputs">
- <MkInput v-model:value="objectStorageAccessKey" :disabled="!useObjectStorage"><template #icon><i class="fas fa-key"></i></template>Access key</MkInput>
- <MkInput v-model:value="objectStorageSecretKey" :disabled="!useObjectStorage"><template #icon><i class="fas fa-key"></i></template>Secret key</MkInput>
- </div>
- <MkSwitch v-model:value="objectStorageUseSSL" :disabled="!useObjectStorage">{{ $ts.objectStorageUseSSL }}<template #desc>{{ $ts.objectStorageUseSSLDesc }}</template></MkSwitch>
- <MkSwitch v-model:value="objectStorageUseProxy" :disabled="!useObjectStorage">{{ $ts.objectStorageUseProxy }}<template #desc>{{ $ts.objectStorageUseProxyDesc }}</template></MkSwitch>
- <MkSwitch v-model:value="objectStorageSetPublicRead" :disabled="!useObjectStorage">{{ $ts.objectStorageSetPublicRead }}</MkSwitch>
- <MkSwitch v-model:value="objectStorageS3ForcePathStyle" :disabled="!useObjectStorage">s3ForcePathStyle</MkSwitch>
- </template>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
-
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-ghost"></i> {{ $ts.proxyAccount }}</div>
- <div class="_content">
- <MkInput :value="proxyAccount ? proxyAccount.username : null" disabled><template #prefix>@</template>{{ $ts.proxyAccount }}<template #desc>{{ $ts.proxyAccountDescription }}</template></MkInput>
- <MkButton primary @click="chooseProxyAccount">{{ $ts.chooseProxyAccount }}</MkButton>
- </div>
- </section>
-
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-ban"></i> {{ $ts.blockedInstances }}</div>
- <div class="_content">
- <MkTextarea v-model:value="blockedHosts">
- <template #desc>{{ $ts.blockedInstancesDescription }}</template>
- </MkTextarea>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
-
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-share-alt"></i> {{ $ts.integration }}</div>
- <div class="_content">
- <header><i class="fab fa-twitter"></i> Twitter</header>
- <MkSwitch v-model:value="enableTwitterIntegration">{{ $ts.enable }}</MkSwitch>
- <template v-if="enableTwitterIntegration">
- <MkInfo>Callback URL: {{ `${url}/api/tw/cb` }}</MkInfo>
- <MkInput v-model:value="twitterConsumerKey" :disabled="!enableTwitterIntegration"><template #icon><i class="fas fa-key"></i></template>Consumer Key</MkInput>
- <MkInput v-model:value="twitterConsumerSecret" :disabled="!enableTwitterIntegration"><template #icon><i class="fas fa-key"></i></template>Consumer Secret</MkInput>
- </template>
- </div>
- <div class="_content">
- <header><i class="fas fa-github"></i> GitHub</header>
- <MkSwitch v-model:value="enableGithubIntegration">{{ $ts.enable }}</MkSwitch>
- <template v-if="enableGithubIntegration">
- <MkInfo>Callback URL: {{ `${url}/api/gh/cb` }}</MkInfo>
- <MkInput v-model:value="githubClientId" :disabled="!enableGithubIntegration"><template #icon><i class="fas fa-key"></i></template>Client ID</MkInput>
- <MkInput v-model:value="githubClientSecret" :disabled="!enableGithubIntegration"><template #icon><i class="fas fa-key"></i></template>Client Secret</MkInput>
- </template>
- </div>
- <div class="_content">
- <header><i class="fas fa-discord"></i> Discord</header>
- <MkSwitch v-model:value="enableDiscordIntegration">{{ $ts.enable }}</MkSwitch>
- <template v-if="enableDiscordIntegration">
- <MkInfo>Callback URL: {{ `${url}/api/dc/cb` }}</MkInfo>
- <MkInput v-model:value="discordClientId" :disabled="!enableDiscordIntegration"><template #icon><i class="fas fa-key"></i></template>Client ID</MkInput>
- <MkInput v-model:value="discordClientSecret" :disabled="!enableDiscordIntegration"><template #icon><i class="fas fa-key"></i></template>Client Secret</MkInput>
- </template>
- </div>
- <div class="_footer">
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
-
- <section class="_card _gap">
- <div class="_title"><i class="fas fa-archway"></i> Summaly Proxy</div>
- <div class="_content">
- <MkInput v-model:value="summalyProxy">URL</MkInput>
- <MkButton primary @click="save(true)"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
- </div>
- </section>
-</div>
+ <FormButton @click="save" primary><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
+ </FormSuspense>
+</FormBase>
</template>
<script lang="ts">
-import { defineComponent, defineAsyncComponent } from 'vue';
-import MkButton from '@client/components/ui/button.vue';
-import MkInput from '@client/components/ui/input.vue';
-import MkTextarea from '@client/components/ui/textarea.vue';
-import MkSwitch from '@client/components/ui/switch.vue';
-import MkInfo from '@client/components/ui/info.vue';
-import { url } from '@client/config';
-import getAcct from '@/misc/acct/render';
+import { defineComponent } from 'vue';
+import FormSwitch from '@client/components/form/switch.vue';
+import FormInput from '@client/components/form/input.vue';
+import FormButton from '@client/components/form/button.vue';
+import FormBase from '@client/components/form/base.vue';
+import FormGroup from '@client/components/form/group.vue';
+import FormTextarea from '@client/components/form/textarea.vue';
+import FormInfo from '@client/components/form/info.vue';
+import FormSuspense from '@client/components/form/suspense.vue';
import * as os from '@client/os';
-import { fetchInstance } from '@client/instance';
import * as symbols from '@client/symbols';
+import { fetchInstance } from '@client/instance';
export default defineComponent({
components: {
- MkButton,
- MkInput,
- MkTextarea,
- MkSwitch,
- MkInfo,
- Captcha: defineAsyncComponent(() => import('@client/components/captcha.vue')),
+ FormSwitch,
+ FormInput,
+ FormBase,
+ FormGroup,
+ FormButton,
+ FormTextarea,
+ FormInfo,
+ FormSuspense,
},
+ emits: ['info'],
+
data() {
return {
[symbols.PAGE_INFO]: {
- title: this.$ts.instance,
- icon: 'fas fa-cog',
+ title: this.$ts.general,
+ icon: 'fas fa-cog'
},
- meta: null,
- url,
- proxyAccount: null,
- proxyAccountId: null,
- cacheRemoteFiles: false,
- proxyRemoteFiles: false,
- localDriveCapacityMb: 0,
- remoteDriveCapacityMb: 0,
- blockedHosts: '',
- pinnedUsers: '',
- pinnedPages: '',
- pinnedClipId: null,
- maintainerName: null,
- maintainerEmail: null,
name: null,
description: null,
tosUrl: null as string | null,
- enableEmail: false,
- email: null,
- bannerUrl: null,
+ maintainerName: null,
+ maintainerEmail: null,
iconUrl: null,
- logoImageUrl: null,
- backgroundImageUrl: null,
+ bannerUrl: null,
maxNoteTextLength: 0,
- enableRegistration: false,
enableLocalTimeline: false,
enableGlobalTimeline: false,
- enableHcaptcha: false,
- hcaptchaSiteKey: null,
- hcaptchaSecretKey: null,
- enableRecaptcha: false,
- recaptchaSiteKey: null,
- recaptchaSecretKey: null,
- enableServiceWorker: false,
- swPublicKey: null,
- swPrivateKey: null,
- useObjectStorage: false,
- objectStorageBaseUrl: null,
- objectStorageBucket: null,
- objectStoragePrefix: null,
- objectStorageEndpoint: null,
- objectStorageRegion: null,
- objectStoragePort: null,
- objectStorageAccessKey: null,
- objectStorageSecretKey: null,
- objectStorageUseSSL: false,
- objectStorageUseProxy: false,
- objectStorageSetPublicRead: false,
- objectStorageS3ForcePathStyle: true,
- enableTwitterIntegration: false,
- twitterConsumerKey: null,
- twitterConsumerSecret: null,
- enableGithubIntegration: false,
- githubClientId: null,
- githubClientSecret: null,
- enableDiscordIntegration: false,
- discordClientId: null,
- discordClientSecret: null,
- useStarForReactionFallback: false,
- smtpSecure: false,
- smtpHost: '',
- smtpPort: 0,
- smtpUser: '',
- smtpPass: '',
- summalyProxy: '',
- }
- },
-
- async created() {
- this.meta = await os.api('meta', { detail: true });
-
- this.name = this.meta.name;
- this.description = this.meta.description;
- this.tosUrl = this.meta.tosUrl;
- this.bannerUrl = this.meta.bannerUrl;
- this.iconUrl = this.meta.iconUrl;
- this.logoImageUrl = this.meta.logoImageUrl;
- this.backgroundImageUrl = this.meta.backgroundImageUrl;
- this.enableEmail = this.meta.enableEmail;
- this.email = this.meta.email;
- this.maintainerName = this.meta.maintainerName;
- this.maintainerEmail = this.meta.maintainerEmail;
- this.maxNoteTextLength = this.meta.maxNoteTextLength;
- this.enableRegistration = !this.meta.disableRegistration;
- this.enableLocalTimeline = !this.meta.disableLocalTimeline;
- this.enableGlobalTimeline = !this.meta.disableGlobalTimeline;
- this.enableHcaptcha = this.meta.enableHcaptcha;
- this.hcaptchaSiteKey = this.meta.hcaptchaSiteKey;
- this.hcaptchaSecretKey = this.meta.hcaptchaSecretKey;
- this.enableRecaptcha = this.meta.enableRecaptcha;
- this.recaptchaSiteKey = this.meta.recaptchaSiteKey;
- this.recaptchaSecretKey = this.meta.recaptchaSecretKey;
- this.proxyAccountId = this.meta.proxyAccountId;
- this.cacheRemoteFiles = this.meta.cacheRemoteFiles;
- this.proxyRemoteFiles = this.meta.proxyRemoteFiles;
- this.localDriveCapacityMb = this.meta.driveCapacityPerLocalUserMb;
- this.remoteDriveCapacityMb = this.meta.driveCapacityPerRemoteUserMb;
- this.blockedHosts = this.meta.blockedHosts.join('\n');
- this.pinnedUsers = this.meta.pinnedUsers.join('\n');
- this.pinnedPages = this.meta.pinnedPages.join('\n');
- this.pinnedClipId = this.meta.pinnedClipId;
- this.enableServiceWorker = this.meta.enableServiceWorker;
- this.swPublicKey = this.meta.swPublickey;
- this.swPrivateKey = this.meta.swPrivateKey;
- this.useObjectStorage = this.meta.useObjectStorage;
- this.objectStorageBaseUrl = this.meta.objectStorageBaseUrl;
- this.objectStorageBucket = this.meta.objectStorageBucket;
- this.objectStoragePrefix = this.meta.objectStoragePrefix;
- this.objectStorageEndpoint = this.meta.objectStorageEndpoint;
- this.objectStorageRegion = this.meta.objectStorageRegion;
- this.objectStoragePort = this.meta.objectStoragePort;
- this.objectStorageAccessKey = this.meta.objectStorageAccessKey;
- this.objectStorageSecretKey = this.meta.objectStorageSecretKey;
- this.objectStorageUseSSL = this.meta.objectStorageUseSSL;
- this.objectStorageUseProxy = this.meta.objectStorageUseProxy;
- this.objectStorageSetPublicRead = this.meta.objectStorageSetPublicRead;
- this.objectStorageS3ForcePathStyle = this.meta.objectStorageS3ForcePathStyle;
- this.enableTwitterIntegration = this.meta.enableTwitterIntegration;
- this.twitterConsumerKey = this.meta.twitterConsumerKey;
- this.twitterConsumerSecret = this.meta.twitterConsumerSecret;
- this.enableGithubIntegration = this.meta.enableGithubIntegration;
- this.githubClientId = this.meta.githubClientId;
- this.githubClientSecret = this.meta.githubClientSecret;
- this.enableDiscordIntegration = this.meta.enableDiscordIntegration;
- this.discordClientId = this.meta.discordClientId;
- this.discordClientSecret = this.meta.discordClientSecret;
- this.useStarForReactionFallback = this.meta.useStarForReactionFallback;
- this.smtpSecure = this.meta.smtpSecure;
- this.smtpHost = this.meta.smtpHost;
- this.smtpPort = this.meta.smtpPort;
- this.smtpUser = this.meta.smtpUser;
- this.smtpPass = this.meta.smtpPass;
- this.summalyProxy = this.meta.summalyProxy;
-
- if (this.proxyAccountId) {
- os.api('users/show', { userId: this.proxyAccountId }).then(proxyAccount => {
- this.proxyAccount = proxyAccount;
- });
}
},
- mounted() {
- this.$watch('enableHcaptcha', () => {
- if (this.enableHcaptcha && this.enableRecaptcha) {
- os.dialog({
- type: 'question', // warning だと間違って cancel するかもしれない
- showCancelButton: true,
- title: this.$ts.settingGuide,
- text: this.$ts.avoidMultiCaptchaConfirm,
- }).then(({ canceled }) => {
- if (canceled) {
- return;
- }
-
- this.enableRecaptcha = false;
- });
- }
- });
-
- this.$watch('enableRecaptcha', () => {
- if (this.enableRecaptcha && this.enableHcaptcha) {
- os.dialog({
- type: 'question', // warning だと間違って cancel するかもしれない
- showCancelButton: true,
- title: this.$ts.settingGuide,
- text: this.$ts.avoidMultiCaptchaConfirm,
- }).then(({ canceled }) => {
- if (canceled) {
- return;
- }
-
- this.enableHcaptcha = false;
- });
- }
- });
+ async mounted() {
+ this.$emit('info', this[symbols.PAGE_INFO]);
},
methods: {
- invite() {
- os.api('admin/invite').then(x => {
- os.dialog({
- type: 'info',
- text: x.code
- });
- }).catch(e => {
- os.dialog({
- type: 'error',
- text: e
- });
- });
- },
-
- addPinUser() {
- os.selectUser().then(user => {
- this.pinnedUsers = this.pinnedUsers.trim();
- this.pinnedUsers += '\n@' + getAcct(user);
- this.pinnedUsers = this.pinnedUsers.trim();
- });
+ 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;
+ this.maintainerName = meta.maintainerName;
+ this.maintainerEmail = meta.maintainerEmail;
+ this.maxNoteTextLength = meta.maxNoteTextLength;
+ this.enableLocalTimeline = !meta.disableLocalTimeline;
+ this.enableGlobalTimeline = !meta.disableGlobalTimeline;
},
- chooseProxyAccount() {
- os.selectUser().then(user => {
- this.proxyAccount = user;
- this.proxyAccountId = user.id;
- this.save(true);
- });
- },
-
- async testEmail() {
- os.api('admin/send-email', {
- to: this.maintainerEmail,
- subject: 'Test email',
- text: 'Yo'
- }).then(x => {
- os.dialog({
- type: 'success',
- splash: true
- });
- }).catch(e => {
- os.dialog({
- type: 'error',
- text: e
- });
- });
- },
-
- save(withDialog = false) {
- os.api('admin/update-meta', {
+ save() {
+ os.apiWithDialog('admin/update-meta', {
name: this.name,
description: this.description,
tosUrl: this.tosUrl,
- bannerUrl: this.bannerUrl,
iconUrl: this.iconUrl,
- logoImageUrl: this.logoImageUrl,
- backgroundImageUrl: this.backgroundImageUrl,
+ bannerUrl: this.bannerUrl,
maintainerName: this.maintainerName,
maintainerEmail: this.maintainerEmail,
maxNoteTextLength: this.maxNoteTextLength,
- disableRegistration: !this.enableRegistration,
disableLocalTimeline: !this.enableLocalTimeline,
disableGlobalTimeline: !this.enableGlobalTimeline,
- enableHcaptcha: this.enableHcaptcha,
- hcaptchaSiteKey: this.hcaptchaSiteKey,
- hcaptchaSecretKey: this.hcaptchaSecretKey,
- enableRecaptcha: this.enableRecaptcha,
- recaptchaSiteKey: this.recaptchaSiteKey,
- recaptchaSecretKey: this.recaptchaSecretKey,
- proxyAccountId: this.proxyAccountId,
- cacheRemoteFiles: this.cacheRemoteFiles,
- proxyRemoteFiles: this.proxyRemoteFiles,
- localDriveCapacityMb: parseInt(this.localDriveCapacityMb, 10),
- remoteDriveCapacityMb: parseInt(this.remoteDriveCapacityMb, 10),
- blockedHosts: this.blockedHosts.split('\n') || [],
- pinnedUsers: this.pinnedUsers ? this.pinnedUsers.split('\n') : [],
- pinnedPages: this.pinnedPages ? this.pinnedPages.split('\n') : [],
- pinnedClipId: (this.pinnedClipId && this.pinnedClipId) != '' ? this.pinnedClipId : null,
- enableServiceWorker: this.enableServiceWorker,
- swPublicKey: this.swPublicKey,
- swPrivateKey: this.swPrivateKey,
- useObjectStorage: this.useObjectStorage,
- objectStorageBaseUrl: this.objectStorageBaseUrl ? this.objectStorageBaseUrl : null,
- objectStorageBucket: this.objectStorageBucket ? this.objectStorageBucket : null,
- objectStoragePrefix: this.objectStoragePrefix ? this.objectStoragePrefix : null,
- objectStorageEndpoint: this.objectStorageEndpoint ? this.objectStorageEndpoint : null,
- objectStorageRegion: this.objectStorageRegion ? this.objectStorageRegion : null,
- objectStoragePort: this.objectStoragePort ? this.objectStoragePort : null,
- objectStorageAccessKey: this.objectStorageAccessKey ? this.objectStorageAccessKey : null,
- objectStorageSecretKey: this.objectStorageSecretKey ? this.objectStorageSecretKey : null,
- objectStorageUseSSL: this.objectStorageUseSSL,
- objectStorageUseProxy: this.objectStorageUseProxy,
- objectStorageSetPublicRead: this.objectStorageSetPublicRead,
- objectStorageS3ForcePathStyle: this.objectStorageS3ForcePathStyle,
- enableTwitterIntegration: this.enableTwitterIntegration,
- twitterConsumerKey: this.twitterConsumerKey,
- twitterConsumerSecret: this.twitterConsumerSecret,
- enableGithubIntegration: this.enableGithubIntegration,
- githubClientId: this.githubClientId,
- githubClientSecret: this.githubClientSecret,
- enableDiscordIntegration: this.enableDiscordIntegration,
- discordClientId: this.discordClientId,
- discordClientSecret: this.discordClientSecret,
- enableEmail: this.enableEmail,
- email: this.email,
- smtpSecure: this.smtpSecure,
- smtpHost: this.smtpHost,
- smtpPort: this.smtpPort,
- smtpUser: this.smtpUser,
- smtpPass: this.smtpPass,
- summalyProxy: this.summalyProxy,
- useStarForReactionFallback: this.useStarForReactionFallback,
}).then(() => {
fetchInstance();
- if (withDialog) {
- os.success();
- }
- }).catch(e => {
- os.dialog({
- type: 'error',
- text: e
- });
});
}
}