blob: d1abe95a5b2b26362d0bd7f93945ee025a2d9d0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import $ from 'cafy';
import define from '../../../define';
import { Instances } from '../../../../../models';
export const meta = {
tags: ['admin'],
requireCredential: true,
requireModerator: true,
params: {
host: {
validator: $.str
},
isClosed: {
validator: $.bool
},
}
};
export default define(meta, async (ps, me) => {
const instance = await Instances.findOne({ host: ps.host });
if (instance == null) {
throw new Error('instance not found');
}
Instances.update({ host: ps.host }, {
isMarkedAsClosed: ps.isClosed
});
});
|