2022-02-27 02:07:39 +00:00
|
|
|
import Koa from 'koa';
|
|
|
|
import { fetchMeta } from '@/misc/fetch-meta.js';
|
2022-04-23 03:38:02 +00:00
|
|
|
import manifest from './manifest.json' assert { type: 'json' };
|
2019-03-31 16:05:49 +00:00
|
|
|
|
2022-08-10 22:09:29 +00:00
|
|
|
export const manifestHandler = async (ctx: Koa.Context): Promise<void> => {
|
2022-06-04 08:26:56 +00:00
|
|
|
// TODO
|
|
|
|
//const res = structuredClone(manifest);
|
|
|
|
const res = JSON.parse(JSON.stringify(manifest));
|
2019-03-31 16:05:49 +00:00
|
|
|
|
2019-04-23 23:11:19 +00:00
|
|
|
const instance = await fetchMeta(true);
|
2019-03-31 16:05:49 +00:00
|
|
|
|
2022-04-23 03:38:02 +00:00
|
|
|
res.short_name = instance.name || 'Misskey';
|
|
|
|
res.name = instance.name || 'Misskey';
|
|
|
|
if (instance.themeColor) res.theme_color = instance.themeColor;
|
2019-03-31 16:05:49 +00:00
|
|
|
|
|
|
|
ctx.set('Cache-Control', 'max-age=300');
|
2022-04-23 03:38:02 +00:00
|
|
|
ctx.body = res;
|
2019-03-31 16:05:49 +00:00
|
|
|
};
|