From 7ae95770aaf8aa218005639ba77f2a754132cf13 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Wed, 27 Jul 2022 09:58:18 -0700 Subject: [PATCH] Add endpoint --- .../src/server/api/endpoints/custom-motd.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packages/backend/src/server/api/endpoints/custom-motd.ts diff --git a/packages/backend/src/server/api/endpoints/custom-motd.ts b/packages/backend/src/server/api/endpoints/custom-motd.ts new file mode 100644 index 0000000000..859bde904e --- /dev/null +++ b/packages/backend/src/server/api/endpoints/custom-motd.ts @@ -0,0 +1,32 @@ +// import { IsNull } from 'typeorm'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import define from '../define.js'; + +export const meta = { + tags: ['meta'], + + requireCredential: false, + requireCredentialPrivateMode: true, + + res: { + type: 'array', + optional: false, nullable: false, + items: { + type: 'string', + optional: false, nullable: false, + }, + }, +} as const; + +export const paramDef = { + type: 'array', + properties: {}, + required: [], +} as const; + +// eslint-disable-next-line import/no-default-export +export default define(meta, paramDef, async () => { + const meta = await fetchMeta(); + const motd = await Promise.all(meta.customMOTD.map(x => x)); + return motd; +});