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
77 lines
1.9 KiB
Svelte
77 lines
1.9 KiB
Svelte
<script>
|
|
import {createEventDispatcher} from "svelte";
|
|
|
|
import {urls} from "../js/stores";
|
|
|
|
const classes = $$props.class ? $$props.class : "";
|
|
const dispatch = createEventDispatcher();
|
|
|
|
export let ref = {};
|
|
|
|
// Button sizes, medium is the default.
|
|
export let extraSmall = false;
|
|
export let small = false;
|
|
export let large = false;
|
|
export let medium = !extraSmall && !small && !large;
|
|
|
|
// Button styles, outline is the default.
|
|
export let primary = false;
|
|
export let expandable = false;
|
|
export let refresh = false;
|
|
export let outline = !primary && !expandable && !refresh;
|
|
|
|
// Is the button disabled? Defaults to false.
|
|
export let disabled = false;
|
|
|
|
// Is the button in an expanded state? Defaults to false.
|
|
export let expanded = false;
|
|
|
|
// Is the button in a refreshing state? Defaults to false.
|
|
export let refreshing = false;
|
|
|
|
// A button can have a title, most useful to give a reason when disabled.
|
|
export let title = "";
|
|
|
|
/**
|
|
* Catch escape key and emit a custom cancel event.
|
|
*
|
|
* @param {KeyboardEvent} event
|
|
*/
|
|
function handleKeyup( event ) {
|
|
if ( event.key === "Escape" ) {
|
|
event.preventDefault();
|
|
dispatch( "cancel" );
|
|
}
|
|
}
|
|
|
|
function refreshIcon( refreshing ) {
|
|
return $urls.assets + 'img/icon/' + (refreshing ? 'refresh-disabled.svg' : 'refresh.svg');
|
|
}
|
|
</script>
|
|
|
|
<button
|
|
on:click|preventDefault
|
|
class:btn-xs={extraSmall}
|
|
class:btn-sm={small}
|
|
class:btn-md={medium}
|
|
class:btn-lg={large}
|
|
class:btn-primary={primary}
|
|
class:btn-outline={outline}
|
|
class:btn-expandable={expandable}
|
|
class:btn-disabled={disabled}
|
|
class:btn-expanded={expanded}
|
|
class:btn-refresh={refresh}
|
|
class:btn-refreshing={refreshing}
|
|
class={classes}
|
|
{title}
|
|
disabled={disabled || refreshing}
|
|
bind:this={ref}
|
|
on:focusout
|
|
on:keyup={handleKeyup}
|
|
>
|
|
{#if refresh}
|
|
<img class="icon refresh" class:refreshing src="{refreshIcon(refreshing)}" alt={title}/>
|
|
{/if}
|
|
<slot/>
|
|
</button>
|