From ff3a9eea79c50ef3ff3c3832e015d7b84064327e Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 16 Oct 2024 21:40:17 +0000 Subject: [PATCH 01/10] Improve devcontainer experience by linking sample config as real config --- .devcontainer/postCreateCommand.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index dd613dbe..0f289757 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -1,5 +1,6 @@ #!/bin/sh +ln -s ./conf.sample.php cfg/conf.php composer install --no-dev --optimize-autoloader sudo chmod a+x "$(pwd)" && sudo rm -rf /var/www/html && sudo ln -s "$(pwd)" /var/www/html npm install --global nyc From eabf763c41d08df92f0b0e9a090fe2bdbae561f6 Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 16 Oct 2024 22:27:50 +0000 Subject: [PATCH 02/10] Move jquery initialisation/startup logic at the end/down --- js/privatebin.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 9c843628..24afd18e 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -34,13 +34,6 @@ jQuery.fn.draghover = function() { }); }; -// main application start, called when DOM is fully loaded -jQuery(document).ready(function() { - 'use strict'; - // run main controller - $.PrivateBin.Controller.init(); -}); - jQuery.PrivateBin = (function($, RawDeflate) { 'use strict'; @@ -3768,7 +3761,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { /** * Clear the password input in the top navigation - * + * * @name TopNav.clearPasswordInput * @function */ @@ -5671,3 +5664,10 @@ jQuery.PrivateBin = (function($, RawDeflate) { Controller: Controller }; })(jQuery, RawDeflate); + +// main application start, called when DOM is fully loaded +jQuery(document).ready(function() { + 'use strict'; + // run main controller + $.PrivateBin.Controller.init(); +}); From 2cb10b841f3351102dfbc227d45caa810776d427 Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 16 Oct 2024 22:29:20 +0000 Subject: [PATCH 03/10] doc: fix wrong doc missing quotation marks --- cfg/conf.sample.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index f91c5e89..9b9f5b21 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -280,4 +280,5 @@ dir = PATH "data" ; Subresource integrity (SRI) hashes used in template files. Uncomment and set ; these for all js files used. See: ; https://github.com/PrivateBin/PrivateBin/wiki/FAQ#user-content-how-to-make-privatebin-work-when-i-have-changed-some-javascript-files -;privatebin.js = sha512-[…] +;privatebin.js = "sha512-[…]" + From 6631e770a07725e3040a6860240959770e4aea75 Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 16 Oct 2024 22:30:11 +0000 Subject: [PATCH 04/10] doc: make config consistent in quoting yourls header too as everything is unused --- cfg/conf.sample.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index 9b9f5b21..b1279d81 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -259,7 +259,7 @@ dir = PATH "data" ;version = "latest" ;bucket = "my-bucket" -[yourls] +;[yourls] ; When using YOURLS as a "urlshortener" config item: ; - By default, "urlshortener" will point to the YOURLS API URL, with or without ; credentials, and will be visible in public on the PrivateBin web page. From 64ed6e96ee7132cb111268cc9fe4d8540d37f588 Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 16 Oct 2024 22:46:18 +0000 Subject: [PATCH 05/10] fix: load in WebKit again by loading jquery, base and deflate libs non-async'ly --- tpl/bootstrap.php | 6 +++--- tpl/bootstrap5.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 3cc2331c..a9306e43 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -42,7 +42,7 @@ if ($SYNTAXHIGHLIGHTING) : endif; ?> - _scriptTag('js/jquery-3.7.1.js', 'async'); ?> + _scriptTag('js/jquery-3.7.1.js', ''); ?> @@ -56,8 +56,8 @@ if ($ZEROBINCOMPATIBILITY) : endif; ?> _scriptTag('js/zlib-1.3.1.js', 'async'); ?> - _scriptTag('js/base-x-4.0.0.js', 'async'); ?> - _scriptTag('js/rawinflate-0.3.js', 'async'); ?> + _scriptTag('js/base-x-4.0.0.js', ''); ?> + _scriptTag('js/rawinflate-0.3.js', ''); ?> _scriptTag('js/bootstrap-3.4.1.js', 'defer'); ?> - _scriptTag('js/jquery-3.7.1.js', 'defer'); ?> + _scriptTag('js/jquery-3.7.1.js', ''); ?> @@ -39,8 +39,8 @@ if ($ZEROBINCOMPATIBILITY) : endif; ?> _scriptTag('js/zlib-1.3.1.js', 'async'); ?> - _scriptTag('js/base-x-4.0.0.js', 'async'); ?> - _scriptTag('js/rawinflate-0.3.js', 'async'); ?> + _scriptTag('js/base-x-4.0.0.js', ''); ?> + _scriptTag('js/rawinflate-0.3.js', ''); ?> _scriptTag('js/bootstrap-5.3.3.js', 'async'); ?> _scriptTag('js/dark-mode-switch.js', 'async'); ?> Date: Wed, 16 Oct 2024 22:56:35 +0000 Subject: [PATCH 06/10] Revert "Move jquery initialisation/startup logic at the end/down" This reverts commit eabf763c41d08df92f0b0e9a090fe2bdbae561f6. It is not needed anymore, apparently. --- js/privatebin.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 24afd18e..9c843628 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -34,6 +34,13 @@ jQuery.fn.draghover = function() { }); }; +// main application start, called when DOM is fully loaded +jQuery(document).ready(function() { + 'use strict'; + // run main controller + $.PrivateBin.Controller.init(); +}); + jQuery.PrivateBin = (function($, RawDeflate) { 'use strict'; @@ -3761,7 +3768,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { /** * Clear the password input in the top navigation - * + * * @name TopNav.clearPasswordInput * @function */ @@ -5664,10 +5671,3 @@ jQuery.PrivateBin = (function($, RawDeflate) { Controller: Controller }; })(jQuery, RawDeflate); - -// main application start, called when DOM is fully loaded -jQuery(document).ready(function() { - 'use strict'; - // run main controller - $.PrivateBin.Controller.init(); -}); From 8d435d7c141bd98ae77918d17ca904fa0a498957 Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 18 Oct 2024 02:59:20 +0200 Subject: [PATCH 07/10] Fix style by removing optional parameter Co-authored-by: El RIDO --- tpl/bootstrap.php | 6 +++--- tpl/bootstrap5.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index a9306e43..32fff583 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -42,7 +42,7 @@ if ($SYNTAXHIGHLIGHTING) : endif; ?> - _scriptTag('js/jquery-3.7.1.js', ''); ?> + _scriptTag('js/jquery-3.7.1.js'); ?> @@ -56,8 +56,8 @@ if ($ZEROBINCOMPATIBILITY) : endif; ?> _scriptTag('js/zlib-1.3.1.js', 'async'); ?> - _scriptTag('js/base-x-4.0.0.js', ''); ?> - _scriptTag('js/rawinflate-0.3.js', ''); ?> + _scriptTag('js/base-x-4.0.0.js'); ?> + _scriptTag('js/rawinflate-0.3.js'); ?> _scriptTag('js/bootstrap-3.4.1.js', 'defer'); ?> - _scriptTag('js/jquery-3.7.1.js', ''); ?> + _scriptTag('js/jquery-3.7.1.js'); ?> @@ -39,8 +39,8 @@ if ($ZEROBINCOMPATIBILITY) : endif; ?> _scriptTag('js/zlib-1.3.1.js', 'async'); ?> - _scriptTag('js/base-x-4.0.0.js', ''); ?> - _scriptTag('js/rawinflate-0.3.js', ''); ?> + _scriptTag('js/base-x-4.0.0.js'); ?> + _scriptTag('js/rawinflate-0.3.js'); ?> _scriptTag('js/bootstrap-5.3.3.js', 'async'); ?> _scriptTag('js/dark-mode-switch.js', 'async'); ?> Date: Sat, 19 Oct 2024 11:28:01 +0200 Subject: [PATCH 08/10] improve SRI example --- cfg/conf.sample.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index b1279d81..e9880471 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -280,5 +280,4 @@ dir = PATH "data" ; Subresource integrity (SRI) hashes used in template files. Uncomment and set ; these for all js files used. See: ; https://github.com/PrivateBin/PrivateBin/wiki/FAQ#user-content-how-to-make-privatebin-work-when-i-have-changed-some-javascript-files -;privatebin.js = "sha512-[…]" - +;js/privatebin.js = "sha512-[…]" From f0ca1ac88879d6cd3ca523d041e17965a273fc5d Mon Sep 17 00:00:00 2001 From: rugk Date: Tue, 22 Oct 2024 22:20:49 +0000 Subject: [PATCH 09/10] fix: also loaad dark-mode switch defer'Ed to make it load correctly (async fails on WebKIt) --- tpl/bootstrap5.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index bf6e28d5..92fc8ace 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -42,7 +42,7 @@ endif; _scriptTag('js/base-x-4.0.0.js', ''); ?> _scriptTag('js/rawinflate-0.3.js', ''); ?> _scriptTag('js/bootstrap-5.3.3.js', 'async'); ?> - _scriptTag('js/dark-mode-switch.js', 'async'); ?> + _scriptTag('js/dark-mode-switch.js', 'defer'); ?> From 628b60dcb4a16c8dcd9fa62a0c30780b4ad266b6 Mon Sep 17 00:00:00 2001 From: rugk Date: Tue, 22 Oct 2024 22:29:42 +0000 Subject: [PATCH 10/10] refactor: deferring everything including all potential deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also works on Safari… --- tpl/bootstrap.php | 8 ++++---- tpl/bootstrap5.php | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 7efdbdc7..b2398387 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -42,7 +42,7 @@ if ($SYNTAXHIGHLIGHTING) : endif; ?> - _scriptTag('js/jquery-3.7.1.js'); ?> + _scriptTag('js/jquery-3.7.1.js', 'defer'); ?> @@ -56,8 +56,8 @@ if ($ZEROBINCOMPATIBILITY) : endif; ?> _scriptTag('js/zlib-1.3.1.js', 'async'); ?> - _scriptTag('js/base-x-4.0.0.js'); ?> - _scriptTag('js/rawinflate-0.3.js'); ?> + _scriptTag('js/base-x-4.0.0.js', 'defer'); ?> + _scriptTag('js/rawinflate-0.3.js', 'defer'); ?> _scriptTag('js/bootstrap-3.4.1.js', 'defer'); ?> +?>