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
1 line
4.4 KiB
JavaScript
1 line
4.4 KiB
JavaScript
(function($){const $listTable=$("#update-plugins-table,.wp-list-table.plugins");const Plugin=function(data,parent){this.data=data;this.parent=parent;this.$check=$listTable.find('.check-column [value="'+data.basename+'"]');this.$row=this.$check.closest("tr");this.$noticeContainer=null};Plugin.prototype.checkAgainLink=function(){return' <span class="as3cf-dbrains-check-my-licence-again"><a href="#">'+as3cf_dbrains.strings.check_licence_again+"</a></span>"};Plugin.prototype.hasLicenseErrors=function(){const license=this.isAddon()?this.parent.data.license:this.data.license;return!_.isEmpty(license.errors)};Plugin.prototype.disableUpdateCheckbox=function(){if($listTable.is("#update-plugins-table")){this.$check.prop({disabled:true,checked:false})}};Plugin.prototype.enableUpdateCheckbox=function(){if($listTable.is("#update-plugins-table")){this.$check.prop({disabled:false})}};Plugin.prototype.setNotice=function(html){this.$noticeContainer.find(".as3cf-licence-notice").remove();this.$noticeContainer.append('<div class="as3cf-licence-notice update-message notice inline notice-warning notice-alt">'+'<p class="as3cf-before">'+html+this.checkAgainLink()+"</p>"+"</div>")};Plugin.prototype.clearNotice=function(){const plugin=this;const $notice=this.$noticeContainer.find(".as3cf-licence-notice");$.when($notice.fadeOut()).done((function(){$notice.remove();plugin.$row.children().css("box-shadow","");plugin.$noticeContainer.find(".update-message").show()}))};Plugin.prototype.render=function(){if(this.hasLicenseErrors()){this.initNoticeContainer();this.disableUpdateCheckbox();this.$noticeContainer.find('.update-message:not(".as3cf-licence-notice")').hide();this.setNotice(this.getLicenseNotice())}else if(this.$noticeContainer){this.enableUpdateCheckbox();this.clearNotice()}if(!this.isAddon()){_.invoke(this.addons,"render")}};Plugin.prototype.initNoticeContainer=function(){if(this.$noticeContainer){return}if(!$listTable.is("#update-plugins-table")){const $noticeRow=$listTable.find('.plugin-update-tr[data-plugin="'+this.data.basename+'"]');if($noticeRow.length){this.$noticeContainer=$noticeRow.find(".plugin-update")}else{const colspan=this.$row.children().length;this.$row.after('<tr class="plugin-update-tr '+this.$row.attr("class")+'" '+'id="'+this.data.slug+'-update" '+'data-slug="'+this.data.slug+'" '+'data-plugin="'+this.data.basename+'" '+">"+'<td colspan="'+colspan+'" class="plugin-update colspanchange"></td>'+"</tr>");this.$row.children().css("box-shadow","none");this.$noticeContainer=$listTable.find('.plugin-update-tr[data-plugin="'+this.data.basename+'"] .plugin-update')}}else{this.$noticeContainer=this.$row.find(".plugin-title")}this.$noticeContainer.on("click",".as3cf-dbrains-check-my-licence-again a",_.bind(this.checkLicenseAgain,this))};Plugin.prototype.getLicenseNotice=function(){let message="";if(this.data.update_available){message=as3cf_dbrains.strings.update_available+" "}if(this.isAddon()){return message+as3cf_dbrains.strings.requires_parent_licence.replace("%s",this.parent.data.name)}return message+_.values(this.data.license.errors).join("")};Plugin.prototype.checkLicenseAgain=function(event){const plugin=this;const $link=$(event.target);const $spinner=$('<span class="spinner is-active as3cf-dbrains-licence-check-spinner" style="float:none; margin-top: -3px;"></span>');event.preventDefault();$link.hide().after($spinner);this.ajaxCheckLicense().done((function(data){if(plugin.isAddon()){plugin.parent.data.license.errors=data.errors;plugin.parent.render()}else{plugin.data.license.errors=data.errors;plugin.render()}})).fail((function(){plugin.setNotice(as3cf_dbrains.strings.licence_check_problem)})).always((function(){$spinner.remove()}))};Plugin.prototype.ajaxCheckLicense=function(){const prefix=this.isAddon()?this.parent.data.prefix:this.data.prefix;return $.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:false,data:{action:prefix+"_check_licence",nonce:as3cf_dbrains.nonces.check_licence}})};Plugin.prototype.init=function(){this.render();if(!this.isAddon()){this.initAddons()}};Plugin.prototype.isAddon=function(){return!!this.parent};Plugin.prototype.initAddons=function(){const parent=this;this.addons=_.map(this.data.addons,(function(addonData){return new Plugin(addonData,parent)}));_.invoke(this.addons,"init")};function initialize(){_.chain(as3cf_dbrains.plugins).map((function(pluginData){return new Plugin(pluginData)})).invoke("init")}if($listTable.length){$(initialize)}})(jQuery); |