Skip to content

Commit

Permalink
Version 3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Olivares committed Jun 14, 2018
1 parent ce17362 commit 5d9afda
Show file tree
Hide file tree
Showing 76 changed files with 49,599 additions and 12,905 deletions.
68 changes: 68 additions & 0 deletions assets/js/page_backups.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
jQuery( document ).ready( function ( $ ) {

$( '.backup-download-link' ).click( function () {
$( '#download-file-waiting' ).show();
$( '#download-file-generating' ).hide();
$( '#download-file-private-key' ).hide();
$( '#download-file-done' ).hide();

var link = this;
var eventsource = new EventSource( ajaxurl + '?action=download_file&destination=' + $( this ).data( 'destination' ) + '&jobid=' + $( this ).data( 'jobid' ) + '&file=' + $( this ).data( 'file' ) + '&local_file=' + $( this ).data( 'localFile' ) + '&_wpnonce=' + $( this ).data( 'nonce' ) );
eventsource.onmessage = function ( message ) {
var data = JSON.parse( message.data );
if ( data.state === 'downloading' ) {
$( '#download-file-waiting' ).hide();
$( '#download-file-generating' ).show();
$( '#download-file-private-key' ).hide();
$( '#download-file-done' ).hide();

// Progress bar
$( '#progresssteps' )
.css( {
width: data.download_percent + '%'
} )
.text( data.download_percent + '%' );

} else if ( data.state === 'need-private-key' ) {
$( '#download-file-waiting' ).hide();
$( '#download-file-generating' ).hide();
$( '#download-file-private-key' ).show();
$( '#download-file-done' ).hide();
$( '#download-file-private-key-input' ).focus();
if ( data.status === 'invalid' ) {
// Private key invalid
$( '#download-file-private-key-invalid' ).show();
} else {
$( '#download-file-private-key-invalid' ).hide();
}
} else if ( data.state === 'done' ) {
$( '#download-file-waiting' ).hide();
$( '#download-file-generating' ).hide();
$( '#download-file-private-key' ).hide();
$( '#download-file-done' ).show();
eventsource.close();
window.location.href = $( link ).data( 'url' );
setTimeout( function () {
tb_remove();
}, 3000 );
}
};

} );

$( '#download-file-private-key-button' ).click( function () {
data = {
action : 'send_private_key',
privatekey: $( '#download-file-private-key-input' ).val(),
};

$.post( ajaxurl, data, function ( response ) {
if ( response === 'ok' ) {
$( '#download-file-private-key-input' ).val( '' );
$( '#download-file-private-key-invalid' ).hide();
$( '#download-file-private-key' ).hide();
$( '#download-file-generating' ).show();
}
} );
} );
} );
1 change: 1 addition & 0 deletions assets/js/page_backups.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

