webmanifest: add app icons

This commit is contained in:
Alex Gleason 2024-10-17 18:15:11 -05:00
parent 28e8dfb4ac
commit 5d484e4bf6
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 14 additions and 5 deletions

View file

@ -7,12 +7,19 @@ export const manifestController: AppController = async (c) => {
const meta = await getInstanceMetadata(await Storages.db(), c.req.raw.signal);
const manifest: WebManifestCombined = {
description: meta.about,
display: 'standalone',
icons: [{
src: meta.picture,
sizes: '192x192',
}, {
src: meta.picture,
sizes: '512x512',
}],
name: meta.name,
scope: '/',
short_name: meta.name,
start_url: '/',
display: 'standalone',
scope: '/',
description: meta.about,
};
return c.json(manifest, {

View file

@ -5,10 +5,11 @@ import { serverMetaSchema } from '@/schemas/nostr.ts';
/** Like NostrMetadata, but some fields are required and also contains some extra fields. */
export interface InstanceMetadata extends NostrMetadata {
name: string;
about: string;
tagline: string;
email: string;
name: string;
picture: string;
tagline: string;
event?: NostrEvent;
}
@ -31,6 +32,7 @@ export async function getInstanceMetadata(store: NStore, signal?: AbortSignal):
about: meta.about ?? 'Nostr community server',
tagline: meta.tagline ?? meta.about ?? 'Nostr community server',
email: meta.email ?? `postmaster@${Conf.url.host}`,
picture: meta.picture ?? Conf.local('/images/avi.png'),
event,
};
}