Skip to content

Commit

Permalink
refactor: use local static files for ASF CSP rule (#395)
Browse files Browse the repository at this point in the history
* refactor: use local static files for ASF CSP rule

TODO:
1. find jquery
2. google fonts (if we need)

* add google fonts & css files
  • Loading branch information
imbajin authored Feb 17, 2025
1 parent d676858 commit 1df9227
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 17 deletions.
12 changes: 3 additions & 9 deletions themes/docsy/layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,13 @@
{{ template "_internal/schema.html" . -}}
{{ template "_internal/twitter_cards.html" . -}}
{{ partialCached "head-css.html" . "asdf" -}}
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>
<script src='{{ "/js/jquery.min.js" | relURL }}'></script>
{{ if .Site.Params.offlineSearch -}}
<script
src="https://unpkg.com/[email protected]/lunr.min.js"
integrity="sha384-vRQ9bDyE0Wnu+lMfm57BlYLO0/XauFuKpVsZPs7KEDwYKktWi5+Kz3MP8++DFlRY"
crossorigin="anonymous"></script>
<script src='{{ "/js/lunr.min.js" | relURL }}'></script>
{{ end -}}

{{ if .Site.Params.prism_syntax_highlighting -}}
<link rel="stylesheet" href="{{ "/css/prism.css" | relURL }}"/>
<link rel="stylesheet" href='{{ "/css/prism.css" | relURL }}'/>
{{ end -}}

{{ partial "hooks/head-end.html" . -}}
Expand Down
13 changes: 5 additions & 8 deletions themes/docsy/layouts/partials/scripts.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha512-UR25UO94eTnCVwjbXozyeVd6ZqpaAE9naiEUBK/A+QDbfSTQFhPGj5lOR6d8tsgbBk84Ggb5A3EkjsOgPRPcKA=="
crossorigin="anonymous"></script>
<script src='{{ "/js/popper.min.js" | relURL }}'></script>
<script src='{{ "/js/bootstrap.min.js" | relURL }}'></script>


{{ if .Site.Params.mermaid.enable }}
<script src="https://cdn.jsdelivr.net/npm/mermaid@8.13.4/dist/mermaid.min.js" integrity="sha512-JERecFUBbsm75UpkVheAuDOE8NdHjQBrPACfEQYPwvPG+fjgCpHAz1Jw2ci9EXmd3DdfiWth3O3CQvcfEg8gsA==" crossorigin="anonymous"></script>
<script src='{{ "/js/mermaid.min.js" | relURL }}'></script>
{{ end }}

{{ if .Site.Params.markmap.enable }}
Expand Down Expand Up @@ -48,7 +45,7 @@
{{ end }}
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src='https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js'
integrity='sha512-ZA/RPrAo88DlwRnnoNVqKINnQNcWERzRK03PDaA4GIJiVZvGFIWQbdWCsUebMZfkWohnfngsDjXzU6PokO4jGw==' crossorigin='anonymous'
integrity='sha512-ZA/RPrAo88DlwRnnoNVqKINnQNcWERzRK03PDaA4GIJiVZvGFIWQbdWCsUebMZfkWohnfngsDjXzU6PokO4jGw==' crossorigin='anonymous'
{{ printf "onload='renderMathInElement(%s, %s);'" (( .Site.Params.katex.html_dom_element | default "document.body" ) | safeJS ) ( printf "%s" ( $.Site.Params.katex.options | jsonify )) | safeHTMLAttr }}></script>
{{ end }}

Expand Down
48 changes: 48 additions & 0 deletions themes/docsy/static/css/open-sans.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* open-sans-300 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Open Sans';
font-style: normal;
font-weight: 300;
src: url('../webfonts/open-sans/open-sans-v40-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* open-sans-300italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Open Sans';
font-style: italic;
font-weight: 300;
src: url('../webfonts/open-sans/open-sans-v40-latin-300italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* open-sans-regular - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: url('../webfonts/open-sans/open-sans-v40-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* open-sans-italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: url('../webfonts/open-sans/open-sans-v40-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* open-sans-700 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Open Sans';
font-style: normal;
font-weight: 700;
src: url('../webfonts/open-sans/open-sans-v40-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* open-sans-700italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Open Sans';
font-style: italic;
font-weight: 700;
src: url('../webfonts/open-sans/open-sans-v40-latin-700italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
40 changes: 40 additions & 0 deletions themes/docsy/static/css/rubik.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* rubik-300 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 300;
src: url('../webfonts/rubik/rubik-v28-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* rubik-regular - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 400;
src: url('../webfonts/rubik/rubik-v28-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* rubik-500 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 500;
src: url('../webfonts/rubik/rubik-v28-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* rubik-600 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 600;
src: url('../webfonts/rubik/rubik-v28-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* rubik-700 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 700;
src: url('../webfonts/rubik/rubik-v28-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
32 changes: 32 additions & 0 deletions themes/docsy/static/css/tajawal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* tajawal-300 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Tajawal';
font-style: normal;
font-weight: 300;
src: url('../webfonts/tajawal/tajawal-v10-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* tajawal-regular - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Tajawal';
font-style: normal;
font-weight: 400;
src: url('../webfonts/tajawal/tajawal-v10-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* tajawal-500 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Tajawal';
font-style: normal;
font-weight: 500;
src: url('../webfonts/tajawal/tajawal-v10-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* tajawal-700 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Tajawal';
font-style: normal;
font-weight: 700;
src: url('../webfonts/tajawal/tajawal-v10-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
7 changes: 7 additions & 0 deletions themes/docsy/static/js/bootstrap.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions themes/docsy/static/js/jquery.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions themes/docsy/static/js/lunr.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions themes/docsy/static/js/mermaid.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions themes/docsy/static/js/popper.min.js

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 1df9227

Please sign in to comment.