From e675b2547f4e0de97d260fea4467b8a04d73a8e1 Mon Sep 17 00:00:00 2001 From: rugk Date: Wed, 16 Oct 2024 23:09:00 +0200 Subject: [PATCH 1/5] Fix Fixes https://github.com/PrivateBin/PrivateBin/issues/1420 I have not tested it practically (just a quick hotfix), but given the code history and this was what worked before, I guess this should work. :upside_down_face: --- js/privatebin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/privatebin.js b/js/privatebin.js index 9c843628..fbd599f3 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -3988,7 +3988,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { } emailBody += I18n._('Link:'); emailBody += EOL; - emailBody += $('#pasteurl').attr('href'); // might have been shortened + emailBody += $('#pasteurl').attr('href') || window.location.href; // href is tried first as it might have been shortened return emailBody; } From 368e8a2ee7cece6c3be4627f2fff21df90bf835c Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 18 Oct 2024 00:11:35 +0000 Subject: [PATCH 2/5] chore: update SRI hash --- lib/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Configuration.php b/lib/Configuration.php index 9b2717ca..3cd0b569 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -108,7 +108,7 @@ class Configuration 'js/kjua-0.9.0.js' => 'sha512-CVn7af+vTMBd9RjoS4QM5fpLFEOtBCoB0zPtaqIDC7sF4F8qgUSRFQQpIyEDGsr6yrjbuOLzdf20tkHHmpaqwQ==', 'js/legacy.js' => 'sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', - 'js/privatebin.js' => 'sha512-cbmXvtZ/5gZPFjQDzP3IEhUAIhFPAoM31gw2kRYCT5xOh8wv9gXeDqI/t798luRW1xdC4gaYodjEFCzrsZR4mA==', + 'js/privatebin.js' => 'sha512-Bkdx9h1TYuylNaUjrZ6hXIukQthmRgtvxNhnuGguiaVTEobkTKZ8hHYHp9aRUDNSi0s202CpaiUQO3ocMLqRuQ==', 'js/purify-3.1.6.js' => 'sha512-SDwfsqHZFhbcBo/6AN7Te4KoUkWHHw7TzyZCuRkkpl0o8oV4owT/lprznWWe9+qFtigb6MrF81K4CQRLN6be+A==', 'js/rawinflate-0.3.js' => 'sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', From 2bc5931672cc7c502074df78e976f145747d9453 Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 18 Oct 2024 00:13:18 +0000 Subject: [PATCH 3/5] Codespace: Also ensure composer deps like phpunit are usable in devcontainer --- .devcontainer/postCreateCommand.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index dd613dbe..9357442f 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -1,5 +1,8 @@ #!/bin/sh +export PATH="$PATH:$HOME/.composer/vendor/bin" 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 5b245a3f8549165006218431c72b9b39c8b5a3b5 Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 18 Oct 2024 02:18:45 +0200 Subject: [PATCH 4/5] Fix phpunit doc missing crucial step of installing GCS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I tried following the steps when running, for https://github.com/PrivateBin/PrivateBin/pull/1421, but this crucial one step is missing. Maybe more was missing, most tests failed so hmm… but I only wanted it for the SRI generation and this was hard enough. (And no, I did not feel like trying to run a container in a [dev]container, so these manual steps should better work.) Maybe we can improve that further here, I the things I've noticed in this or the other PR. --- doc/Running Unit Tests.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/Running Unit Tests.md b/doc/Running Unit Tests.md index 95078258..2eef1a1d 100644 --- a/doc/Running Unit Tests.md +++ b/doc/Running Unit Tests.md @@ -43,6 +43,11 @@ Example for Debian and Ubuntu: $ sudo apt install phpunit php-gd php-sqlite3 php-xdebug ``` +Because the unit tests depend on this, you also need to install the optional. Otherwise they won't run: +```console +composer require google/cloud-storage +``` + To run the tests, change into the `tst` directory and run phpunit: ```console From 763d6fca7e2c2f2ae8fa70679273abc3d148657f Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 18 Oct 2024 02:20:50 +0200 Subject: [PATCH 5/5] Adding hint that you will see unrelated files and to ignore these --- doc/Running Unit Tests.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/Running Unit Tests.md b/doc/Running Unit Tests.md index 2eef1a1d..1a5770bc 100644 --- a/doc/Running Unit Tests.md +++ b/doc/Running Unit Tests.md @@ -48,6 +48,9 @@ Because the unit tests depend on this, you also need to install the optional. Ot composer require google/cloud-storage ``` +If you do this and want to develop further, please go into `.gitignore` and adjust it to ignore the whole +vendor directory. Otherwise your `git status` will be filled with lot's of unrelated PHP files. + To run the tests, change into the `tst` directory and run phpunit: ```console