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