=== Smooth CDN Connector ===
Contributors: smoothcdn
Tags: cdn, media, assets, performance
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later

Connect your WordPress media library to Smooth CDN and keep synced assets up to date.

== Description ==
Smooth CDN Connector focuses on one job: syncing WordPress media items to Smooth CDN.

The plugin authenticates with Smooth CDN, creates or reuses a connector project for the current site, keeps a local record of attachment sync state, and lets you enable or disable sync per media item from wp-admin.

This plugin no longer scans REST API endpoints or generates JSON snapshots.

== Why use Smooth CDN Connector? ==
* Faster media delivery through Smooth CDN instead of serving files only from the local WordPress uploads directory
* Manual and scheduled sync for media items you actually want to manage
* Automatic updates when attachments are created or changed
* Optional protected delivery for selected assets
* Optional offload mode that restores files back from Smooth CDN during unsync
* Clear wp-admin views for synced assets, unused assets, and access management

Useful for:
* WordPress sites with growing media libraries
* Teams that want controlled CDN sync without changing their whole media workflow at once
* Projects that need protected asset delivery for selected files
* Sites preparing for full media offload to Smooth CDN

== How it works ==
1. Connect your site to Smooth CDN with account or guest mode
2. The plugin creates or reuses a connector project for the current WordPress site
3. WordPress attachments are indexed in the plugin and can be enabled for sync
4. Selected media files and their generated image sizes are uploaded to Smooth CDN
5. Depending on settings, media can stay local, use rewritten URLs, or be offloaded and restored later when needed

== Features ==
* Smooth CDN account and guest authentication flows
* Automatic project creation with type `cdn_connector`
* Media-library based sync instead of endpoint scanning
* Manual and scheduled media sync
* Automatic re-sync when attachments change
* Unused assets view based on synced plugin assets cross-checked against Smooth CDN usage logs
* Purge flow for synced media records and Smooth CDN assets

== Planned Scope ==
* Upload WordPress media items to Smooth CDN
* Offload media items so delivery can happen only through Smooth CDN
* Detect and sync JS/CSS assets registered via `wp_enqueue_script()` and `wp_enqueue_style()`
* Extend detection later to other static assets such as fonts, PDFs, SVGs, and build artifacts when the source can be resolved safely

== Notes ==
* New attachments are added to the connector index automatically.
* Enabled attachments can be synced manually from the Media Library screen.
* Scheduled sync uses WP-Cron and can run hourly, daily, or weekly.
* The Unused assets view helps identify synced assets that have no recent usage records in Smooth CDN logs.
* Purge removes stored connector settings and local sync metadata. It also attempts to delete synced Smooth CDN assets first.

== Settings overview ==
Key settings that affect sync behavior:

* `Connection mode` lets you use Smooth CDN account auth or guest mode.
* `Auto sync frequency` controls how often scheduled WP-Cron sync runs. Available values: `hourly`, `daily`, `weekly`.
* `Asset mode` controls whether synced assets stay local, use rewritten URLs, or are offloaded after upload.
* `Custom subdomain` lets you use your Smooth CDN custom subdomain when the connected plan supports it.

When `Asset mode` is changed to offload, the plugin syncs enabled media and can remove local files after upload. When offload is turned off, the plugin restores local media files from Smooth CDN.

== External services ==
This plugin connects to Smooth CDN to authenticate the site, create or reuse a connector project, upload and delete synced media assets, fetch project access tokens, manage protected asset access, and optionally restore offloaded files from Smooth CDN URLs.

When you connect the plugin, it sends your site domain and connection mode to Smooth CDN so the service can authenticate the session and create or reuse the related connector project.

When you sync media, it sends selected media files and related asset metadata such as filenames, paths, hashes, protection settings, and project identifiers to Smooth CDN so the assets can be uploaded, updated, delivered, and managed.

When you revoke, grant, or inspect protected asset access, it sends the relevant project identifiers, access identifiers, recipient email address, selected asset paths, and optional expiration date to Smooth CDN to manage access tokens and protected delivery.

When local offload restore is used, the plugin downloads the previously synced asset file from its Smooth CDN delivery URL back to your WordPress uploads directory.

This service is provided by Smooth CDN:
Terms of Service: https://smoothcdn.com/terms
Privacy Policy: https://smoothcdn.com/privacy

== Maintenance ==
`Unsync` removes selected assets from Smooth CDN, restores local files when needed, and disables sync for those items locally.

`Purge` removes synced assets from Smooth CDN and clears local media sync state while keeping the plugin ready for a fresh sync setup.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.

== License ==
GPLv2 or later
