feat: add S3-compatible storage provider (MinIO, Ceph, R2, etc.)
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
This commit is contained in:
120
ui/components/OffloadStatus.svelte
Normal file
120
ui/components/OffloadStatus.svelte
Normal file
@@ -0,0 +1,120 @@
|
||||
<script>
|
||||
import {counts, strings, urls} from "../js/stores";
|
||||
import {numToString} from "../js/numToString";
|
||||
import ProgressBar from "../components/ProgressBar.svelte";
|
||||
import OffloadStatusFlyout from "./OffloadStatusFlyout.svelte";
|
||||
|
||||
// Controls whether flyout is visible or not.
|
||||
export let expanded = false;
|
||||
export let flyoutButton = {};
|
||||
export let hasFocus = false;
|
||||
|
||||
/**
|
||||
* Returns the numeric percentage progress for total offloaded media.
|
||||
*
|
||||
* @param {number} total
|
||||
* @param {number} offloaded
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
function getPercentComplete( total, offloaded ) {
|
||||
if ( total < 1 || offloaded < 1 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const percent = Math.floor( Math.abs( offloaded / total * 100 ) );
|
||||
|
||||
if ( percent > 100 ) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
return percent;
|
||||
}
|
||||
|
||||
$: percentComplete = getPercentComplete( $counts.total, $counts.offloaded );
|
||||
$: complete = percentComplete >= 100;
|
||||
|
||||
/**
|
||||
* Returns a formatted title string reflecting the current status.
|
||||
*
|
||||
* @param {number} percent
|
||||
* @param {number} total
|
||||
* @param {number} offloaded
|
||||
* @param {string} description
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
function getTitle( percent, total, offloaded, description ) {
|
||||
return percent + "% (" + numToString( offloaded ) + "/" + numToString( total ) + ") " + description;
|
||||
}
|
||||
|
||||
$: title = getTitle( percentComplete, $counts.total, $counts.offloaded, $strings.offloaded );
|
||||
|
||||
/**
|
||||
* Handles a click to toggle the flyout.
|
||||
*/
|
||||
function handleClick() {
|
||||
expanded = !expanded;
|
||||
flyoutButton.focus();
|
||||
|
||||
// We've handled the click.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep track of when a child control gets mouse focus.
|
||||
*/
|
||||
function handleMouseEnter() {
|
||||
hasFocus = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep track of when a child control loses mouse focus.
|
||||
*/
|
||||
function handleMouseLeave() {
|
||||
hasFocus = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- TODO: Fix a11y. -->
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div class="nav-status-wrapper" class:complete>
|
||||
<!-- TODO: Fix a11y. -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="nav-status"
|
||||
{title}
|
||||
on:click|preventDefault={handleClick}
|
||||
on:mouseenter={handleMouseEnter}
|
||||
on:mouseleave={handleMouseLeave}
|
||||
>
|
||||
{#if complete}
|
||||
<img
|
||||
class="icon type"
|
||||
src={$urls.assets + "img/icon/licence-checked.svg"}
|
||||
alt="{title}"
|
||||
{title}
|
||||
/>
|
||||
{/if}
|
||||
<p
|
||||
class="status-text"
|
||||
{title}
|
||||
>
|
||||
<strong>{percentComplete}%</strong>
|
||||
<span> {@html $strings.offloaded}</span>
|
||||
</p>
|
||||
<ProgressBar
|
||||
{percentComplete}
|
||||
{title}
|
||||
/>
|
||||
</div>
|
||||
<slot name="flyout">
|
||||
<OffloadStatusFlyout bind:expanded bind:hasFocus bind:buttonRef={flyoutButton}/>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.nav-status-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user