=== WPKari — Direct-to-S3 Media Offload ===
Contributors: ihsanberahim
Tags: media, s3, offload, cdn, storage
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.2
Stable tag: 0.2.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Offload all WordPress media to S3-compatible storage (BytePlus TOS / any S3 API) — directly, with a fallback for locked-down hosts.

== Description ==

wpkari moves your WordPress media — originals and every generated sub-size — to an
S3-compatible object store so files are durable, shared, and not tied to one host's
disk. It ships two selectable engines behind a `mode` selector so it runs anywhere,
including locked-down cPanel:

* **stream** (primary): a direct-to-S3 stream wrapper — new uploads are written
  straight into S3, nothing persisted locally.
* **mirror** (fallback): copy-then-mirror — WordPress writes locally as normal, then
  wpkari uploads, verifies, and deletes the local copy.
* **auto**: probes the host and picks the right engine for you.

Other features:

* Existing-media migration via WP-CLI (`wp wpkari migrate`) or an admin batch tool,
  with a verify-then-delete gate (local copies removed only after a confirming HEAD).
* URL rewriting to serve media from S3/CDN (public or presigned).
* Object lifecycle: deletes, edits, and thumbnail regeneration are mirrored to S3.
* A guided three-page admin UX (Start → Settings → Status & Diagnostics) built from
  native WordPress admin elements.
* A Diagnostics page that self-tests the host (extensions, stream-wrapper viability,
  outbound HTTPS/TLS, clock skew, limits) with copy-paste remediation.

The bundled AWS SDK v3 is namespace-prefixed (via Strauss) to `WPKari\Vendor\Aws\`
and the stream wrapper uses a custom `wpkari://` protocol, so wpkari never collides
with other plugins that bundle an AWS SDK (e.g. backup plugins).

= Production trust root (Connect with MAMAK) =

The "Connect with MAMAK" storage-connect endpoint verifies an Ed25519 signature
against a baked **development** public key shared with the WPToSAI plugin. In
production, define your real dashboard key once in `wp-config.php`:

    define( 'MAMAK_PAIR_PUBLIC_KEY', 'base64-encoded-32-byte-ed25519-public-key' );

This constant takes precedence over the bundled default. Do not rely on the
bundled key for a production connection.

== Installation ==

1. Build dependencies on a host with Composer: `bash bin/build.sh` (commits
   `vendor-prefixed/`).
2. Install as a plugin or mu-plugin.
3. Open **wpkari → Start** and follow the 6-step checklist: configure the bucket,
   run Test Connection, then enable offload.

Configuration can come from constants (`WPKARI_*`), environment (`AWS_*`/`S3_*`),
a dev `.env.local`, or the Settings form — whichever is present wins, in that order.

== Frequently Asked Questions ==

= Will this conflict with my backup plugin's AWS SDK? =

No. wpkari's SDK is prefixed to `WPKari\Vendor\Aws\` and its stream wrapper uses the
`wpkari://` protocol, so there is no class or protocol collision.

= What happens if S3 is misconfigured or unreachable? =

Nothing breaks. If config is incomplete or offload is disabled, wpkari registers no
media hooks at all — WordPress media stays 100% stock — and shows an admin notice.

= My TOS bucket rejects ACLs. =

Set Object ACL to "none" and add a public-read bucket policy (or use presigned URLs).
Test Connection auto-detects this and tells you.

= Does uninstalling delete my files? =

No. Uninstall removes only wpkari's options and meta. It never deletes S3 objects or
local media.

== Changelog ==

= 0.1.0 =
* Initial release: stream + mirror engines, migration, URL rewriting, lifecycle,
  diagnostics, guided admin.
