]> Untitled Git - awful.systems.git/blob - lemmy/disable-sharp.patch
Initial commit
[awful.systems.git] / lemmy / disable-sharp.patch
1 diff --git a/package.json b/package.json
2 index 01f5100..54016b6 100644
3 --- a/package.json
4 +++ b/package.json
5 @@ -85,7 +85,6 @@
6      "sass-loader": "^13.2.2",
7      "serialize-javascript": "^6.0.1",
8      "service-worker-webpack": "^1.0.0",
9 -    "sharp": "^0.32.1",
10      "tippy.js": "^6.3.7",
11      "toastify-js": "^1.12.0",
12      "tributejs": "^5.1.3",
13 diff --git a/src/server/utils/create-ssr-html.tsx b/src/server/utils/create-ssr-html.tsx
14 index 1377598..452e0c8 100644
15 --- a/src/server/utils/create-ssr-html.tsx
16 +++ b/src/server/utils/create-ssr-html.tsx
17 @@ -1,7 +1,6 @@
18  import { Helmet } from "inferno-helmet";
19  import { renderToString } from "inferno-server";
20  import serialize from "serialize-javascript";
21 -import sharp from "sharp";
22  import { favIconPngUrl, favIconUrl } from "../../shared/config";
23  import { ILemmyConfig, IsoDataOptionalSite } from "../../shared/interfaces";
24  import { buildThemeList } from "./build-themes-list";
25 @@ -9,7 +8,6 @@ import { fetchIconPng } from "./fetch-icon-png";
26  
27  const customHtmlHeader = process.env["LEMMY_UI_CUSTOM_HTML_HEADER"] || "";
28  
29 -let appleTouchIcon: string | undefined = undefined;
30  
31  export async function createSsrHtml(
32    root: string,
33 @@ -21,25 +19,6 @@ export async function createSsrHtml(
34      (await buildThemeList())[0]
35    }.css" />`;
36  
37 -  if (!appleTouchIcon) {
38 -    appleTouchIcon = site?.site_view.site.icon
39 -      ? `data:image/png;base64,${sharp(
40 -          await fetchIconPng(site.site_view.site.icon)
41 -        )
42 -          .resize(180, 180)
43 -          .extend({
44 -            bottom: 20,
45 -            top: 20,
46 -            left: 20,
47 -            right: 20,
48 -            background: "#222222",
49 -          })
50 -          .png()
51 -          .toBuffer()
52 -          .then(buf => buf.toString("base64"))}`
53 -      : favIconPngUrl;
54 -  }
55 -
56    const erudaStr =
57      process.env["LEMMY_UI_DEBUG"] === "true"
58        ? renderToString(
59 @@ -83,9 +62,7 @@ export async function createSsrHtml(
60    
61      <!-- Web app manifest -->
62      <link rel="manifest" href="/manifest.webmanifest" />
63 -    <link rel="apple-touch-icon" href=${appleTouchIcon} />
64 -    <link rel="apple-touch-startup-image" href=${appleTouchIcon} />
65 -  
66 +
67      <!-- Styles -->
68      <link rel="stylesheet" type="text/css" href="/static/styles/styles.css" />
69    
70 diff --git a/src/server/utils/generate-manifest-json.ts b/src/server/utils/generate-manifest-json.ts
71 index 2f9d8b8..245ad4f 100644
72 --- a/src/server/utils/generate-manifest-json.ts
73 +++ b/src/server/utils/generate-manifest-json.ts
74 @@ -2,7 +2,6 @@ import { getHttpBaseExternal } from "@utils/env";
75  import { readFile } from "fs/promises";
76  import { GetSiteResponse } from "lemmy-js-client";
77  import path from "path";
78 -import sharp from "sharp";
79  import { fetchIconPng } from "./fetch-icon-png";
80  
81  const iconSizes = [72, 96, 128, 144, 152, 192, 384, 512];
82 @@ -40,14 +39,6 @@ export default async function ({
83            path.join(defaultLogoPathDirectory, `icon-${size}x${size}.png`)
84          ).then(buf => buf.toString("base64"));
85  
86 -        if (icon) {
87 -          src = await sharp(icon)
88 -            .resize(size, size)
89 -            .png()
90 -            .toBuffer()
91 -            .then(buf => buf.toString("base64"));
92 -        }
93 -
94          return {
95            sizes: `${size}x${size}`,
96            type: "image/png",