|
@@ -228,7 +228,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|
|
'<': '<',
|
|
'<': '<',
|
|
|
'>': '>',
|
|
'>': '>',
|
|
|
'"': '"',
|
|
'"': '"',
|
|
|
- "'": ''',
|
|
|
|
|
|
|
+ '\'': ''',
|
|
|
'/': '/',
|
|
'/': '/',
|
|
|
'`': '`',
|
|
'`': '`',
|
|
|
'=': '='
|
|
'=': '='
|
|
@@ -2197,7 +2197,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|
|
* @function
|
|
* @function
|
|
|
* @param {Event} event
|
|
* @param {Event} event
|
|
|
*/
|
|
*/
|
|
|
- function submitPasswordModal(event)
|
|
|
|
|
|
|
+ async function submitPasswordModal(event)
|
|
|
{
|
|
{
|
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
|
|
|
|
|
@@ -2207,6 +2207,19 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|
|
// hide modal
|
|
// hide modal
|
|
|
$passwordModal.modal('hide');
|
|
$passwordModal.modal('hide');
|
|
|
|
|
|
|
|
|
|
+ // check if protected pathname
|
|
|
|
|
+ const url = new URL(window.location);
|
|
|
|
|
+
|
|
|
|
|
+ // if protected request password
|
|
|
|
|
+ if(url.pathname === '/protected') {
|
|
|
|
|
+ const enc = CryptTool.base58decode(newKey).padStart(32, '\u0000');
|
|
|
|
|
+ const cipherdata = [enc.ct, enc.adata];
|
|
|
|
|
+
|
|
|
|
|
+ const plaindata = await CryptTool.decipher(enc.k, password, cipherdata);
|
|
|
|
|
+ window.location.replace(Helper.baseUri() + plaindata);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
PasteDecrypter.run();
|
|
PasteDecrypter.run();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4778,16 +4791,32 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|
|
* @param {int} status
|
|
* @param {int} status
|
|
|
* @param {object} data
|
|
* @param {object} data
|
|
|
*/
|
|
*/
|
|
|
- function showCreatedPaste(status, data) {
|
|
|
|
|
|
|
+ async function showCreatedPaste(status, data) {
|
|
|
Alert.hideLoading();
|
|
Alert.hideLoading();
|
|
|
Alert.hideMessages();
|
|
Alert.hideMessages();
|
|
|
|
|
|
|
|
// show notification
|
|
// show notification
|
|
|
const baseUri = Helper.baseUri() + '?',
|
|
const baseUri = Helper.baseUri() + '?',
|
|
|
- url = baseUri + data.id + '#' + CryptTool.base58encode(data.encryptionKey),
|
|
|
|
|
- deleteUrl = baseUri + 'pasteid=' + data.id + '&deletetoken=' + data.deletetoken;
|
|
|
|
|
|
|
+ deleteUrl = baseUri + 'pasteid=' + data.id + '&deletetoken=' + data.deletetoken;
|
|
|
PasteStatus.createPasteNotification(url, deleteUrl);
|
|
PasteStatus.createPasteNotification(url, deleteUrl);
|
|
|
|
|
|
|
|
|
|
+ const pw = TopNav.getPassword()
|
|
|
|
|
+ const sm = CryptTool.getSymmetricKey();
|
|
|
|
|
+
|
|
|
|
|
+ let openUri = + '?' + data.id + '#' + CryptTool.base58encode(data.encryptionKey);
|
|
|
|
|
+ let cipherResult = await CryptTool.cipher(sm, pw, openUri, []);
|
|
|
|
|
+
|
|
|
|
|
+ let dt = {}
|
|
|
|
|
+ dt['v'] = 2;
|
|
|
|
|
+ dt['ct'] = cipherResult[0];
|
|
|
|
|
+ dt['adata'] = cipherResult[1];
|
|
|
|
|
+ dt['k'] = sm;
|
|
|
|
|
+
|
|
|
|
|
+ const encUrl = CryptTool.base58encode(JSON.stringify(dt))
|
|
|
|
|
+
|
|
|
|
|
+ const url = baseUri + 'protected/#' + encUrl;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// show new URL in browser bar
|
|
// show new URL in browser bar
|
|
|
history.pushState({type: 'newpaste'}, document.title, url);
|
|
history.pushState({type: 'newpaste'}, document.title, url);
|
|
|
|
|
|
|
@@ -5518,6 +5547,17 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|
|
try {
|
|
try {
|
|
|
Model.getPasteId();
|
|
Model.getPasteId();
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
|
|
+
|
|
|
|
|
+ // check if protected pathname
|
|
|
|
|
+ const url = new URL(window.location);
|
|
|
|
|
+
|
|
|
|
|
+ // if protected request password
|
|
|
|
|
+ if(url.pathname === '/protected') {
|
|
|
|
|
+ const enc = CryptTool.base58decode(newKey).padStart(32, '\u0000');
|
|
|
|
|
+ return Prompt.requestPassword();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// otherwise create a new paste
|
|
// otherwise create a new paste
|
|
|
return me.newPaste();
|
|
return me.newPaste();
|
|
|
}
|
|
}
|