fixing server interaction in JS, simple pastes now work
This commit is contained in:
parent
5b3286df4d
commit
788ea67b49
@ -3710,11 +3710,10 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
*/
|
*/
|
||||||
me.run = function()
|
me.run = function()
|
||||||
{
|
{
|
||||||
$.ajax({
|
let isPost = Object.keys(data).length > 0,
|
||||||
type: data ? 'POST' : 'GET',
|
ajaxParams = {
|
||||||
|
type: isPost ? 'POST' : 'GET',
|
||||||
url: url,
|
url: url,
|
||||||
data: data,
|
|
||||||
dataType: 'json',
|
|
||||||
headers: ajaxHeaders,
|
headers: ajaxHeaders,
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.status === 0) {
|
if (result.status === 0) {
|
||||||
@ -3725,8 +3724,17 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
fail(2, result);
|
fail(2, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
.fail(function(jqXHR, textStatus, errorThrown) {
|
if (isPost) {
|
||||||
|
ajaxParams.data = data;
|
||||||
|
['adata', 'meta'].map(function (key) {
|
||||||
|
if (data.hasOwnProperty(key)) {
|
||||||
|
ajaxParams.data[key] = JSON.stringify(data[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ajaxParams.dataType = 'json';
|
||||||
|
}
|
||||||
|
$.ajax(ajaxParams).fail(function(jqXHR, textStatus, errorThrown) {
|
||||||
console.error(textStatus, errorThrown);
|
console.error(textStatus, errorThrown);
|
||||||
fail(3, jqXHR);
|
fail(3, jqXHR);
|
||||||
});
|
});
|
||||||
@ -4186,7 +4194,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
{
|
{
|
||||||
const pastePlain = await decryptOrPromptPassword(
|
const pastePlain = await decryptOrPromptPassword(
|
||||||
key, password,
|
key, password,
|
||||||
paste.hasOwnProperty('ct') ? paste.ct : paste.data
|
paste.hasOwnProperty('ct') ? [paste.ct, paste.adata] : paste.data
|
||||||
);
|
);
|
||||||
if (pastePlain === false) {
|
if (pastePlain === false) {
|
||||||
if (password.length === 0) {
|
if (password.length === 0) {
|
||||||
@ -4347,6 +4355,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
// wait for the user to type in the password,
|
// wait for the user to type in the password,
|
||||||
// then PasteDecrypter.run will be called again
|
// then PasteDecrypter.run will be called again
|
||||||
|
console.log(decryptionPromises);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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-h8gJuMJ1L95FlbJwo5F8NkjEpK0Nv+9ASHShUrCBnMpIlciQ0d0qfkmAKYJ1jlwfqrbVYhqr8hpyIh5wClIP3w==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/zlib-1.2.11.js" integrity="sha512-Yey/0yoaVmSbqMEyyff3DIu8kCPwpHvHf7tY1AuZ1lrX9NPCMg87PwzngMi+VNbe4ilCApmePeuKT869RTcyCQ==" 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-nqFl6ezAinqULcBBqWHuJ03J3SQZ0zFhHAgDX/7Vr0x9eNWdkqNvoArOrdvi5yZm45TyG+vuQNkLCHh+qhcOXw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-AakQFf2/uSst5PDZhgmWj0qEBmhVz32MXLeWygymJ/Mhi4g+Zk/jrY4aDahVSi6BCqGZqswXOhnbikofr+leOQ==" 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-h8gJuMJ1L95FlbJwo5F8NkjEpK0Nv+9ASHShUrCBnMpIlciQ0d0qfkmAKYJ1jlwfqrbVYhqr8hpyIh5wClIP3w==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/zlib-1.2.11.js" integrity="sha512-Yey/0yoaVmSbqMEyyff3DIu8kCPwpHvHf7tY1AuZ1lrX9NPCMg87PwzngMi+VNbe4ilCApmePeuKT869RTcyCQ==" 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-nqFl6ezAinqULcBBqWHuJ03J3SQZ0zFhHAgDX/7Vr0x9eNWdkqNvoArOrdvi5yZm45TyG+vuQNkLCHh+qhcOXw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-AakQFf2/uSst5PDZhgmWj0qEBmhVz32MXLeWygymJ/Mhi4g+Zk/jrY4aDahVSi6BCqGZqswXOhnbikofr+leOQ==" 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