key in version 2 is raw value instead of base64 (which reduces its complexity), made PasteDecryptor support both versions of the format, refactoring method names, replacing var by let / const, reducing zlib compression level from 9 to 7 to half the time spent on compression
This commit is contained in:
parent
be69e4a50f
commit
0ee86f33da
|
@ -89,6 +89,8 @@ function parseMime(line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// common testing helper functions
|
// common testing helper functions
|
||||||
|
exports.atob = atob;
|
||||||
|
exports.btoa = btoa;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* convert all applicable characters to HTML entities
|
* convert all applicable characters to HTML entities
|
||||||
|
|
537
js/privatebin.js
537
js/privatebin.js
File diff suppressed because it is too large
Load Diff
|
@ -131,9 +131,9 @@ describe('Model', function () {
|
||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.array(common.jscQueryString()),
|
jsc.array(common.jscQueryString()),
|
||||||
jsc.nearray(common.jscBase64String()),
|
'nestring',
|
||||||
function (schema, address, query, fragment) {
|
function (schema, address, query, fragment) {
|
||||||
var fragmentString = fragment.join(''),
|
var fragmentString = common.btoa(fragment),
|
||||||
clean = jsdom('', {
|
clean = jsdom('', {
|
||||||
url: schema.join('') + '://' + address.join('') +
|
url: schema.join('') + '://' + address.join('') +
|
||||||
'/?' + query.join('') + '#' + fragmentString
|
'/?' + query.join('') + '#' + fragmentString
|
||||||
|
@ -141,7 +141,7 @@ describe('Model', function () {
|
||||||
result = $.PrivateBin.Model.getPasteKey();
|
result = $.PrivateBin.Model.getPasteKey();
|
||||||
$.PrivateBin.Model.reset();
|
$.PrivateBin.Model.reset();
|
||||||
clean();
|
clean();
|
||||||
return fragmentString === result;
|
return fragment === result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
jsc.property(
|
jsc.property(
|
||||||
|
@ -149,10 +149,10 @@ describe('Model', function () {
|
||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.array(common.jscQueryString()),
|
jsc.array(common.jscQueryString()),
|
||||||
jsc.nearray(common.jscBase64String()),
|
'nestring',
|
||||||
jsc.array(common.jscHashString()),
|
jsc.array(common.jscHashString()),
|
||||||
function (schema, address, query, fragment, trail) {
|
function (schema, address, query, fragment, trail) {
|
||||||
var fragmentString = fragment.join(''),
|
var fragmentString = common.btoa(fragment),
|
||||||
clean = jsdom('', {
|
clean = jsdom('', {
|
||||||
url: schema.join('') + '://' + address.join('') + '/?' +
|
url: schema.join('') + '://' + address.join('') + '/?' +
|
||||||
query.join('') + '#' + fragmentString + '&' + trail.join('')
|
query.join('') + '#' + fragmentString + '&' + trail.join('')
|
||||||
|
@ -160,7 +160,7 @@ describe('Model', function () {
|
||||||
result = $.PrivateBin.Model.getPasteKey();
|
result = $.PrivateBin.Model.getPasteKey();
|
||||||
$.PrivateBin.Model.reset();
|
$.PrivateBin.Model.reset();
|
||||||
clean();
|
clean();
|
||||||
return fragmentString === result;
|
return fragment === result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
jsc.property(
|
jsc.property(
|
||||||
|
|
|
@ -5,7 +5,7 @@ let ret;
|
||||||
async function initialize() {
|
async function initialize() {
|
||||||
if (ret) return ret;
|
if (ret) return ret;
|
||||||
|
|
||||||
const COMPRESSION_LEVEL = 9;
|
const COMPRESSION_LEVEL = 7;
|
||||||
const NO_ZLIB_HEADER = -1;
|
const NO_ZLIB_HEADER = -1;
|
||||||
const CHUNK_SIZE = 32 * 1024;
|
const CHUNK_SIZE = 32 * 1024;
|
||||||
const map = {};
|
const map = {};
|
||||||
|
|
|
@ -55,7 +55,7 @@ if ($ZEROBINCOMPATIBILITY):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/zlib-1.2.11.js" integrity="sha512-UOOlXbjGGS/ezf/cbE3Hc4L0ybB2NQBbk523tAT8m1TsnagkIgYUKuFfl+DL4wZbu7IopLvhI2kl+61+2oaaGA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/zlib-1.2.11.js" integrity="sha512-h8gJuMJ1L95FlbJwo5F8NkjEpK0Nv+9ASHShUrCBnMpIlciQ0d0qfkmAKYJ1jlwfqrbVYhqr8hpyIh5wClIP3w==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/bootstrap-3.3.7.js" integrity="sha512-iztkobsvnjKfAtTNdHkGVjAYTrrtlC7mGp/54c40wowO7LhURYl3gVzzcEqGl/qKXQltJ2HwMrdLcNUdo+N/RQ==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/bootstrap-3.3.7.js" integrity="sha512-iztkobsvnjKfAtTNdHkGVjAYTrrtlC7mGp/54c40wowO7LhURYl3gVzzcEqGl/qKXQltJ2HwMrdLcNUdo+N/RQ==" crossorigin="anonymous"></script>
|
||||||
<?php
|
<?php
|
||||||
|
@ -71,7 +71,7 @@ if ($MARKDOWN):
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-BMDTPcsLubRhuPDWSsWRfrgNcARqphGfrYU3sW7tNJDytuPqffzVzPA5U4UvIDrw80kCYKN0eyZ0YjnjZ8tERg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-DctI/LNueHnbinNWC5AhsfMgABi8pGW7SnF5Q0fg68Cv/rDznb/htcdsnlQzQOxRvSzVKNHW+OOkvOxgIY/qkg==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
|
@ -34,7 +34,7 @@ if ($ZEROBINCOMPATIBILITY):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/zlib-1.2.11.js" integrity="sha512-UOOlXbjGGS/ezf/cbE3Hc4L0ybB2NQBbk523tAT8m1TsnagkIgYUKuFfl+DL4wZbu7IopLvhI2kl+61+2oaaGA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/zlib-1.2.11.js" integrity="sha512-h8gJuMJ1L95FlbJwo5F8NkjEpK0Nv+9ASHShUrCBnMpIlciQ0d0qfkmAKYJ1jlwfqrbVYhqr8hpyIh5wClIP3w==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
|
||||||
<?php
|
<?php
|
||||||
if ($SYNTAXHIGHLIGHTING):
|
if ($SYNTAXHIGHLIGHTING):
|
||||||
|
@ -49,7 +49,7 @@ if ($MARKDOWN):
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-BMDTPcsLubRhuPDWSsWRfrgNcARqphGfrYU3sW7tNJDytuPqffzVzPA5U4UvIDrw80kCYKN0eyZ0YjnjZ8tERg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-DctI/LNueHnbinNWC5AhsfMgABi8pGW7SnF5Q0fg68Cv/rDznb/htcdsnlQzQOxRvSzVKNHW+OOkvOxgIY/qkg==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
Loading…
Reference in New Issue