Skip to content

Commit 1941fc7

Browse files
committed
fix: replace FontAwesome CDN with inline SVGs to resolve SRI security finding
1 parent b68f9c7 commit 1941fc7

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

docusaurus.config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,13 +1263,6 @@ const config = {
12631263
],
12641264
tailwindPlugin,
12651265
],
1266-
stylesheets: [
1267-
{
1268-
href: "https://use.fontawesome.com/releases/v6.2.0/css/all.css",
1269-
type: "text/css",
1270-
rel: "stylesheet",
1271-
},
1272-
],
12731266
onDuplicateRoutes: "warn",
12741267
onBrokenLinks: "warn",
12751268
onBrokenMarkdownLinks: "warn",

src/components/CopyButton/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ function CopyButton({ isVisible }) {
101101
>
102102
<span className={`icon-container${!isVisible ? " not-visible" : ""}`}>
103103
<Sparkles className={`sparkles${isVisible ? " is-visible" : ""}`} />
104-
<i className="fa-solid fa-check" style={{ fontSize: "16px" }}></i>
104+
<svg
105+
xmlns="http://www.w3.org/2000/svg"
106+
viewBox="0 0 448 512"
107+
className="check-icon"
108+
aria-hidden="true"
109+
>
110+
<path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z" />
111+
</svg>
105112
</span>
106113
{isVisible && (
107114
<span className="copy-markdown-btn__text">

src/components/CopyButton/styles.css

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,28 @@ html[data-theme="dark"] .copy-markdown-btn__text {
5252
margin-right: 0.5rem;
5353
}
5454

55-
.copy-markdown-btn i {
56-
color: var(--ifm-color-secondary);
55+
.copy-markdown-btn .check-icon {
56+
fill: var(--ifm-color-secondary);
5757
position: absolute;
5858
top: 0;
5959
left: 0;
60+
width: 16px;
61+
height: 16px;
6062
transition: opacity 0.3s ease;
6163
}
6264

6365
.copy-markdown-btn .sparkles {
6466
opacity: 1;
6567
}
6668

67-
.copy-markdown-btn i.fa-check {
69+
.copy-markdown-btn .check-icon {
6870
opacity: 0;
6971
}
7072

7173
.copy-markdown-btn.copied .sparkles {
7274
opacity: 0;
7375
}
7476

75-
.copy-markdown-btn.copied i.fa-check {
77+
.copy-markdown-btn.copied .check-icon {
7678
opacity: 1;
7779
}

src/components/Issue/index.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ export function ReportAnIssueIcon() {
1414
rel="noreferrer noopener"
1515
className="issue-button"
1616
>
17-
<i className="fa-solid fa-bug"></i>
17+
<svg
18+
xmlns="http://www.w3.org/2000/svg"
19+
viewBox="0 0 512 512"
20+
width="1em"
21+
height="1em"
22+
fill="currentColor"
23+
aria-hidden="true"
24+
>
25+
<path d="M256 0c-25.3 0-47.2 14.7-57.6 36c-7-2.6-14.5-4-22.4-4c-35.3 0-64 28.7-64 64l0 4.7C71.6 112.4 32 153 32 204.8l0 12.1c-8.5 5.9-16.6 12.5-24 19.7l-15.1 14.4C-16.4 258.9-2.6 288 22.3 288l59.1 0c9.5 27.3 22.6 52.9 38.5 76.2c-10 5-17.8 13.8-21.7 24.7l-2 5.6c-9.4 26.3 8.2 54.5 36.1 54.5l5.1 0c12.3 0 24.1-5.4 32.1-14.8l2.7-3.1c6.7 5.1 13.7 9.7 21.1 13.7l0 49.8c0 17.7 14.3 32 32 32s32-14.3 32-32l0-40c5.3 .7 10.6 1 16 1s10.7-.3 16-1l0 40c0 17.7 14.3 32 32 32s32-14.3 32-32l0-49.8c7.4-4 14.4-8.6 21.1-13.7l2.7 3.1c8 9.4 19.8 14.8 32.1 14.8l5.1 0c27.9 0 45.5-28.2 36.1-54.5l-2-5.6c-3.9-10.9-11.7-19.7-21.7-24.7c15.9-23.3 29-48.9 38.5-76.2l59.1 0c24.9 0 38.7-29.1 23.4-47.8L457.7 216.5c-7.4-7.2-15.5-13.8-24-19.7l0-12.1c0-51.8-39.6-92.4-80-103.1l0-4.7c0-35.3-28.7-64-64-64c-7.9 0-15.4 1.4-22.4 4C303.2 14.7 281.3 0 256 0z" />
26+
</svg>
1827
</a>
1928
);
2029
}
@@ -32,7 +41,17 @@ export function ReportAnIssue() {
3241
className="issue-button"
3342
>
3443
<span>
35-
<i className="fa-solid fa-bug"></i> Report an Issue
44+
<svg
45+
xmlns="http://www.w3.org/2000/svg"
46+
viewBox="0 0 512 512"
47+
width="1em"
48+
height="1em"
49+
fill="currentColor"
50+
aria-hidden="true"
51+
>
52+
<path d="M256 0c-25.3 0-47.2 14.7-57.6 36c-7-2.6-14.5-4-22.4-4c-35.3 0-64 28.7-64 64l0 4.7C71.6 112.4 32 153 32 204.8l0 12.1c-8.5 5.9-16.6 12.5-24 19.7l-15.1 14.4C-16.4 258.9-2.6 288 22.3 288l59.1 0c9.5 27.3 22.6 52.9 38.5 76.2c-10 5-17.8 13.8-21.7 24.7l-2 5.6c-9.4 26.3 8.2 54.5 36.1 54.5l5.1 0c12.3 0 24.1-5.4 32.1-14.8l2.7-3.1c6.7 5.1 13.7 9.7 21.1 13.7l0 49.8c0 17.7 14.3 32 32 32s32-14.3 32-32l0-40c5.3 .7 10.6 1 16 1s10.7-.3 16-1l0 40c0 17.7 14.3 32 32 32s32-14.3 32-32l0-49.8c7.4-4 14.4-8.6 21.1-13.7l2.7 3.1c8 9.4 19.8 14.8 32.1 14.8l5.1 0c27.9 0 45.5-28.2 36.1-54.5l-2-5.6c-3.9-10.9-11.7-19.7-21.7-24.7c15.9-23.3 29-48.9 38.5-76.2l59.1 0c24.9 0 38.7-29.1 23.4-47.8L457.7 216.5c-7.4-7.2-15.5-13.8-24-19.7l0-12.1c0-51.8-39.6-92.4-80-103.1l0-4.7c0-35.3-28.7-64-64-64c-7.9 0-15.4 1.4-22.4 4C303.2 14.7 281.3 0 256 0z" />
53+
</svg>{" "}
54+
Report an Issue
3655
</span>
3756
</a>
3857
);

0 commit comments

Comments
 (0)