Skip to content

Commit 31f82bf

Browse files
committed
Renderer: Fix CORS issue
1 parent 5663d8e commit 31f82bf

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/routes/preview/+page.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
1212
let { data } = $props();
1313
const efp = $derived(data.efp);
14-
$inspect(data)
1514
</script>
1615

1716
<div class="h-full w-full [anchor-name:--content-container]">

src/routes/preview/+page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ export async function load({ fetch, url }: PageLoadEvent) {
88
if (url.searchParams.get("source") === "github") {
99
const raw = url.searchParams.get("raw");
1010
if (raw === null) throw error(400, "Bad Request");
11-
const res = await fetch("https://github.com/" + raw)
11+
const res = await fetch("https://raw.githubusercontent.com/" + raw)
1212
if (!res.ok) throw error(400, "Bad Request");
1313
const efp = await parseEfp(new PreviewEfpPathResolver({
1414
fetchAsset: async p => {
15-
const asset = await fetch("https://github.com/" + concatAndResolveUrl(concatAndResolveUrl(raw, "../"), p), { mode: "cors" });
15+
const asset = await fetch("https://raw.githubusercontent.com/" + concatAndResolveUrl(concatAndResolveUrl(raw, "../"), p), { mode: "cors" });
1616
if (!asset.ok) throw error(400, "Bad Request");
1717
return `data:${asset.headers.get("Content-Type")};base64,${btoa(String.fromCharCode(...await asset.bytes()))}`;
1818
}

0 commit comments

Comments
 (0)