Skip to content

Commit

Permalink
[release-0.20] Update docs theme patching: (#8938)
Browse files Browse the repository at this point in the history
* Update docs theme patching:

There is a docs theme patch that is needed
for security reasons. See the patch commit for
details. This patch wasn't being applied properly.
This fixes the patch apply.

Signed-off-by: Jacob Weinstock <[email protected]>

* Add missing patch to git

Signed-off-by: Jacob Weinstock <[email protected]>

---------

Signed-off-by: Jacob Weinstock <[email protected]>
Co-authored-by: Jacob Weinstock <[email protected]>
  • Loading branch information
eks-distro-pr-bot and jacobweinstock authored Oct 31, 2024
1 parent 6d03c54 commit dac8ea6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ help: ## Show this help. Requires locally installed npm and hugo.

build: build-docs htmltest

build-docs: submodule ## Generate the static site into the /public folder
build-docs: submodule-apply-patches ## Generate the static site into the /public folder
npm install
hugo --environment production --cleanDestinationDir

Expand All @@ -30,7 +30,7 @@ submodule: ## Initialize the docsy theme submodule
git submodule update --init --recursive

submodule-apply-patches: submodule ## Apply submodule patches
cd themes/docsy; git am ../../patches/0001-Make-docsy-js-files-static.patch; cd ../..
cd themes/docsy; git am < ../../patches/0001-Security-update.patch; cd ../..

submodule-reset: ## Reset submodules to tracked commit
git submodule update --init --recursive --force
Expand All @@ -57,6 +57,7 @@ server: serve
container-build: submodule-apply-patches ## Build a container image for the preview of the website
docker build -t $(CONTAINER_IMAGE) .
$(MAKE) submodule-reset
$(MAKE) submodule-apply-patches

container-serve: ## Boot the development server using container. Run `make container-build` before this.
docker run \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
From 4b1e548ac02422f8953aa2effa86af581bceeb47 Mon Sep 17 00:00:00 2001
From: Terry Howe <tlhowe@amazon.com>
Date: Tue, 1 Feb 2022 11:38:52 -0700
Subject: [PATCH] Make docsy js files static
From f97e20029a8b34b66eb5356764b268fc527741f7 Mon Sep 17 00:00:00 2001
From: Jacob Weinstock <jakobweinstock@gmail.com>
Date: Thu, 31 Oct 2024 10:24:12 -0600
Subject: [PATCH] Security update:

For security reasons, Amazon does not allow
Webpage loads resources from CDN or domain with
public access or elevated risk via link(s).
For this reason we host the javascript files locally
and reference them in the theme.

Signed-off-by: Jacob Weinstock <[email protected]>
---
layouts/partials/head.html | 4 ++--
layouts/partials/scripts.html | 4 ++--
Expand Down Expand Up @@ -53,5 +60,5 @@ index ae881ac..8c3d1bf 100644
-!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var i=window.ClipboardJS||void 0;i||"function"!=typeof require||(i=require("clipboard"));var c=[];if(!i){var o=document.createElement("script"),t=document.querySelector("head");o.onload=function(){if(i=window.ClipboardJS)for(;c.length;)c.pop()()},o.src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js",t.appendChild(o)}Prism.plugins.toolbar.registerButton("copy-to-clipboard",function(o){var t=document.createElement("button");t.textContent="Copy";var e=o.element;return i?n():c.push(n),t;function n(){var o=new i(t,{text:function(){return e.textContent}});o.on("success",function(){t.textContent="Copied!",r()}),o.on("error",function(){t.textContent="Press Ctrl+C to copy",r()})}function r(){setTimeout(function(){t.textContent="Copy"},5e3)}})}else console.warn("Copy to Clipboard plugin loaded before Toolbar plugin.")}();
+!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var i=window.ClipboardJS||void 0;i||"function"!=typeof require||(i=require("clipboard"));var c=[];if(!i){var o=document.createElement("script"),t=document.querySelector("head");o.onload=function(){if(i=window.ClipboardJS)for(;c.length;)c.pop()()},o.src="/js/clipboard.min.js",t.appendChild(o)}Prism.plugins.toolbar.registerButton("copy-to-clipboard",function(o){var t=document.createElement("button");t.textContent="Copy";var e=o.element;return i?n():c.push(n),t;function n(){var o=new i(t,{text:function(){return e.textContent}});o.on("success",function(){t.textContent="Copied!",r()}),o.on("error",function(){t.textContent="Press Ctrl+C to copy",r()})}function r(){setTimeout(function(){t.textContent="Copy"},5e3)}})}else console.warn("Copy to Clipboard plugin loaded before Toolbar plugin.")}();
--
2.29.2
2.44.0

0 comments on commit dac8ea6

Please sign in to comment.