mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
fixing urlshortening regression caused by CSP introduction, resolves #10
This commit is contained in:
parent
cd02c6e916
commit
47646e056b
|
@ -536,6 +536,16 @@ $(function() {
|
||||||
*/
|
*/
|
||||||
headers: {'X-Requested-With': 'JSONHttpRequest'},
|
headers: {'X-Requested-With': 'JSONHttpRequest'},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL shortners create address
|
||||||
|
*/
|
||||||
|
shortenerUrl: '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL of newly created paste
|
||||||
|
*/
|
||||||
|
createdPasteUrl: '',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current script location (without search or hash part of the URL).
|
* Get the current script location (without search or hash part of the URL).
|
||||||
* eg. http://server.com/zero/?aaaa#bbbb --> http://server.com/zero/
|
* eg. http://server.com/zero/?aaaa#bbbb --> http://server.com/zero/
|
||||||
|
@ -1077,6 +1087,10 @@ $(function() {
|
||||||
url, url
|
url, url
|
||||||
) + privatebin.shortenUrl(url)
|
) + privatebin.shortenUrl(url)
|
||||||
);
|
);
|
||||||
|
var shortenButton = $('#shortenbutton');
|
||||||
|
if (shortenButton) {
|
||||||
|
shortenButton.click($.proxy(privatebin.sendToShortener, privatebin));
|
||||||
|
}
|
||||||
$('#deletelink').html('<a href="' + deleteUrl + '">' + i18n._('Delete data') + '</a>');
|
$('#deletelink').html('<a href="' + deleteUrl + '">' + i18n._('Delete data') + '</a>');
|
||||||
privatebin.pasteResult.removeClass('hidden');
|
privatebin.pasteResult.removeClass('hidden');
|
||||||
// We pre-select the link so that the user only has to [Ctrl]+[c] the link.
|
// We pre-select the link so that the user only has to [Ctrl]+[c] the link.
|
||||||
|
@ -1110,11 +1124,8 @@ $(function() {
|
||||||
{
|
{
|
||||||
var shortenerHtml = $('#shortenbutton');
|
var shortenerHtml = $('#shortenbutton');
|
||||||
if (shortenerHtml) {
|
if (shortenerHtml) {
|
||||||
var shortener = shortenerHtml.data('shortener');
|
this.shortenerUrl = shortenerHtml.data('shortener');
|
||||||
shortenerHtml.attr(
|
this.createdPasteUrl = url;
|
||||||
'onclick',
|
|
||||||
"window.location.href = '" + shortener + encodeURIComponent(url) + "';"
|
|
||||||
);
|
|
||||||
return ' ' + $('<div />').append(shortenerHtml.clone()).html();
|
return ' ' + $('<div />').append(shortenerHtml.clone()).html();
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
@ -1219,6 +1230,17 @@ $(function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forward to URL shortener.
|
||||||
|
*
|
||||||
|
* @param Event event
|
||||||
|
*/
|
||||||
|
sendToShortener: function(event)
|
||||||
|
{
|
||||||
|
event.preventDefault();
|
||||||
|
window.location.href = this.shortenerUrl + encodeURIComponent(this.createdPasteUrl);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload the page.
|
* Reload the page.
|
||||||
*
|
*
|
||||||
|
|
|
@ -51,7 +51,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-E9z1cIXJHhc940FLA4o//dRxoy5HwSeRZVgLClmREWl+o576zz3gOkMwxrUFVXKUMa2l2qc6huNwMpw+RGmk2Q==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ogLT+1peHLQkW145PU7Ko0OOSphQo7ZUAGesPH8KHI37tKRMXgTOmYyFYhyWozeufTZuadqtuJz7eOSoPDqveg==" 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]-->
|
||||||
|
|
|
@ -51,7 +51,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-E9z1cIXJHhc940FLA4o//dRxoy5HwSeRZVgLClmREWl+o576zz3gOkMwxrUFVXKUMa2l2qc6huNwMpw+RGmk2Q==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ogLT+1peHLQkW145PU7Ko0OOSphQo7ZUAGesPH8KHI37tKRMXgTOmYyFYhyWozeufTZuadqtuJz7eOSoPDqveg==" 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]-->
|
||||||
|
|
|
@ -51,7 +51,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-E9z1cIXJHhc940FLA4o//dRxoy5HwSeRZVgLClmREWl+o576zz3gOkMwxrUFVXKUMa2l2qc6huNwMpw+RGmk2Q==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ogLT+1peHLQkW145PU7Ko0OOSphQo7ZUAGesPH8KHI37tKRMXgTOmYyFYhyWozeufTZuadqtuJz7eOSoPDqveg==" 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]-->
|
||||||
|
|
|
@ -51,7 +51,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-E9z1cIXJHhc940FLA4o//dRxoy5HwSeRZVgLClmREWl+o576zz3gOkMwxrUFVXKUMa2l2qc6huNwMpw+RGmk2Q==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ogLT+1peHLQkW145PU7Ko0OOSphQo7ZUAGesPH8KHI37tKRMXgTOmYyFYhyWozeufTZuadqtuJz7eOSoPDqveg==" 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]-->
|
||||||
|
|
|
@ -51,7 +51,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-E9z1cIXJHhc940FLA4o//dRxoy5HwSeRZVgLClmREWl+o576zz3gOkMwxrUFVXKUMa2l2qc6huNwMpw+RGmk2Q==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ogLT+1peHLQkW145PU7Ko0OOSphQo7ZUAGesPH8KHI37tKRMXgTOmYyFYhyWozeufTZuadqtuJz7eOSoPDqveg==" 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]-->
|
||||||
|
|
|
@ -46,7 +46,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-E9z1cIXJHhc940FLA4o//dRxoy5HwSeRZVgLClmREWl+o576zz3gOkMwxrUFVXKUMa2l2qc6huNwMpw+RGmk2Q==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ogLT+1peHLQkW145PU7Ko0OOSphQo7ZUAGesPH8KHI37tKRMXgTOmYyFYhyWozeufTZuadqtuJz7eOSoPDqveg==" 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
Block a user