Files
WPS3Media/ui/components/SettingNotifications.svelte
Malin 3248cbb029 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
2026-03-03 12:30:18 +01:00

55 lines
1.4 KiB
Svelte

<script>
import {settings_notifications} from "../js/stores";
import Notification from "./Notification.svelte";
export let settingKey;
/**
* Compares two notification objects to sort them into a preferred order.
*
* Order should be errors, then warnings and finally anything else alphabetically by type.
* As these (inline) notifications are typically displayed under a setting,
* this ensures the most important notifications are nearest the control.
*
* @param {Object} a
* @param {Object} b
*
* @return {number}
*/
function compareNotificationTypes( a, b ) {
// Sort errors to the top.
if ( a.type === "error" && b.type !== "error" ) {
return -1;
}
if ( b.type === "error" && a.type !== "error" ) {
return 1;
}
// Next sort warnings.
if ( a.type === "warning" && b.type !== "warning" ) {
return -1;
}
if ( b.type === "warning" && a.type !== "warning" ) {
return 1;
}
// Anything else, just sort by type for stability.
if ( a.type < b.type ) {
return -1;
}
if ( b.type < a.type ) {
return 1;
}
return 0;
}
</script>
{#if $settings_notifications.has( settingKey )}
{#each [...$settings_notifications.get( settingKey ).values()].sort( compareNotificationTypes ) as notification (notification)}
<Notification {notification}>
<p>{@html notification.message}</p>
</Notification>
{/each}
{/if}