227 changes: 175 additions & 52 deletions assets/js/page_settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
jQuery(document).ready(function ($) {
var anchor = $( 'input[name="anchor"]' );
jQuery( document ).ready( function ( $ ) {
var anchor = $( 'input[name="anchor"]' );
var tab_wrapper_a = $( '.nav-tab-wrapper>a' );
var actual_anchor = window.location.hash;

if ( actual_anchor !== '' ) {
actual_anchor = '#' + actual_anchor.replace( '#', '' );
}
Expand All @@ -10,63 +11,185 @@ jQuery(document).ready(function ($) {
anchor.val( actual_anchor );
}

$( '.table' ).addClass( 'ui-tabs-hide' );
$( anchor.val() ).removeClass( 'ui-tabs-hide' );
$( '.table' ).addClass( 'ui-tabs-hide' );
$( anchor.val() ).removeClass( 'ui-tabs-hide' );

if ( anchor.val() == '#backwpup-tab-information' ) {
$('#submit').hide();
$('#default_settings').hide();
if ( anchor.val() === '#backwpup-tab-information' ) {
$( '#submit' ).hide();
$( '#default_settings' ).hide();
}

tab_wrapper_a.removeClass( 'nav-tab-active' );
tab_wrapper_a.each( function () {
if ( $(this).attr( 'href' ) == anchor.val() ) {
$(this).addClass( 'nav-tab-active' );
}
});
if ( $( this ).attr( 'href' ) === anchor.val() ) {
$( this ).addClass( 'nav-tab-active' );
}
} );

tab_wrapper_a.on( 'click', function () {
var clickedid = $(this).attr('href');
tab_wrapper_a.removeClass('nav-tab-active');
$(this).addClass('nav-tab-active');
$('.table').addClass('ui-tabs-hide');
$(clickedid).removeClass('ui-tabs-hide');
$('#message').hide();
anchor.val(clickedid);
if ( clickedid == '#backwpup-tab-information' ) {
$('#submit').hide();
$('#default_settings').hide();
var clickedid = $( this ).attr( 'href' );
tab_wrapper_a.removeClass( 'nav-tab-active' );
$( this ).addClass( 'nav-tab-active' );
$( '.table' ).addClass( 'ui-tabs-hide' );
$( clickedid ).removeClass( 'ui-tabs-hide' );
$( '#message' ).hide();
anchor.val( clickedid );
if ( clickedid === '#backwpup-tab-information' ) {
$( '#submit' ).hide();
$( '#default_settings' ).hide();
} else {
$('#submit').show();
$('#default_settings').show();
$( '#submit' ).show();
$( '#default_settings' ).show();
}
window.location.hash = clickedid;
window.scrollTo(0, 0);
window.location.hash = clickedid;
window.scrollTo( 0, 0 );
return false;
});

$('#authentication_method').change( function () {
var auth_method = $( '#authentication_method' ).val();
if ( '' === auth_method ) {
$('.authentication_basic').hide();
$('.authentication_query_arg').hide();
$('.authentication_user').hide();
} else if ( 'basic' == auth_method ) {
$('.authentication_basic').show();
$('.authentication_query_arg').hide();
$('.authentication_user').hide();
} else if ( 'query_arg' == auth_method ) {
$('.authentication_basic').hide();
$('.authentication_query_arg').show();
$('.authentication_user').hide();
} else if ( 'user' == auth_method ) {
$('.authentication_basic').hide();
$('.authentication_query_arg').hide();
$('.authentication_user').show();
}
});

setTimeout(function() {
window.scrollTo(0, 0);
}, 1);
});
} );

$( '#authentication_method' ).change( function () {
var auth_method = $( '#authentication_method' ).val();
if ( '' === auth_method ) {
$( '.authentication_basic' ).hide();
$( '.authentication_query_arg' ).hide();
$( '.authentication_user' ).hide();
} else if ( 'basic' === auth_method ) {
$( '.authentication_basic' ).show();
$( '.authentication_query_arg' ).hide();
$( '.authentication_user' ).hide();
} else if ( 'query_arg' === auth_method ) {
$( '.authentication_basic' ).hide();
$( '.authentication_query_arg' ).show();
$( '.authentication_user' ).hide();
} else if ( 'user' === auth_method ) {
$( '.authentication_basic' ).hide();
$( '.authentication_query_arg' ).hide();
$( '.authentication_user' ).show();
}
} );

if ( $( '#encryption-symmetric' ).is( ':checked' ) ) {
$( '#encryption-key-row' ).show();
$( '#public-key-row' ).hide();
} else if ( $( '#encryption-asymmetric' ).is( ':checked' ) ) {
$( '#encryption-key-row' ).hide();
$( '#public-key-row' ).show();
}

$( 'input:radio[name="encryption"]' ).change( function () {
if ( $( this ).val() === "symmetric" ) {
$( '#encryption-key-row' ).show();
$( '#public-key-row' ).hide();
} else if ( $( this ).val() === "asymmetric" ) {
$( '#encryption-key-row' ).hide();
$( '#public-key-row' ).show();
}
} );

$( '#generate-key-button' ).click( function ( e ) {
e.preventDefault();
e.stopPropagation();

// Only run if key is not already set
if ( $( '#encryptionkey' ).val() !== '' ) {
return;
}

$( '#generate-key-button' ).attr( 'disabled', 'disabled' );

var data = {
action : 'generate_key',
_ajax_nonce: $( '#backwpupajaxnonce' ).val(),
};

$.post( ajaxurl, data, function ( response ) {
$( '#encryptionkey' ).val( response );
$( '#encryptionkey' ).focus();
$( '#key-generation' ).hide();
} );
} );

$( '#validate-key-button' ).click( function ( e ) {
if ( $( '#publickey' ).val() === '' ) {
e.preventDefault();
alert( backwpup_vars.no_public_key );
$( '#publickey' ).focus();
return false;
}

// Put focus on private key field after a time, to give time for opening dialog.
setTimeout( function () {
$( '#privatekey' ).focus();
}, 100 );

} );

$( '#do-validate' ).click( function () {
if ( $( '#privatekey' ).val() === '' ) {
alert( backwpup_vars.no_private_key );
$( '#privatekey' ).focus();
return false;
}

var data = {
action : 'validate_key',
publickey : $( '#publickey' ).val(),
privatekey : $( '#privatekey' ).val(),
_ajax_nonce: $( '#backwpupajaxnonce' ).val(),
};

$.post( ajaxurl, data, function ( response ) {
if ( response === 'valid' ) {
alert( backwpup_vars.public_key_valid );
tb_remove();
$( '#publickey' ).focus();
} else {
alert( backwpup_vars.public_key_invalid );
}
$( '#privatekey' ).val( '' );
} )
.fail( function ( xhr, status, error ) {
alert( error );
} );
} );

$( '#generate-key-pair-button' ).click( function () {
$( '#key-pair-generating-progress' ).show();
$( '#key-pair-generating-done' ).hide();

var data = {
action : 'generate_key_pair',
_ajax_nonce: $( '#backwpupajaxnonce' ).val()
};

$.post( ajaxurl, data, function ( response ) {
$( '#generated-public-key' ).val( response.public_key );
$( '#generated-public-key-link' ).attr( 'href', 'data:text/plain;base64,' + btoa( response.public_key ) );
$( '#generated-private-key' ).val( response.private_key );
$( '#generated-private-key-link' ).attr( 'href', 'data:text/plain;base64,' + btoa( response.private_key ) );
$( '#key-pair-generating-progress' ).hide();
$( '#key-pair-generating-done' ).show();
$( '#generated-public-key' ).focus();
} );

} );

var private_key_downloaded = false;
$( '#generated-private-key-link' ).click( function () {
private_key_downloaded = true;
} );

$( '#use-key-pair-button' ).click( function () {
if ( private_key_downloaded === false ) {
alert( backwpup_vars.must_download_private_key );
return false;
}
$( '#publickey' ).val( $( '#generated-public-key' ).val() );
tb_remove();
$( '#publickey' ).focus();
} );

setTimeout( function () {
window.scrollTo( 0, 0 );
}, 1 );

} );
2 changes: 1 addition & 1 deletion assets/js/page_settings.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions assets/sass/pro.scss

This file was deleted.

11 changes: 0 additions & 11 deletions assets/sass/restore/_commons.scss

This file was deleted.

32 changes: 0 additions & 32 deletions assets/sass/restore/_drag-drop-area.scss

This file was deleted.

Loading

0 comments on commit 5d9afda

Please sign in to comment.