diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-08-30 03:56:51 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-30 03:56:51 +0900 |
| commit | 4e11da98d90c1c44fce1abaf63c248896feff03a (patch) | |
| tree | cbe91363f87a3cc29b142433c16e4b16ccf2aa7d /src/server/api/endpoints/admin/update-meta.ts | |
| parent | New translations ja-JP.yml (French) (diff) | |
| parent | :art: (diff) | |
| download | misskey-4e11da98d90c1c44fce1abaf63c248896feff03a.tar.gz misskey-4e11da98d90c1c44fce1abaf63c248896feff03a.tar.bz2 misskey-4e11da98d90c1c44fce1abaf63c248896feff03a.zip | |
Merge branch 'develop' into l10n_develop
Diffstat (limited to 'src/server/api/endpoints/admin/update-meta.ts')
| -rw-r--r-- | src/server/api/endpoints/admin/update-meta.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts new file mode 100644 index 0000000000..2c7929fabe --- /dev/null +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -0,0 +1,37 @@ +import $ from 'cafy'; +import Meta from '../../../../models/meta'; +import getParams from '../../get-params'; + +export const meta = { + desc: { + 'ja-JP': 'インスタンスの設定を更新します。' + }, + + requireCredential: true, + requireAdmin: true, + + params: { + disableRegistration: $.bool.optional.nullable.note({ + desc: { + 'ja-JP': '招待制か否か' + } + }), + } +}; + +export default (params: any) => new Promise(async (res, rej) => { + const [ps, psErr] = getParams(meta, params); + if (psErr) return rej(psErr); + + const set = {} as any; + + if (ps.disableRegistration === true || ps.disableRegistration === false) { + set.disableRegistration = ps.disableRegistration; + } + + await Meta.update({}, { + $set: set + }, { upsert: true }); + + res(); +}); |