From 875d3b0540adc66c19dd015fe8c34c4a5e0b6b6d Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Thu, 18 Nov 2021 08:31:04 +0000 Subject: [PATCH 1/5] fix(svg): element no longer allows path somehow path is considered as cross-origin resource, though not mentioned in the doc https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use perhaps full URL (with protocol & domain) must be used? but that will break mirror sites if used --- themes/chameleon/layout/_partial/header.ejs | 16 +++--------- .../chameleon/layout/_partial/post/title.ejs | 8 ++---- themes/chameleon/scripts/heading-link.js | 2 +- themes/chameleon/source/css/_source.css | 25 ++++++++----------- themes/chameleon/source/css/chameleon.css | 25 ++++++++----------- themes/chameleon/source/js/chameleon.js | 2 +- themes/chameleon/source/svg/link.svg | 2 +- themes/chameleon/source/svg/search.svg | 8 +----- themes/chameleon/source/svg/share.svg | 2 +- 9 files changed, 33 insertions(+), 57 deletions(-) diff --git a/themes/chameleon/layout/_partial/header.ejs b/themes/chameleon/layout/_partial/header.ejs index 83ddc5c..6a565f8 100644 --- a/themes/chameleon/layout/_partial/header.ejs +++ b/themes/chameleon/layout/_partial/header.ejs @@ -14,12 +14,8 @@ - - - Powered by DuckDuckGo - Search icon - - + + @@ -38,12 +34,8 @@ - - - Powered by DuckDuckGo - Search icon - - + + diff --git a/themes/chameleon/layout/_partial/post/title.ejs b/themes/chameleon/layout/_partial/post/title.ejs index 13055ed..c5951e4 100644 --- a/themes/chameleon/layout/_partial/post/title.ejs +++ b/themes/chameleon/layout/_partial/post/title.ejs @@ -10,12 +10,8 @@ <% } else { %>

<%= post.title %> <%/* Share button */%> - - - Share post - Share icon - - + +

<% } %> diff --git a/themes/chameleon/scripts/heading-link.js b/themes/chameleon/scripts/heading-link.js index 48bbebe..2fb8982 100644 --- a/themes/chameleon/scripts/heading-link.js +++ b/themes/chameleon/scripts/heading-link.js @@ -6,7 +6,7 @@ */ const { slugize, stripHTML } = require('hexo-util') -const svg = '' +const svg = '' const anchorId = (str, transformOption) => { return slugize(str.trim(), { transform: transformOption }) diff --git a/themes/chameleon/source/css/_source.css b/themes/chameleon/source/css/_source.css index 2371363..acb152f 100644 --- a/themes/chameleon/source/css/_source.css +++ b/themes/chameleon/source/css/_source.css @@ -732,26 +732,23 @@ svg#share:hover { /* hide share button by default unhide (via JS) if Web Share API is supported */ -.article-title a#share-button { - display: none; +.article-title a#btnshare { + display: initial; } -.article .article-entry a.headerlink svg, -.article-title a#share-button svg { - height: 0.75em; - margin-bottom: 0.25em; +.article-title a#btnshare img { + display: block; + margin: auto; + margin-bottom: 0.5em; + max-height: 30em; } -/* don't underline permalink and share icons */ .article .article-entry a.headerlink, -.article-title a#share-button { +.article-title a#btnshare { margin-left: 0.5em; -} - -/* underline permalink and share icons when hover */ -.article .article-entry a.headerlink:hover, -.article-title a#share-button:hover { - border-bottom: 1px solid var(--link-underline); + display: inline-block; + height: 1em; + width: 1em; } @media (max-width: 768px) { diff --git a/themes/chameleon/source/css/chameleon.css b/themes/chameleon/source/css/chameleon.css index 8a16396..453fbb5 100644 --- a/themes/chameleon/source/css/chameleon.css +++ b/themes/chameleon/source/css/chameleon.css @@ -1052,26 +1052,23 @@ svg#share:hover { /* hide share button by default unhide (via JS) if Web Share API is supported */ -.article-title a#share-button { - display: none; +.article-title a#btnshare { + display: initial; } -.article .article-entry a.headerlink svg, -.article-title a#share-button svg { - height: 0.75em; - margin-bottom: 0.25em; +.article-title a#btnshare img { + display: block; + margin: auto; + margin-bottom: 0.5em; + max-height: 30em; } -/* don't underline permalink and share icons */ .article .article-entry a.headerlink, -.article-title a#share-button { +.article-title a#btnshare { margin-left: 0.5em; -} - -/* underline permalink and share icons when hover */ -.article .article-entry a.headerlink:hover, -.article-title a#share-button:hover { - border-bottom: 1px solid var(--link-underline); + display: inline-block; + height: 1em; + width: 1em; } @media (max-width: 768px) { diff --git a/themes/chameleon/source/js/chameleon.js b/themes/chameleon/source/js/chameleon.js index d5d5748..0a658df 100644 --- a/themes/chameleon/source/js/chameleon.js +++ b/themes/chameleon/source/js/chameleon.js @@ -29,7 +29,7 @@ document.addEventListener('click', (evt) => { // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share // Only available on supporting browsers and HTTPS if (navigator.share && document.location.protocol === 'https:') { - const shareBtn = document.getElementById('share-button') + const shareBtn = document.getElementById('btnshare') // Unhide share-button if supported shareBtn.style.display = 'initial' diff --git a/themes/chameleon/source/svg/link.svg b/themes/chameleon/source/svg/link.svg index 8623d97..6d38912 100644 --- a/themes/chameleon/source/svg/link.svg +++ b/themes/chameleon/source/svg/link.svg @@ -6,4 +6,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - \ No newline at end of file + \ No newline at end of file diff --git a/themes/chameleon/source/svg/search.svg b/themes/chameleon/source/svg/search.svg index 85354ed..9e5bcbe 100644 --- a/themes/chameleon/source/svg/search.svg +++ b/themes/chameleon/source/svg/search.svg @@ -1,8 +1,2 @@ - - + diff --git a/themes/chameleon/source/svg/share.svg b/themes/chameleon/source/svg/share.svg index cc7deda..035fcdf 100644 --- a/themes/chameleon/source/svg/share.svg +++ b/themes/chameleon/source/svg/share.svg @@ -7,5 +7,5 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - + From 8e376268020efdd85d91b00cf073f0a5547eff65 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Thu, 18 Nov 2021 08:33:26 +0000 Subject: [PATCH 2/5] fix(csp): allow web manifest - this site does use it * https://gitlab.com/curben/blog/-/blob/master/source/site.webmanifest --- source/_headers | 2 +- source/_posts/caddy-nixos-part-3.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/_headers b/source/_headers index 75a33a1..67b0a0f 100644 --- a/source/_headers +++ b/source/_headers @@ -1,5 +1,5 @@ /* - Content-Security-Policy: default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src 'self'; manifest-src 'none'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src 'self'; style-src 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion; frame-ancestors 'none'; block-all-mixed-content; sandbox allow-forms allow-scripts + Content-Security-Policy: default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src 'self'; manifest-src 'self'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src 'self'; style-src 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion; frame-ancestors 'none'; block-all-mixed-content; sandbox allow-forms allow-scripts Expires: 0 Feature-Policy: accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; display-capture 'none'; document-domain 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; speaker 'none'; sync-xhr 'none'; usb 'none'; vibrate 'none'; vr 'none'; wake-lock 'none'; webauthn 'none'; xr-spatial-tracking 'none'; interest-cohort=() Permissions-Policy: accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; display-capture 'none'; document-domain 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; speaker 'none'; sync-xhr 'none'; usb 'none'; vibrate 'none'; vr 'none'; wake-lock 'none'; webauthn 'none'; xr-spatial-tracking 'none'; interest-cohort=() diff --git a/source/_posts/caddy-nixos-part-3.md b/source/_posts/caddy-nixos-part-3.md index 1c10d76..ad00286 100644 --- a/source/_posts/caddy-nixos-part-3.md +++ b/source/_posts/caddy-nixos-part-3.md @@ -385,7 +385,7 @@ The upstream locations insert some information into the response headers that ar -x-nf-request-id -x-served-by -x-timer - Content-Security-Policy "default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src 'self'; manifest-src 'none'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src 'self'; style-src 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion; frame-ancestors 'none'; block-all-mixed-content" + Content-Security-Policy "default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src 'self'; manifest-src 'self'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src 'self'; style-src 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion; frame-ancestors 'none'; block-all-mixed-content" Expires "0" Permissions-Policy "accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; display-capture 'none'; document-domain 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; speaker 'none'; sync-xhr 'none'; usb 'none'; vibrate 'none'; vr 'none'; wake-lock 'none'; webauthn 'none'; xr-spatial-tracking 'none'; interest-cohort=()" Referrer-Policy "no-referrer" @@ -500,7 +500,7 @@ Since I also set up reverse proxy for {% post_link tor-hidden-onion-nixos 'Tor O -x-timer -x-ua-compatible Cache-Control "max-age=86400, public" - Content-Security-Policy "default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src 'self'; manifest-src 'none'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src 'self'; style-src 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion; frame-ancestors 'none'; block-all-mixed-content" + Content-Security-Policy "default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src 'self'; manifest-src 'self'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src 'self'; style-src 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion; frame-ancestors 'none'; block-all-mixed-content" Expires "0" Permissions-Policy "accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; display-capture 'none'; document-domain 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; speaker 'none'; sync-xhr 'none'; usb 'none'; vibrate 'none'; vr 'none'; wake-lock 'none'; webauthn 'none'; xr-spatial-tracking 'none'; interest-cohort=()" Referrer-Policy "no-referrer" From ed521ca89677813588a87bc7189d7589dc139a18 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Thu, 18 Nov 2021 10:25:41 +0000 Subject: [PATCH 3/5] fix(css): hide share button by default --- themes/chameleon/source/css/_source.css | 2 +- themes/chameleon/source/css/chameleon.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/chameleon/source/css/_source.css b/themes/chameleon/source/css/_source.css index acb152f..be9f92e 100644 --- a/themes/chameleon/source/css/_source.css +++ b/themes/chameleon/source/css/_source.css @@ -733,7 +733,7 @@ svg#share:hover { /* hide share button by default unhide (via JS) if Web Share API is supported */ .article-title a#btnshare { - display: initial; + display: none; } .article-title a#btnshare img { diff --git a/themes/chameleon/source/css/chameleon.css b/themes/chameleon/source/css/chameleon.css index 453fbb5..2e720b5 100644 --- a/themes/chameleon/source/css/chameleon.css +++ b/themes/chameleon/source/css/chameleon.css @@ -1053,7 +1053,7 @@ svg#share:hover { /* hide share button by default unhide (via JS) if Web Share API is supported */ .article-title a#btnshare { - display: initial; + display: none; } .article-title a#btnshare img { From b72ffb1c39ef40881e885f3a2e9e92348f7793f2 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Thu, 18 Nov 2021 10:32:54 +0000 Subject: [PATCH 4/5] fix(css): hide share button by default --- themes/chameleon/source/css/_source.css | 5 ++++- themes/chameleon/source/css/chameleon.css | 5 ++++- themes/chameleon/source/js/chameleon.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/themes/chameleon/source/css/_source.css b/themes/chameleon/source/css/_source.css index be9f92e..4d33076 100644 --- a/themes/chameleon/source/css/_source.css +++ b/themes/chameleon/source/css/_source.css @@ -746,11 +746,14 @@ unhide (via JS) if Web Share API is supported */ .article .article-entry a.headerlink, .article-title a#btnshare { margin-left: 0.5em; - display: inline-block; height: 1em; width: 1em; } +.article .article-entry a.headerlink { + display: inline-block; +} + @media (max-width: 768px) { .article-title { font-size: 1.8rem; diff --git a/themes/chameleon/source/css/chameleon.css b/themes/chameleon/source/css/chameleon.css index 2e720b5..40df2fc 100644 --- a/themes/chameleon/source/css/chameleon.css +++ b/themes/chameleon/source/css/chameleon.css @@ -1066,11 +1066,14 @@ unhide (via JS) if Web Share API is supported */ .article .article-entry a.headerlink, .article-title a#btnshare { margin-left: 0.5em; - display: inline-block; height: 1em; width: 1em; } +.article .article-entry a.headerlink { + display: inline-block; +} + @media (max-width: 768px) { .article-title { font-size: 1.8rem; diff --git a/themes/chameleon/source/js/chameleon.js b/themes/chameleon/source/js/chameleon.js index 0a658df..8be5c8b 100644 --- a/themes/chameleon/source/js/chameleon.js +++ b/themes/chameleon/source/js/chameleon.js @@ -32,7 +32,7 @@ if (navigator.share && document.location.protocol === 'https:') { const shareBtn = document.getElementById('btnshare') // Unhide share-button if supported - shareBtn.style.display = 'initial' + shareBtn.style.display = 'inline-block' shareBtn.addEventListener('click', async () => { const query = (selector) => { From 2154d9658d3ac013700cf72ea59c0050e25f1fee Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Thu, 18 Nov 2021 10:53:12 +0000 Subject: [PATCH 5/5] fix(form): avoid opening new window - https://community.atlassian.com/t5/Jira-Core-Server-questions/How-to-set-permission-of-allow-popups/qaq-p/1674406 - https://teddit.net/r/techsupport/comments/brnb90/what_is_blocked_opening_in_a_new_window_because/ --- themes/chameleon/layout/_partial/header.ejs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/chameleon/layout/_partial/header.ejs b/themes/chameleon/layout/_partial/header.ejs index 6a565f8..470614d 100644 --- a/themes/chameleon/layout/_partial/header.ejs +++ b/themes/chameleon/layout/_partial/header.ejs @@ -8,7 +8,7 @@ <% }} %>
-
+ @@ -28,7 +28,7 @@