Fix symbols issue. Fixes #319

This commit is contained in:
Dessalines 2021-07-16 12:51:54 -04:00
parent 40a14b5ebe
commit 1a4db014d7
4 changed files with 181 additions and 187 deletions

View file

@ -15,6 +15,7 @@ import IsomorphicCookie from "isomorphic-cookie";
import { GetSite, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
import process from "process";
import { Helmet } from "inferno-helmet";
import { SYMBOLS } from "../shared/components/symbols";
import { initializeSite } from "../shared/initialize";
import { httpBaseInternal } from "../shared/env";
import { IncomingHttpHeaders } from "http";
@ -109,6 +110,7 @@ server.get("/*", async (req, res) => {
);
const root = renderToString(wrapper);
const symbols = renderToString(SYMBOLS);
const cspStr = process.env.LEMMY_EXTERNAL_HOST ? renderToString(cspHtml) : "";
const helmet = Helmet.renderStatic();
@ -140,6 +142,10 @@ server.get("/*", async (req, res) => {
<!-- Current theme and more -->
${helmet.link.toString()}
<!-- Icons -->
${symbols}
</head>
<body ${helmet.bodyAttributes.toString()}>
@ -160,9 +166,9 @@ server.listen(Number(port), hostname, () => {
console.log(`http://${hostname}:${port}`);
});
function setForwardedHeaders(
headers: IncomingHttpHeaders
): { [key: string]: string } {
function setForwardedHeaders(headers: IncomingHttpHeaders): {
[key: string]: string;
} {
let out = {
host: headers.host,
};

View file

@ -8,7 +8,6 @@ import { Navbar } from "./navbar";
import { Footer } from "./footer";
import { NoMatch } from "./no-match";
import { Theme } from "./theme";
import { Symbols } from "./symbols";
import { GetSiteResponse } from "lemmy-js-client";
import "./styles.scss";
import { favIconPngUrl, favIconUrl } from "../utils";
@ -59,7 +58,6 @@ export class App extends Component<AppProps, any> {
))}
<Route render={props => <NoMatch {...props} />} />
</Switch>
<Symbols />
</div>
<Footer site={this.props.siteRes} />
</div>

View file

@ -13,10 +13,10 @@ export class Icon extends Component<IconProps, any> {
render() {
return (
<svg class={`icon ${this.props.classes}`}>
<use xlinkHref={`#icon-${this.props.icon}`}></use>
<div class="sr-only">
<title>{this.props.icon}</title>
</div>
<use xlinkHref={`#icon-${this.props.icon}`}></use>
</svg>
);
}

File diff suppressed because one or more lines are too long