iceshrimp/packages/backend/src/server/web/manifest.ts

19 lines
567 B
TypeScript
Raw Normal View History

2023-01-13 05:40:33 +01:00
import type 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 10:26:56 +02:00
// TODO
//const res = structuredClone(manifest);
const res = JSON.parse(JSON.stringify(manifest));
2019-04-24 01:11:19 +02:00
const instance = await fetchMeta(true);
res.short_name = instance.name || "Iceshrimp";
res.name = instance.name || "Iceshrimp";
if (instance.themeColor) res.theme_color = instance.themeColor;
2023-01-13 05:40:33 +01:00
ctx.set("Cache-Control", "max-age=300");
ctx.body = res;
};