Add initial webmanifest controller

This commit is contained in:
Alex Gleason
2024-09-26 13:50:51 -05:00
parent 4da82e9484
commit 64a6d7170c
3 changed files with 275 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { AppController } from '@/app.ts';
import { Storages } from '@/storages.ts';
import { WebManifestCombined } from '@/types/webmanifest.ts';
import { getInstanceMetadata } from '@/utils/instance.ts';
export const manifestController: AppController = async (c) => {
const meta = await getInstanceMetadata(await Storages.db(), c.req.raw.signal);
const manifest: WebManifestCombined = {
name: meta.name,
short_name: meta.name,
start_url: '/',
display: 'standalone',
scope: '/',
description: meta.about,
};
return c.json(manifest, {
headers: {
'Content-Type': 'application/manifest+json',
},
});
};