summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/web/manifest.ts
blob: ee568b8077fdd9ebe8734812536344071b7e83db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Koa from 'koa';
import { fetchMeta } from '@/misc/fetch-meta.js';
import manifest from './manifest.json' assert { type: 'json' };

export const manifestHandler = async (ctx: Koa.Context) => {
	// TODO
	//const res = structuredClone(manifest);
	const res = JSON.parse(JSON.stringify(manifest));

	const instance = await fetchMeta(true);

	res.short_name = instance.name || 'Misskey';
	res.name = instance.name || 'Misskey';
	if (instance.themeColor) res.theme_color = instance.themeColor;

	ctx.set('Cache-Control', 'max-age=300');
	ctx.body = res;
};