Преглед изворни кода

support older browsers correctly and ensure the paranoia setting for the sjcl.random.isReady call matches paranoia level 10 instead of the default 6

El RIDO пре 8 година
родитељ
комит
0319a16b15
3 измењених фајлова са 6 додато и 3 уклоњено
  1. 4 1
      js/privatebin.js
  2. 1 1
      tpl/bootstrap.php
  3. 1 1
      tpl/page.php

+ 4 - 1
js/privatebin.js

@@ -25,6 +25,8 @@
 
 // Immediately start random number generator collector.
 sjcl.random.startCollectors();
+// Setting this to 10 ensures 1024 bits of entropy get collected before generating the paste key
+sjcl.random.setDefaultParanoia(10);
 
 // main application start, called when DOM is fully loaded
 jQuery(document).ready(function() {
@@ -229,7 +231,8 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
                 return baseUri;
             }
 
-            baseUri = window.location.origin + window.location.pathname;
+            // window.location.origin is a newer alternative, but requires FF 21 / Chrome 31 / Safari 7 / IE 11
+            baseUri = window.location.protocol + '//' + window.location.host + window.location.pathname;
             return baseUri;
         };
 

+ 1 - 1
tpl/bootstrap.php

@@ -75,7 +75,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-PEu5amE2sP02bgpzUExfuqPJEXUml1DiVlulUAH1SH4pBx4AQoWFNTwmsG08hhE0QDlZt+mkDDhgrJ6rVRunmQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-WuHI3X0a0KlPfvMhPHvzM/6ptMbnkRPHh1UpWjxZMjNiqQmbcfQkvLceyjCzzmKkedGHxe1FLYSi5WqkNFtx+g==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->

+ 1 - 1
tpl/page.php

@@ -53,7 +53,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-PEu5amE2sP02bgpzUExfuqPJEXUml1DiVlulUAH1SH4pBx4AQoWFNTwmsG08hhE0QDlZt+mkDDhgrJ6rVRunmQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-WuHI3X0a0KlPfvMhPHvzM/6ptMbnkRPHh1UpWjxZMjNiqQmbcfQkvLceyjCzzmKkedGHxe1FLYSi5WqkNFtx+g==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->