Skip to content

Commit 5901390

Browse files
committed
fix(cors): add cors for comment.css
1 parent dfb6f87 commit 5901390

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

public/_headers

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/comments.css
2+
Access-Control-Allow-Origin: *
3+
Access-Control-Allow-Methods: GET
4+
Access-Control-Allow-Headers: Content-Type

src/components/Comments.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GISCUS } from "@config";
1+
import { GISCUS, SITE } from "@config";
22
import Giscus, { type Theme } from "@giscus/react";
33
import { useEffect, useState } from "react";
44

@@ -9,7 +9,9 @@ interface CommentsProps {
99

1010
export default function Comments({
1111
lightTheme = "light",
12-
darkTheme = "https://blog.cloudti.de/comments.css",
12+
darkTheme = import.meta.env.DEV
13+
? `${window.location.origin}/comments.css`
14+
: `${SITE.website}/comments.css`,
1315
}: CommentsProps) {
1416
const [theme, setTheme] = useState(() => {
1517
const currentTheme = localStorage.getItem("theme");

0 commit comments

Comments
 (0)