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
76 lines
1.9 KiB
Svelte
76 lines
1.9 KiB
Svelte
<script>
|
|
import {createEventDispatcher, onDestroy} from "svelte";
|
|
import {slide} from "svelte/transition";
|
|
import {
|
|
revalidatingSettings,
|
|
settings_changed,
|
|
settings,
|
|
strings,
|
|
state,
|
|
validationErrors
|
|
} from "../js/stores";
|
|
import {
|
|
scrollNotificationsIntoView
|
|
} from "../js/scrollNotificationsIntoView";
|
|
import Button from "./Button.svelte";
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
export let settingsStore = settings;
|
|
export let settingsChangedStore = settings_changed;
|
|
|
|
let saving = false;
|
|
|
|
$: disabled = saving || $validationErrors.size > 0;
|
|
|
|
// On init, start with no validation errors.
|
|
validationErrors.set( new Map() );
|
|
|
|
/**
|
|
* Handles a Cancel button click.
|
|
*/
|
|
function handleCancel() {
|
|
settingsStore.reset();
|
|
}
|
|
|
|
/**
|
|
* Handles a Save button click.
|
|
*
|
|
* @return {Promise<void>}
|
|
*/
|
|
async function handleSave() {
|
|
saving = true;
|
|
state.pausePeriodicFetch();
|
|
const result = await settingsStore.save();
|
|
$revalidatingSettings = true;
|
|
const statePromise = state.resumePeriodicFetch();
|
|
|
|
// The save happened, whether anything changed or not.
|
|
if ( result.hasOwnProperty( "saved" ) && result.hasOwnProperty( "changed_settings" ) ) {
|
|
dispatch( "routeEvent", { event: "settings.save", data: result } );
|
|
}
|
|
|
|
// After save make sure notifications are eyeballed.
|
|
scrollNotificationsIntoView();
|
|
saving = false;
|
|
|
|
// Just make sure periodic state fetch promise is done with,
|
|
// even though we don't really care about it.
|
|
await statePromise;
|
|
$revalidatingSettings = false;
|
|
}
|
|
|
|
// On navigation away from a component showing the footer,
|
|
// make sure settings are reset.
|
|
onDestroy( () => handleCancel() );
|
|
</script>
|
|
|
|
{#if $settingsChangedStore}
|
|
<div class="fixed-cta-block" transition:slide>
|
|
<div class="buttons">
|
|
<Button outline on:click={handleCancel}>{$strings.cancel_button}</Button>
|
|
<Button primary on:click={handleSave} {disabled}>{$strings.save_changes}</Button>
|
|
</div>
|
|
</div>
|
|
{/if}
|