Skip to content

Commit

Permalink
Fix issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneWizard08 committed Mar 11, 2023
1 parent 6990fbf commit 9f7bd11
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
25 changes: 17 additions & 8 deletions app/src/routes/Instance.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link, useRouter} from "preact-router";
import { Link, useRouter } from "preact-router";
import { useEffect, useState } from "preact/hooks";
import { InstanceInfo, KSPGame } from "../api/instance";
import { invoke_proxy } from "../invoke";
Expand All @@ -14,9 +14,7 @@ export const Instance = () => {
const [instances, setInstances] = useState(false);

useEffect(() => {
setInstances(
/\/instances?(\/\d+)?/i.test(router.path!)
);
setInstances(/\/instances?(\/\d+)?/i.test(router.path!));
}, [router.path]);

const [instanceInfo, setInstanceInfo] = useState<InstanceInfo | undefined>(
Expand Down Expand Up @@ -74,7 +72,11 @@ export const Instance = () => {
</div>
</Link>
<div className="instance">
<img src={background} className="background" alt="background" />
<img
src={background}
className="background"
alt="background"
/>

<div className="infos">
<div className="left">
Expand Down Expand Up @@ -112,13 +114,20 @@ export const Instance = () => {
<textarea
className="editor"
defaultValue={instanceInfo?.description}
ref={editor} />
ref={editor}
/>
) : (
<p
className="description"
dangerouslySetInnerHTML={{
__html: marked(instanceInfo?.description || ""),
}} />
__html: marked(
instanceInfo?.description || "",
{
sanitize: true,
}
),
}}
/>
)}
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion app/src/routes/mods/FullMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export const FullMod = () => {
<p
className="description"
dangerouslySetInnerHTML={{
__html: marked(modInfo?.description || ""),
__html: marked(modInfo?.description || "", {
sanitize: true,
}),
}}
/>
</div>
Expand Down

0 comments on commit 9f7bd11

Please sign in to comment.