' +
@@ -22,13 +22,14 @@ describe('Prompt', function () {
);
$.PrivateBin.Model.reset();
$.PrivateBin.Model.init();
+ global.bootstrap = require('../bootstrap-5.3.7');
$.PrivateBin.Prompt.init();
$.PrivateBin.Prompt.requestPassword();
$('#passworddecrypt').val(password);
// TODO triggers error messages in current jsDOM version, find better solution
//$('#passwordform').submit();
//var result = $.PrivateBin.Prompt.getPassword();
- var result = $('#passworddecrypt').val();
+ const result = $('#passworddecrypt').val();
$.PrivateBin.Model.reset();
// TODO triggers error messages in jsDOM since version 11
//clean();
@@ -37,4 +38,3 @@ describe('Prompt', function () {
);
});
});
-
diff --git a/lib/Configuration.php b/lib/Configuration.php
index 95190446..728a2dc8 100644
--- a/lib/Configuration.php
+++ b/lib/Configuration.php
@@ -108,15 +108,15 @@ class Configuration
),
// update this array when adding/changing/removing js files
'sri' => array(
- 'js/base-x-4.0.0.js' => 'sha512-nNPg5IGCwwrveZ8cA/yMGr5HiRS5Ps2H+s0J/mKTPjCPWUgFGGw7M5nqdnPD3VsRwCVysUh3Y8OWjeSKGkEQJQ==',
+ 'js/base-x-5.0.1.js' => 'sha512-FmhlnjIxQyxkkxQmzf0l6IRGsGbgyCdgqPxypFsEtHMF1naRqaLLo6mcyN5rEaT16nKx1PeJ4g7+07D6gnk/Tg==',
'js/bootstrap-3.4.1.js' => 'sha512-oBTprMeNEKCnqfuqKd6sbvFzmFQtlXS3e0C/RGFV0hD6QzhHV+ODfaQbAlmY6/q0ubbwlAM/nCJjkrgA3waLzg==',
- 'js/bootstrap-5.3.3.js' => 'sha512-in2rcOpLTdJ7/pw5qjF4LWHFRtgoBDxXCy49H4YGOcVdGiPaQucGIbOqxt1JvmpvOpq3J/C7VTa0FlioakB2gQ==',
+ 'js/bootstrap-5.3.7.js' => 'sha512-UqmrCkPcp6WOB9cC/NB5GB7vQd2/sB70bLpFk0bqHz/WQIFucjAM0vFNI4xp8B7jJ8KIUWPblNAS/M30AHKSzA==',
'js/dark-mode-switch.js' => 'sha512-BhY7dNU14aDN5L+muoUmA66x0CkYUWkQT0nxhKBLP/o2d7jE025+dvWJa4OiYffBGEFgmhrD/Sp+QMkxGMTz2g==',
'js/jquery-3.7.1.js' => 'sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==',
- 'js/kjua-0.9.0.js' => 'sha512-CVn7af+vTMBd9RjoS4QM5fpLFEOtBCoB0zPtaqIDC7sF4F8qgUSRFQQpIyEDGsr6yrjbuOLzdf20tkHHmpaqwQ==',
+ 'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==',
'js/legacy.js' => 'sha512-UxW/TOZKon83n6dk/09GsYKIyeO5LeBHokxyIq+r7KFS5KMBeIB/EM7NrkVYIezwZBaovnyNtY2d9tKFicRlXg==',
'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==',
- 'js/privatebin.js' => 'sha512-FSrG36x5zv0ERkagznlfQSE4Dpnvf0Sm6F1a21Qn874ALt9OxqUObUTe7D8tmTBCo0jh5i2B4dh8wIa4HSWB8Q==',
+ 'js/privatebin.js' => 'sha512-gwzwJC0yMtonwX7zzx58e+mpYKUmuQYnuuyIC/Z0XOtYrZlR+DyDkP9hHqj6ejCyAV74SPA670+rUDnYQGS5/Q==',
'js/purify-3.2.6.js' => 'sha512-zqwL4OoBLFx89QPewkz4Lz5CSA2ktU+f31fuECkF0iK3Id5qd3Zpq5dMby8KwHjIEpsUgOqwF58cnmcaNem0EA==',
'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',
'js/zlib-1.3.1-1.js' => 'sha512-5bU9IIP4PgBrOKLZvGWJD4kgfQrkTz8Z3Iqeu058mbQzW3mCumOU6M3UVbVZU9rrVoVwaW4cZK8U8h5xjF88eQ==',
diff --git a/lib/Filter.php b/lib/Filter.php
index 27ad05da..7d20c003 100644
--- a/lib/Filter.php
+++ b/lib/Filter.php
@@ -59,10 +59,10 @@ class Filter
*/
public static function formatHumanReadableSize($size)
{
- $iec = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
+ $iec = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$i = 0;
- while (($size / 1024) >= 1) {
- $size = $size / 1024;
+ while (($size / 1000) >= 1) {
+ $size = $size / 1000;
++$i;
}
return number_format($size, $i ? 2 : 0, '.', ' ') . ' ' . I18n::_($iec[$i]);
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index cd10107f..76264d78 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -46,12 +46,12 @@ endif;
- _scriptTag('js/kjua-0.9.0.js', 'async'); ?>
+ _scriptTag('js/kjua-0.10.0.js', 'async'); ?>
_scriptTag('js/zlib-1.3.1-1.js', 'async'); ?>
- _scriptTag('js/base-x-4.0.0.js', 'defer'); ?>
+ _scriptTag('js/base-x-5.0.1.js', 'defer'); ?>
_scriptTag('js/bootstrap-3.4.1.js', 'defer'); ?>
-
+
- _scriptTag('js/kjua-0.9.0.js', 'async'); ?>
+ _scriptTag('js/kjua-0.10.0.js', 'async'); ?>
_scriptTag('js/zlib-1.3.1-1.js', 'defer'); ?>
- _scriptTag('js/base-x-4.0.0.js', 'defer'); ?>
- _scriptTag('js/bootstrap-5.3.3.js', 'async'); ?>
+ _scriptTag('js/base-x-5.0.1.js', 'defer'); ?>
+ _scriptTag('js/bootstrap-5.3.7.js', 'async'); ?>
_scriptTag('js/dark-mode-switch.js', 'defer'); ?>
assertEquals('1 B', Filter::formatHumanReadableSize(1));
- $this->assertEquals('1 000 B', Filter::formatHumanReadableSize(1000));
- $this->assertEquals('1.00 KiB', Filter::formatHumanReadableSize(1024));
- $this->assertEquals('1.21 KiB', Filter::formatHumanReadableSize(1234));
- $exponent = 1024;
- $this->assertEquals('1 000.00 KiB', Filter::formatHumanReadableSize(1000 * $exponent));
- $this->assertEquals('1.00 MiB', Filter::formatHumanReadableSize(1024 * $exponent));
- $this->assertEquals('1.21 MiB', Filter::formatHumanReadableSize(1234 * $exponent));
- $exponent *= 1024;
- $this->assertEquals('1 000.00 MiB', Filter::formatHumanReadableSize(1000 * $exponent));
- $this->assertEquals('1.00 GiB', Filter::formatHumanReadableSize(1024 * $exponent));
- $this->assertEquals('1.21 GiB', Filter::formatHumanReadableSize(1234 * $exponent));
- $exponent *= 1024;
- $this->assertEquals('1 000.00 GiB', Filter::formatHumanReadableSize(1000 * $exponent));
- $this->assertEquals('1.00 TiB', Filter::formatHumanReadableSize(1024 * $exponent));
- $this->assertEquals('1.21 TiB', Filter::formatHumanReadableSize(1234 * $exponent));
- $exponent *= 1024;
- $this->assertEquals('1 000.00 TiB', Filter::formatHumanReadableSize(1000 * $exponent));
- $this->assertEquals('1.00 PiB', Filter::formatHumanReadableSize(1024 * $exponent));
- $this->assertEquals('1.21 PiB', Filter::formatHumanReadableSize(1234 * $exponent));
- $exponent *= 1024;
- $this->assertEquals('1 000.00 PiB', Filter::formatHumanReadableSize(1000 * $exponent));
- $this->assertEquals('1.00 EiB', Filter::formatHumanReadableSize(1024 * $exponent));
- $this->assertEquals('1.21 EiB', Filter::formatHumanReadableSize(1234 * $exponent));
- $exponent *= 1024;
- $this->assertEquals('1 000.00 EiB', Filter::formatHumanReadableSize(1000 * $exponent));
- $this->assertEquals('1.00 ZiB', Filter::formatHumanReadableSize(1024 * $exponent));
- $this->assertEquals('1.21 ZiB', Filter::formatHumanReadableSize(1234 * $exponent));
- $exponent *= 1024;
- $this->assertEquals('1 000.00 ZiB', Filter::formatHumanReadableSize(1000 * $exponent));
- $this->assertEquals('1.00 YiB', Filter::formatHumanReadableSize(1024 * $exponent));
- $this->assertEquals('1.21 YiB', Filter::formatHumanReadableSize(1234 * $exponent));
+ $this->assertEquals('1.00 kB', Filter::formatHumanReadableSize(1000));
+ $this->assertEquals('1.02 kB', Filter::formatHumanReadableSize(1024));
+ $this->assertEquals('1.23 kB', Filter::formatHumanReadableSize(1234));
+ $exponent = 1000;
+ $this->assertEquals('1.00 MB', Filter::formatHumanReadableSize(1000 * $exponent));
+ $this->assertEquals('1.02 MB', Filter::formatHumanReadableSize(1024 * $exponent));
+ $this->assertEquals('1.23 MB', Filter::formatHumanReadableSize(1234 * $exponent));
+ $exponent *= 1000;
+ $this->assertEquals('1.00 GB', Filter::formatHumanReadableSize(1000 * $exponent));
+ $this->assertEquals('1.02 GB', Filter::formatHumanReadableSize(1024 * $exponent));
+ $this->assertEquals('1.23 GB', Filter::formatHumanReadableSize(1234 * $exponent));
+ $exponent *= 1000;
+ $this->assertEquals('1.00 TB', Filter::formatHumanReadableSize(1000 * $exponent));
+ $this->assertEquals('1.02 TB', Filter::formatHumanReadableSize(1024 * $exponent));
+ $this->assertEquals('1.23 TB', Filter::formatHumanReadableSize(1234 * $exponent));
+ $exponent *= 1000;
+ $this->assertEquals('1.00 PB', Filter::formatHumanReadableSize(1000 * $exponent));
+ $this->assertEquals('1.02 PB', Filter::formatHumanReadableSize(1024 * $exponent));
+ $this->assertEquals('1.23 PB', Filter::formatHumanReadableSize(1234 * $exponent));
+ $exponent *= 1000;
+ $this->assertEquals('1.00 EB', Filter::formatHumanReadableSize(1000 * $exponent));
+ $this->assertEquals('1.02 EB', Filter::formatHumanReadableSize(1024 * $exponent));
+ $this->assertEquals('1.23 EB', Filter::formatHumanReadableSize(1234 * $exponent));
+ $exponent *= 1000;
+ $this->assertEquals('1.00 ZB', Filter::formatHumanReadableSize(1000 * $exponent));
+ $this->assertEquals('1.02 ZB', Filter::formatHumanReadableSize(1024 * $exponent));
+ $this->assertEquals('1.23 ZB', Filter::formatHumanReadableSize(1234 * $exponent));
+ $exponent *= 1000;
+ $this->assertEquals('1.00 YB', Filter::formatHumanReadableSize(1000 * $exponent));
+ $this->assertEquals('1.02 YB', Filter::formatHumanReadableSize(1024 * $exponent));
+ $this->assertEquals('1.23 YB', Filter::formatHumanReadableSize(1234 * $exponent));
}
}