2023-01-12 21:40:33 -07:00
|
|
|
import type Koa from "koa";
|
|
|
|
import { fetchMeta } from "@/misc/fetch-meta.js";
|
|
|
|
import manifest from "./manifest.json" assert { type: "json" };
|
2019-03-31 10:05:49 -06:00
|
|
|
|
2022-02-26 19:07:39 -07:00
|
|
|
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-03-31 10:05:49 -06:00
|
|
|
|
2019-04-23 17:11:19 -06:00
|
|
|
const instance = await fetchMeta(true);
|
2019-03-31 10:05:49 -06:00
|
|
|
|
2023-01-12 21:40:33 -07:00
|
|
|
res.short_name = instance.name || "Calckey";
|
|
|
|
res.name = instance.name || "Calckey";
|
2022-04-22 21:38:02 -06:00
|
|
|
if (instance.themeColor) res.theme_color = instance.themeColor;
|
2019-03-31 10:05:49 -06:00
|
|
|
|
2023-01-12 21:40:33 -07:00
|
|
|
ctx.set("Cache-Control", "max-age=300");
|
2022-04-22 21:38:02 -06:00
|
|
|
ctx.body = res;
|
2019-03-31 10:05:49 -06:00
|
|
|
};
|