hippofish/packages/backend/src/server/api/endpoints/recommended-instances.ts

34 lines
658 B
TypeScript
Raw Normal View History

2022-07-29 06:28:13 +02:00
// import { IsNull } from 'typeorm';
2023-01-13 05:40:33 +01:00
import { fetchMeta } from "@/misc/fetch-meta.js";
import define from "../define.js";
2022-07-29 06:28:13 +02:00
export const meta = {
2023-01-13 05:40:33 +01:00
tags: ["meta"],
2022-07-29 06:28:13 +02:00
requireCredential: false,
requireCredentialPrivateMode: true,
res: {
2023-01-13 05:40:33 +01:00
type: "array",
optional: false,
nullable: false,
2022-07-29 06:28:13 +02:00
items: {
2023-01-13 05:40:33 +01:00
type: "string",
optional: false,
nullable: false,
2022-07-29 06:28:13 +02:00
},
},
} as const;
export const paramDef = {
2023-01-13 05:40:33 +01:00
type: "object",
2022-07-29 06:28:13 +02:00
properties: {},
required: [],
} as const;
export default define(meta, paramDef, async () => {
const meta = await fetchMeta();
2023-01-13 05:40:33 +01:00
const instances = await Promise.all(meta.recommendedInstances.map((x) => x));
2022-07-29 06:28:13 +02:00
return instances;
});