1 import { readFile } from "fs/promises";
2 import { GetSiteResponse } from "lemmy-js-client";
3 import path from "path";
4 import sharp from "sharp";
5 import { fetchIconPng } from "./fetch-icon-png";
7 const iconSizes = [72, 96, 128, 144, 152, 192, 384, 512];
9 const defaultLogoPathDirectory = path.join(
16 export default async function ({
20 local_site: { community_creation_admin_only },
23 const icon = site.icon ? await fetchIconPng(site.icon) : null;
27 description: site.description ?? "A link aggregator for the fediverse",
30 display: "standalone",
32 background_color: "#222222",
33 theme_color: "#222222",
34 icons: await Promise.all(
35 iconSizes.map(async size => {
36 let src = await readFile(
37 path.join(defaultLogoPathDirectory, `icon-${size}x${size}.png`),
38 ).then(buf => buf.toString("base64"));
41 src = await sharp(icon)
45 .then(buf => buf.toString("base64"));
49 sizes: `${size}x${size}`,
51 src: `data:image/png;base64,${src}`,
52 purpose: "any maskable",
60 description: "Perform a search.",
66 short_name: "Communities",
67 description: "Browse communities",
72 short_name: "Create Post",
73 description: "Create a post.",
76 my_user?.local_user_view.person.admin || !community_creation_admin_only
79 name: "Create Community",
80 url: "/create_community",
81 short_name: "Create Community",
82 description: "Create a community",
87 related_applications: [
90 url: "https://f-droid.org/packages/com.jerboa/",