Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | export const dynamic = 'force-dynamic' import {getServerSession} from 'next-auth' import {authOptions} from '@/lib/auth' import {brandForRequest, currentBand, iconUrl, PRODUCT} from '@/lib/band' import {prisma} from '@/lib/db' import {THEME_COLORS} from '@/lib/theme' /** * "Add to Home Screen": the band's name and icon. The address decides it * when it belongs to a band; otherwise the band chosen on this device. */ export const GET = async () => { const brand = await brandForRequest() let band = brand.band if (!band) { const session = await getServerSession(authOptions) const user = session?.user?.email ? await prisma.user.findUnique({where: {email: session.user.email}}) : null if (user) band = (await currentBand(user.id)).band } const name = band?.appName ?? PRODUCT return Response.json( { name, short_name: name, description: band ? `Charts, setlists and rehearsals for ${band.name}` : 'Charts, setlists and rehearsals for bands', // One app per address, whichever page it was installed from id: '/songs', start_url: '/songs', scope: '/', display: 'standalone', background_color: THEME_COLORS.dark, theme_color: THEME_COLORS.dark, icons: band?.iconAt ? [ {src: iconUrl(band), sizes: '192x192', type: 'image/png'}, {src: iconUrl(band), sizes: '512x512', type: 'image/png'}, ] : [ { src: '/icons/default-192.png', sizes: '192x192', type: 'image/png', }, { src: '/icons/default-512.png', sizes: '512x512', type: 'image/png', }, { src: '/icons/default-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable', }, ], }, {headers: {'Content-Type': 'application/manifest+json'}}, ) } |