jormungandr-bite/packages/backend/src/server/web/manifest.ts

19 lines
558 B
TypeScript
Raw Normal View History

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) => {
2022-06-04 02:26:56 -06:00
// TODO
//const res = structuredClone(manifest);
const res = JSON.parse(JSON.stringify(manifest));
2019-04-23 17:11:19 -06:00
const instance = await fetchMeta(true);
2022-07-18 20:00:45 -06:00
res.short_name = instance.name || 'Calckey';
res.name = instance.name || 'Calckey';
if (instance.themeColor) res.theme_color = instance.themeColor;
ctx.set('Cache-Control', 'max-age=300');
ctx.body = res;
};