summaryrefslogtreecommitdiff
path: root/src/client/pages/instance
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-02-10 23:17:42 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2020-02-10 23:17:42 +0900
commit2511114c287d95010e15a08deb7ff20561b0c3b0 (patch)
treec65806f5bde9a57cd6ff73b2c7805d21fbf2c898 /src/client/pages/instance
parent:art: (diff)
downloadmisskey-2511114c287d95010e15a08deb7ff20561b0c3b0.tar.gz
misskey-2511114c287d95010e15a08deb7ff20561b0c3b0.tar.bz2
misskey-2511114c287d95010e15a08deb7ff20561b0c3b0.zip
なんかもうめっちゃ変えた
Resolve #5846
Diffstat (limited to 'src/client/pages/instance')
-rw-r--r--src/client/pages/instance/federation.instance.vue34
-rw-r--r--src/client/pages/instance/index.vue95
2 files changed, 69 insertions, 60 deletions
diff --git a/src/client/pages/instance/federation.instance.vue b/src/client/pages/instance/federation.instance.vue
index a27556064a..b86f52809e 100644
--- a/src/client/pages/instance/federation.instance.vue
+++ b/src/client/pages/instance/federation.instance.vue
@@ -98,7 +98,7 @@
<div class="operations">
<span class="label">{{ $t('operations') }}</span>
<mk-switch v-model="isSuspended" class="switch">{{ $t('stopActivityDelivery') }}</mk-switch>
- <mk-switch v-model="isBlocked" class="switch">{{ $t('blockThisInstance') }}</mk-switch>
+ <mk-switch :value="isBlocked" class="switch" @change="changeBlock">{{ $t('blockThisInstance') }}</mk-switch>
</div>
<details class="metadata">
<summary class="label">{{ $t('metadata') }}</summary>
@@ -147,9 +147,7 @@ export default Vue.extend({
data() {
return {
- meta: null,
- isSuspended: false,
- isBlocked: false,
+ isSuspended: this.instance.isSuspended,
now: null,
chart: null,
chartInstance: null,
@@ -184,6 +182,14 @@ export default Vue.extend({
null;
return stats;
+ },
+
+ meta() {
+ return this.$store.state.instance.meta;
+ },
+
+ isBlocked() {
+ return this.meta && this.meta.blockedHosts.includes(this.instance.host);
}
},
@@ -195,12 +201,6 @@ export default Vue.extend({
});
},
- isBlocked() {
- this.$root.api('admin/update-meta', {
- blockedHosts: this.isBlocked ? this.meta.blockedHosts.concat([this.instance.host]) : this.meta.blockedHosts.filter(x => x !== this.instance.host)
- });
- },
-
chartSrc() {
this.renderChart();
},
@@ -210,13 +210,7 @@ export default Vue.extend({
}
},
- async created() {
- this.$root.getMeta().then(meta => {
- this.meta = meta;
- this.isSuspended = this.instance.isSuspended;
- this.isBlocked = this.meta.blockedHosts.includes(this.instance.host);
- });
-
+ async created() {
this.now = new Date();
const [perHour, perDay] = await Promise.all([
@@ -235,6 +229,12 @@ export default Vue.extend({
},
methods: {
+ changeBlock(e) {
+ this.$root.api('admin/update-meta', {
+ blockedHosts: this.isBlocked ? this.meta.blockedHosts.concat([this.instance.host]) : this.meta.blockedHosts.filter(x => x !== this.instance.host)
+ });
+ },
+
setSrc(src) {
this.chartSrc = src;
},
diff --git a/src/client/pages/instance/index.vue b/src/client/pages/instance/index.vue
index e3e7332bc3..6ffdec2a65 100644
--- a/src/client/pages/instance/index.vue
+++ b/src/client/pages/instance/index.vue
@@ -21,6 +21,9 @@
<section class="_card info">
<div class="_content">
+ <mk-input v-model="maxNoteTextLength" type="number" :save="() => save()" style="margin:0;"><template #icon><fa :icon="faPencilAlt"/></template>{{ $t('maxNoteTextLength') }}</mk-input>
+ </div>
+ <div class="_content">
<mk-switch v-model="enableLocalTimeline" @change="save()">{{ $t('enableLocalTimeline') }}</mk-switch>
<mk-switch v-model="enableGlobalTimeline" @change="save()">{{ $t('enableGlobalTimeline') }}</mk-switch>
<mk-info>{{ $t('disablingTimelinesInfo') }}</mk-info>
@@ -171,7 +174,7 @@
<script lang="ts">
import Vue from 'vue';
-import { faShareAlt, faGhost, faCog, faPlus, faCloud, faInfoCircle, faBan, faSave, faServer, faLink, faThumbtack, faUser, faShieldAlt, faKey, faBolt } from '@fortawesome/free-solid-svg-icons';
+import { faPencilAlt, faShareAlt, faGhost, faCog, faPlus, faCloud, faInfoCircle, faBan, faSave, faServer, faLink, faThumbtack, faUser, faShieldAlt, faKey, faBolt } from '@fortawesome/free-solid-svg-icons';
import { faTrashAlt, faEnvelope } from '@fortawesome/free-regular-svg-icons';
import { faTwitter, faDiscord, faGithub } from '@fortawesome/free-brands-svg-icons';
import MkButton from '../../components/ui/button.vue';
@@ -205,7 +208,6 @@ export default Vue.extend({
return {
version,
url,
- meta: null,
stats: null,
serverInfo: null,
proxyAccount: null,
@@ -223,6 +225,7 @@ export default Vue.extend({
tosUrl: null,
bannerUrl: null,
iconUrl: null,
+ maxNoteTextLength: 0,
enableRegistration: false,
enableLocalTimeline: false,
enableGlobalTimeline: false,
@@ -241,52 +244,56 @@ export default Vue.extend({
enableDiscordIntegration: false,
discordClientId: null,
discordClientSecret: null,
- faTwitter, faDiscord, faGithub, faShareAlt, faTrashAlt, faGhost, faCog, faPlus, faCloud, faInfoCircle, faBan, faSave, faServer, faLink, faEnvelope, faThumbtack, faUser, faShieldAlt, faKey, faBolt
+ faPencilAlt, faTwitter, faDiscord, faGithub, faShareAlt, faTrashAlt, faGhost, faCog, faPlus, faCloud, faInfoCircle, faBan, faSave, faServer, faLink, faEnvelope, faThumbtack, faUser, faShieldAlt, faKey, faBolt
}
},
+ computed: {
+ meta() {
+ return this.$store.state.instance.meta;
+ },
+ },
+
created() {
- this.$root.getMeta().then(meta => {
- this.meta = meta;
- 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.maintainerName = this.meta.maintainerName;
- this.maintainerEmail = this.meta.maintainerEmail;
- this.enableRegistration = !this.meta.disableRegistration;
- this.enableLocalTimeline = !this.meta.disableLocalTimeline;
- this.enableGlobalTimeline = !this.meta.disableGlobalTimeline;
- 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.enableServiceWorker = this.meta.enableServiceWorker;
- this.swPublicKey = this.meta.swPublickey;
- this.swPrivateKey = this.meta.swPrivateKey;
- 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.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.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.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.enableServiceWorker = this.meta.enableServiceWorker;
+ this.swPublicKey = this.meta.swPublickey;
+ this.swPrivateKey = this.meta.swPrivateKey;
+ 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;
- if (this.proxyAccountId) {
- this.$root.api('users/show', { userId: this.proxyAccountId }).then(proxyAccount => {
- this.proxyAccount = proxyAccount;
- });
- }
- });
+ if (this.proxyAccountId) {
+ this.$root.api('users/show', { userId: this.proxyAccountId }).then(proxyAccount => {
+ this.proxyAccount = proxyAccount;
+ });
+ }
this.$root.api('admin/server-info').then(res => {
this.serverInfo = res;
@@ -347,6 +354,7 @@ export default Vue.extend({
iconUrl: this.iconUrl,
maintainerName: this.maintainerName,
maintainerEmail: this.maintainerEmail,
+ maxNoteTextLength: this.maxNoteTextLength,
disableRegistration: !this.enableRegistration,
disableLocalTimeline: !this.enableLocalTimeline,
disableGlobalTimeline: !this.enableGlobalTimeline,
@@ -373,6 +381,7 @@ export default Vue.extend({
discordClientId: this.discordClientId,
discordClientSecret: this.discordClientSecret,
}).then(() => {
+ this.$store.dispatch('instance/fetch');
if (withDialog) {
this.$root.dialog({
type: 'success',