Merge branch 'manifest-icons' into 'main'

webmanifest: add app icons

See merge request soapbox-pub/ditto!554
This commit is contained in:
Alex Gleason 2024-10-17 23:22:03 +00:00
commit 4be6fe004d
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 meta = await getInstanceMetadata(await Storages.db(), c.req.raw.signal);
const manifest: WebManifestCombined = { const manifest: WebManifestCombined = {
description: meta.about,
display: 'standalone',
icons: [{
src: meta.picture,
sizes: '192x192',
}, {
src: meta.picture,
sizes: '512x512',
}],
name: meta.name, name: meta.name,
scope: '/',
short_name: meta.name, short_name: meta.name,
start_url: '/', start_url: '/',
display: 'standalone',
scope: '/',
description: meta.about,
}; };
return c.json(manifest, { 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. */ /** Like NostrMetadata, but some fields are required and also contains some extra fields. */
export interface InstanceMetadata extends NostrMetadata { export interface InstanceMetadata extends NostrMetadata {
name: string;
about: string; about: string;
tagline: string;
email: string; email: string;
name: string;
picture: string;
tagline: string;
event?: NostrEvent; event?: NostrEvent;
} }
@ -31,6 +32,7 @@ export async function getInstanceMetadata(store: NStore, signal?: AbortSignal):
about: meta.about ?? 'Nostr community server', about: meta.about ?? 'Nostr community server',
tagline: meta.tagline ?? meta.about ?? 'Nostr community server', tagline: meta.tagline ?? meta.about ?? 'Nostr community server',
email: meta.email ?? `postmaster@${Conf.url.host}`, email: meta.email ?? `postmaster@${Conf.url.host}`,
picture: meta.picture ?? Conf.local('/images/avi.png'),
event, event,
}; };
} }