インスタンスブロックを設定できるように
This commit is contained in:
parent
92dee53dd6
commit
f9f574532e
4 changed files with 47 additions and 3 deletions
|
@ -1486,6 +1486,8 @@ admin/views/federation.vue:
|
||||||
chart-spans:
|
chart-spans:
|
||||||
hour: "1時間ごと"
|
hour: "1時間ごと"
|
||||||
day: "1日ごと"
|
day: "1日ごと"
|
||||||
|
blocked-hosts: "ブロック"
|
||||||
|
blocked-hosts-info: "ブロックしたいホストを改行で区切って記述します。"
|
||||||
|
|
||||||
desktop/views/pages/welcome.vue:
|
desktop/views/pages/welcome.vue:
|
||||||
about: "詳しく..."
|
about: "詳しく..."
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
<span>{{ $t('latest-request-received-at') }}</span>
|
<span>{{ $t('latest-request-received-at') }}</span>
|
||||||
<template #prefix><fa :icon="faInbox"/></template>
|
<template #prefix><fa :icon="faInbox"/></template>
|
||||||
</ui-input>
|
</ui-input>
|
||||||
<ui-switch v-model="instance.isBlocked" @change="updateInstance()">{{ $t('block') }}</ui-switch>
|
|
||||||
<ui-switch v-model="instance.isMarkedAsClosed" @change="updateInstance()">{{ $t('marked-as-closed') }}</ui-switch>
|
<ui-switch v-model="instance.isMarkedAsClosed" @change="updateInstance()">{{ $t('marked-as-closed') }}</ui-switch>
|
||||||
<details>
|
<details>
|
||||||
<summary>{{ $t('charts') }}</summary>
|
<summary>{{ $t('charts') }}</summary>
|
||||||
|
@ -142,6 +141,16 @@
|
||||||
<ui-info v-if="instances.length == limit">{{ $t('result-is-truncated', { n: limit }) }}</ui-info>
|
<ui-info v-if="instances.length == limit">{{ $t('result-is-truncated', { n: limit }) }}</ui-info>
|
||||||
</section>
|
</section>
|
||||||
</ui-card>
|
</ui-card>
|
||||||
|
|
||||||
|
<ui-card>
|
||||||
|
<template #title><fa :icon="faBan"/> {{ $t('blocked-hosts') }}</template>
|
||||||
|
<section class="fit-top">
|
||||||
|
<ui-textarea v-model="blockedHosts">
|
||||||
|
<template #desc>{{ $t('blocked-hosts-info') }}</template>
|
||||||
|
</ui-textarea>
|
||||||
|
<ui-button @click="saveBlockedHosts">{{ $t('save') }}</ui-button>
|
||||||
|
</section>
|
||||||
|
</ui-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -149,7 +158,7 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import i18n from '../../i18n';
|
import i18n from '../../i18n';
|
||||||
import { faPaperPlane } from '@fortawesome/free-regular-svg-icons';
|
import { faPaperPlane } from '@fortawesome/free-regular-svg-icons';
|
||||||
import { faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faTrafficLight, faInbox } from '@fortawesome/free-solid-svg-icons';
|
import { faBan, faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faTrafficLight, faInbox } from '@fortawesome/free-solid-svg-icons';
|
||||||
import ApexCharts from 'apexcharts';
|
import ApexCharts from 'apexcharts';
|
||||||
import * as tinycolor from 'tinycolor2';
|
import * as tinycolor from 'tinycolor2';
|
||||||
|
|
||||||
|
@ -176,7 +185,8 @@ export default Vue.extend({
|
||||||
chartSrc: 'requests',
|
chartSrc: 'requests',
|
||||||
chartSpan: 'hour',
|
chartSpan: 'hour',
|
||||||
chartInstance: null,
|
chartInstance: null,
|
||||||
faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faPaperPlane, faTrafficLight, faInbox
|
blockedHosts: '',
|
||||||
|
faBan, faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faPaperPlane, faTrafficLight, faInbox
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -246,6 +256,10 @@ export default Vue.extend({
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchInstances();
|
this.fetchInstances();
|
||||||
|
|
||||||
|
this.$root.getMeta().then(meta => {
|
||||||
|
this.blockedHosts = meta.blockedHosts.join('\n');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -477,6 +491,22 @@ export default Vue.extend({
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
saveBlockedHosts() {
|
||||||
|
this.$root.api('admin/update-meta', {
|
||||||
|
blockedHosts: this.blockedHosts.split('\n')
|
||||||
|
}).then(() => {
|
||||||
|
this.$root.dialog({
|
||||||
|
type: 'success',
|
||||||
|
text: this.$t('saved')
|
||||||
|
});
|
||||||
|
}).catch(e => {
|
||||||
|
this.$root.dialog({
|
||||||
|
type: 'error',
|
||||||
|
text: e
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -70,6 +70,13 @@ export const meta = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
blockedHosts: {
|
||||||
|
validator: $.optional.nullable.arr($.str),
|
||||||
|
desc: {
|
||||||
|
'ja-JP': 'ブロックするホスト'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mascotImageUrl: {
|
mascotImageUrl: {
|
||||||
validator: $.optional.nullable.str,
|
validator: $.optional.nullable.str,
|
||||||
desc: {
|
desc: {
|
||||||
|
@ -389,6 +396,10 @@ export default define(meta, async (ps) => {
|
||||||
set.hiddenTags = ps.hiddenTags;
|
set.hiddenTags = ps.hiddenTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(ps.blockedHosts)) {
|
||||||
|
set.blockedHosts = ps.blockedHosts;
|
||||||
|
}
|
||||||
|
|
||||||
if (ps.mascotImageUrl !== undefined) {
|
if (ps.mascotImageUrl !== undefined) {
|
||||||
set.mascotImageUrl = ps.mascotImageUrl;
|
set.mascotImageUrl = ps.mascotImageUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,7 @@ export default define(meta, async (ps, me) => {
|
||||||
response.useStarForReactionFallback = instance.useStarForReactionFallback;
|
response.useStarForReactionFallback = instance.useStarForReactionFallback;
|
||||||
response.pinnedUsers = instance.pinnedUsers;
|
response.pinnedUsers = instance.pinnedUsers;
|
||||||
response.hiddenTags = instance.hiddenTags;
|
response.hiddenTags = instance.hiddenTags;
|
||||||
|
response.blockedHosts = instance.blockedHosts;
|
||||||
response.recaptchaSecretKey = instance.recaptchaSecretKey;
|
response.recaptchaSecretKey = instance.recaptchaSecretKey;
|
||||||
response.proxyAccount = instance.proxyAccount;
|
response.proxyAccount = instance.proxyAccount;
|
||||||
response.twitterConsumerKey = instance.twitterConsumerKey;
|
response.twitterConsumerKey = instance.twitterConsumerKey;
|
||||||
|
|
Loading…
Reference in a new issue