This commit is contained in:
Jason Schwarzenberger
2020-12-02 14:10:13 +13:00
parent 33c622216c
commit 888c341296
2 changed files with 16 additions and 2 deletions
+11 -1
View File
@@ -1,9 +1,16 @@
<script>
import DOMPurify from "dompurify";
import { onMount } from "svelte";
import { getLogoUrl } from "../utils/logos.js";
import StoryInfo from "../components/StoryInfo.svelte";
export let stories;
const host = (url) => new URL(url).hostname.replace(/^www\./, "");
let purify = () => "";
onMount(() => {
purify = (html) => DOMPurify.sanitize(html);
});
</script>
<style>
@@ -41,7 +48,10 @@
alt="logo"
class="story-icon"
style="height: 1rem; width: 1rem;" />
<a class="story-title" rel="prefetch" href="/{story.id}">{story.title}</a>
<a
class="story-title"
rel="prefetch"
href="/{story.id}">{@html purify(story.title)}</a>
<a
class="story-source"
href={story.url || story.link}>{host(story.url || story.link)}</a>