1 import { getHttpBaseExternal } from "@utils/env";
2 import { readFile } from "fs/promises";
3 import { GetSiteResponse } from "lemmy-js-client";
4 import path from "path";
5 import sharp from "sharp";
6 import { fetchIconPng } from "./fetch-icon-png";
8 const iconSizes = [72, 96, 128, 144, 152, 192, 384, 512];
10 const defaultLogoPathDirectory = path.join(
17 export default async function ({
21 local_site: { community_creation_admin_only },
24 const url = getHttpBaseExternal();
26 const icon = site.icon ? await fetchIconPng(site.icon) : null;
30 description: site.description ?? "A link aggregator for the fediverse",
33 display: "standalone",
35 background_color: "#222222",
36 theme_color: "#222222",
37 icons: await Promise.all(
38 iconSizes.map(async size => {
39 let src = await readFile(
40 path.join(defaultLogoPathDirectory, `icon-${size}x${size}.png`)
41 ).then(buf => buf.toString("base64"));
44 src = await sharp(icon)
48 .then(buf => buf.toString("base64"));
52 sizes: `${size}x${size}`,
54 src: `data:image/png;base64,${src}`,
55 purpose: "any maskable",
63 description: "Perform a search.",
69 short_name: "Communities",
70 description: "Browse communities",
75 short_name: "Create Post",
76 description: "Create a post.",
79 my_user?.local_user_view.person.admin || !community_creation_admin_only
82 name: "Create Community",
83 url: "/create_community",
84 short_name: "Create Community",
85 description: "Create a community",
90 related_applications: [
93 url: "https://f-droid.org/packages/com.jerboa/",