]> Untitled Git - lemmy-ui.git/commitdiff
Fixing custom favicons. Fixes #220
authorDessalines <tyhou13@gmx.com>
Thu, 25 Mar 2021 15:58:29 +0000 (11:58 -0400)
committerDessalines <tyhou13@gmx.com>
Thu, 25 Mar 2021 15:58:29 +0000 (11:58 -0400)
src/server/index.tsx
src/shared/components/app.tsx
src/shared/utils.ts

index 0dcd164ace8a353f4dd87f07d8469e0120912c29..1382889935951cb912d08b986d7cebb637f52c89 100644 (file)
@@ -133,10 +133,6 @@ server.get("/*", async (req, res) => {
            <!-- Web app manifest -->
            <link rel="manifest" href="/static/assets/manifest.webmanifest">
 
-           <!-- Icons -->
-           <link rel="shortcut icon" type="image/svg+xml" href="/static/assets/icons/favicon.svg" />
-           <link rel="apple-touch-icon" href="/static/assets/icons/apple-touch-icon.png" />
-
            <!-- Styles -->
            <link rel="stylesheet" type="text/css" href="/static/styles/styles.css" />
 
index 262e4b543800ea906fbbf7ab3491544a1f2ead94..6012d317964988d5c88fcb9bb189cc00bc008e4b 100644 (file)
@@ -11,6 +11,7 @@ import { Theme } from "./theme";
 import { Symbols } from "./symbols";
 import { GetSiteResponse } from "lemmy-js-client";
 import "./styles.scss";
+import { favIconPngUrl, favIconUrl } from "shared/utils";
 
 export interface AppProps {
   siteRes: GetSiteResponse;
@@ -33,9 +34,15 @@ export class App extends Component<AppProps, any> {
                 <Helmet>
                   <link
                     id="favicon"
-                    rel="icon"
+                    rel="shortcut icon"
                     type="image/x-icon"
-                    href={this.props.siteRes.site_view.site.icon}
+                    href={this.props.siteRes.site_view.site.icon || favIconUrl}
+                  />
+                  <link
+                    rel="apple-touch-icon"
+                    href={
+                      this.props.siteRes.site_view.site.icon || favIconPngUrl
+                    }
                   />
                 </Helmet>
               )}
index 363f810e12f1396dc91acb3f133467b1f7355e61..3049a0302d185ddc18c7435294fa8cb6e26be09f 100644 (file)
@@ -72,8 +72,8 @@ import { i18n } from "./i18next";
 
 export const wsClient = new LemmyWebsocket();
 
-export const favIconUrl = "/static/assets/favicon.svg";
-export const favIconPngUrl = "/static/assets/apple-touch-icon.png";
+export const favIconUrl = "/static/assets/icons/favicon.svg";
+export const favIconPngUrl = "/static/assets/icons/apple-touch-icon.png";
 // TODO
 // export const defaultFavIcon = `${window.location.protocol}//${window.location.host}${favIconPngUrl}`;
 export const repoUrl = "https://github.com/LemmyNet";