Adds a new 'S3-Compatible Storage' provider that works with any
S3-API-compatible object storage service, including MinIO, Ceph,
Cloudflare R2, Backblaze B2, and others.
Changes:
- New provider class: classes/providers/storage/s3-compatible-provider.php
- Provider key: s3compatible
- Reads user-configured endpoint URL from settings
- Uses path-style URL access (required by most S3-compatible services)
- Supports credentials via AS3CF_S3COMPAT_ACCESS_KEY_ID /
AS3CF_S3COMPAT_SECRET_ACCESS_KEY wp-config.php constants
- Disables AWS-specific features (Block Public Access, Object Ownership)
- New provider SVG icons (s3compatible.svg, -link.svg, -round.svg)
- Registered provider in main plugin class with endpoint setting support
- Updated StorageProviderSubPage to show endpoint URL input for S3-compatible
- Built pro settings bundle with rollup (Svelte 4.2.19)
- Added package.json and updated rollup.config.mjs for pro-only builds
92 lines
2.4 KiB
JavaScript
92 lines
2.4 KiB
JavaScript
(function( $, wp, _ ) {
|
|
|
|
/**
|
|
* Create and display a spinner next to an element
|
|
*
|
|
* @param element
|
|
*/
|
|
function createSpinner( element ) {
|
|
var $spinner = $( '<span />', { class: 'spinner' } );
|
|
$spinner.css( { 'display': 'inline-block', 'float': 'none', 'visibility': 'visible' } );
|
|
$spinner.insertAfter( element );
|
|
|
|
return $spinner;
|
|
}
|
|
|
|
$( document ).ready( function() {
|
|
|
|
// Move the filesystem credential form below the last error notice
|
|
var $lastNotice = $( '.as3cf-pro-installer-notice' ).last();
|
|
$( '.as3cfpro-installer-filesystem-creds' ).insertAfter( $lastNotice );
|
|
|
|
$( '.as3cfpro-installer-filesystem-creds form' ).on( 'submit', function( e ) {
|
|
var $submitBtn = $( '#upgrade' );
|
|
if ( $submitBtn.hasClass( 'button-disabled' ) ) {
|
|
return;
|
|
}
|
|
|
|
$submitBtn.addClass( 'button-disabled' );
|
|
$submitBtn.val( as3cfpro_installer.strings.installing + '...' );
|
|
|
|
createSpinner( $submitBtn );
|
|
} );
|
|
|
|
$( 'body' ).on( 'click', '.as3cf-pro-installer .install-plugins', function( e ) {
|
|
e.preventDefault();
|
|
if ( $( this ).hasClass( 'button-disabled' ) ) {
|
|
return;
|
|
}
|
|
|
|
$( this ).addClass( 'button-disabled' );
|
|
$( this ).text( as3cfpro_installer.strings.installing + '...' );
|
|
|
|
var $spinner = createSpinner( this );
|
|
|
|
/**
|
|
* Render an error notice and remove the installer notice
|
|
*
|
|
* @param string errorMessage
|
|
*/
|
|
function installerError( errorMessage ) {
|
|
var noticeText = as3cfpro_installer.strings.error_installing + ': ' + errorMessage;
|
|
var noticeHtml = '<div class="error"><p>' + noticeText + '</p></div>';
|
|
|
|
$( '.as3cf-pro-installer' ).after( noticeHtml );
|
|
$( '.as3cf-pro-installer' ).remove();
|
|
|
|
$spinner.hide();
|
|
}
|
|
|
|
var process = $( this ).data( 'process' );
|
|
|
|
$.ajax( {
|
|
url: ajaxurl,
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
cache: false,
|
|
data: {
|
|
action: 'as3cfpro_install_plugins_' + process,
|
|
nonce: as3cfpro_installer.nonces.install_plugins
|
|
},
|
|
error: function( jqXHR, textStatus, errorThrown ) {
|
|
installerError( errorThrown + ' - ' + textStatus );
|
|
},
|
|
success: function( response ) {
|
|
if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) {
|
|
|
|
if ( response.success ) {
|
|
window.location.href = response.data.redirect;
|
|
}
|
|
|
|
if ( ! _.isUndefined( response.data.error ) ) {
|
|
installerError( response.data.error );
|
|
}
|
|
}
|
|
}
|
|
} );
|
|
} );
|
|
|
|
} );
|
|
|
|
})( jQuery, wp, _ );
|