diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2019-02-08 04:26:43 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-08 04:26:43 +0900 |
| commit | e6612f610c4b8a04663e95bc23e4b5e7ae255831 (patch) | |
| tree | 364d1f52b2db506a2315eb65c4276cc8fed3fad4 /src/server/api/endpoints/admin/federation | |
| parent | Update CONTRIBUTING.md (diff) | |
| download | sharkey-e6612f610c4b8a04663e95bc23e4b5e7ae255831.tar.gz sharkey-e6612f610c4b8a04663e95bc23e4b5e7ae255831.tar.bz2 sharkey-e6612f610c4b8a04663e95bc23e4b5e7ae255831.zip | |
Implement instance blocking (#4182)
* Implement instance blocking
* Add missing text
* Delete unnecessary file
* Covert Punycode to Unicode
Diffstat (limited to 'src/server/api/endpoints/admin/federation')
| -rw-r--r-- | src/server/api/endpoints/admin/federation/update-instance.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/server/api/endpoints/admin/federation/update-instance.ts b/src/server/api/endpoints/admin/federation/update-instance.ts new file mode 100644 index 0000000000..de40480a49 --- /dev/null +++ b/src/server/api/endpoints/admin/federation/update-instance.ts @@ -0,0 +1,34 @@ +import $ from 'cafy'; +import define from '../../../define'; +import Instance from '../../../../../models/instance'; + +export const meta = { + requireCredential: true, + requireModerator: true, + + params: { + host: { + validator: $.str + }, + + isBlocked: { + validator: $.bool + }, + } +}; + +export default define(meta, (ps, me) => new Promise(async (res, rej) => { + const instance = await Instance.findOne({ host: ps.host }); + + if (instance == null) { + return rej('instance not found'); + } + + Instance.update({ host: ps.host }, { + $set: { + isBlocked: ps.isBlocked + } + }); + + res(); +})); |