diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c3bb4f7756f1be761dbe96edfb78b71911747a46..9390af40a91c4af141f61b17b4dde961186753b7 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1486,6 +1486,8 @@ admin/views/federation.vue: chart-spans: hour: "1時間ã”ã¨" day: "1æ—¥ã”ã¨" + blocked-hosts: "ブãƒãƒƒã‚¯" + blocked-hosts-info: "ブãƒãƒƒã‚¯ã—ãŸã„ホストを改行ã§åŒºåˆ‡ã£ã¦è¨˜è¿°ã—ã¾ã™ã€‚" desktop/views/pages/welcome.vue: about: "詳ã—ã..." diff --git a/src/client/app/admin/views/federation.vue b/src/client/app/admin/views/federation.vue index 25400393b903b89505f816e5dc34dd4e71a3dd88..4d0b4b7c77f9e23a50d0374a6790b81395bc8b7e 100644 --- a/src/client/app/admin/views/federation.vue +++ b/src/client/app/admin/views/federation.vue @@ -54,7 +54,6 @@ <span>{{ $t('latest-request-received-at') }}</span> <template #prefix><fa :icon="faInbox"/></template> </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> <details> <summary>{{ $t('charts') }}</summary> @@ -142,6 +141,16 @@ <ui-info v-if="instances.length == limit">{{ $t('result-is-truncated', { n: limit }) }}</ui-info> </section> </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> </template> @@ -149,7 +158,7 @@ import Vue from 'vue'; import i18n from '../../i18n'; 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 * as tinycolor from 'tinycolor2'; @@ -176,7 +185,8 @@ export default Vue.extend({ chartSrc: 'requests', chartSpan: 'hour', 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() { this.fetchInstances(); + + this.$root.getMeta().then(meta => { + this.blockedHosts = meta.blockedHosts.join('\n'); + }); }, 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> diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts index e34840e907bdf2661d2f6eb6b7e5167a5c201329..e4f2e86aaafe084dbf6b9bd634e1f64604863032 100644 --- a/src/server/api/endpoints/admin/update-meta.ts +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -70,6 +70,13 @@ export const meta = { } }, + blockedHosts: { + validator: $.optional.nullable.arr($.str), + desc: { + 'ja-JP': 'ブãƒãƒƒã‚¯ã™ã‚‹ãƒ›ã‚¹ãƒˆ' + } + }, + mascotImageUrl: { validator: $.optional.nullable.str, desc: { @@ -389,6 +396,10 @@ export default define(meta, async (ps) => { set.hiddenTags = ps.hiddenTags; } + if (Array.isArray(ps.blockedHosts)) { + set.blockedHosts = ps.blockedHosts; + } + if (ps.mascotImageUrl !== undefined) { set.mascotImageUrl = ps.mascotImageUrl; } diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index e29edae266920ade76b4fb265a915d093c044218..1bd88a1e6dd0209da395c5ff59177eb235ef0583 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -165,6 +165,7 @@ export default define(meta, async (ps, me) => { response.useStarForReactionFallback = instance.useStarForReactionFallback; response.pinnedUsers = instance.pinnedUsers; response.hiddenTags = instance.hiddenTags; + response.blockedHosts = instance.blockedHosts; response.recaptchaSecretKey = instance.recaptchaSecretKey; response.proxyAccount = instance.proxyAccount; response.twitterConsumerKey = instance.twitterConsumerKey;