=== Parwana Push ===
Contributors: parwanapush
Tags: web push, push notifications, notifications, hindi, vapid
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.5.0
License: GPLv2 or later

Thin connector between WordPress and Parwana Push: connects the site, loads the Parwana SDK, serves the service worker, registers subscribers and announces new posts. The notification banner is designed and published centrally in the Parwana dashboard, so design changes never need a plugin update.

== Description ==

* One-paste connection: paste the connection code from Parwana (Websites → your site → Setup → WordPress).
* Notification banner managed in Parwana (Websites → Notification UI): design, Hindi/English texts, placement, timing, success/blocked messages. It never asks for browser permission without a click and never shifts your layout. No topic picker by default: subscribers join your site's general audience.
* Serves /parwana-sw.js for you (also in subdirectory installs); works with an existing PWA service worker.
* Post publish integration: Off (default) / Manual (per-post checkbox) / Automatic (per-post opt-out). Each post is announced at most once (local marker + server dedupe key). Sends run in WP-Cron so publishing is never slowed down. Optional (advanced): category & tag → topic mapping.
* Push logs and a Health tab (connection, origin match, service worker, cron, scopes).
* Security: the server API key is stored encrypted (AES-256-GCM, key derived from your WordPress salts) and is never sent to browsers. Only the public site key is printed in pages. All admin actions require manage_options + nonces; all output is escaped.
* Performance: the SDK (~12 KB gzip) loads async in the footer; the banner is an overlay (no layout shift). No effect on SEO or AdSense markup.

== Installation ==

1. In Parwana: Websites → Add website (your exact https origin, e.g. https://example.com; www and non-www are different origins).
2. In WordPress: Plugins → Add New → Upload Plugin → parwana-push-wordpress.zip → Install Now → Activate.
3. In Parwana: Websites → your site → Setup → WordPress → "Create WordPress connection code". In WordPress: Settings → Parwana Push → Connection → paste it → "Connect & test".
4. Website tab: tick "Enable on site" → Save.
5. Health tab: all checks green. Visit the site in a normal browser window, click the banner's button, allow.
6. Publishing tab (optional): choose Manual or Automatic.

Banner design and texts: Parwana dashboard → Websites → your site → Notification UI → Save & publish.

If your site already has a service worker at "/" (PWA plugins), choose "My site already has a service worker" on the Website tab, add the shown importScripts line at the top of that worker and enter its URL.

== Uninstall / rollback ==

* Quick off: Website tab → untick "Enable on site" (the SDK and banner disappear immediately; existing subscribers keep receiving pushes sent from the Parwana dashboard).
* Full removal: Advanced → "Retire service worker" for ~30 days (visitors' browsers remove the worker on their next visit), then deactivate and delete the plugin. Tick "Clean uninstall" first to delete settings, post markers and logs.
* Subscribers are stored in Parwana, not in WordPress; deleting the plugin does not delete them.

== Changelog ==

= 1.5.0 =
* Daily check-in with Parwana (WP-Cron): reports the plugin version to the dashboard, refreshes the cached website info and shows an admin notice if the API key stops working, before a post announcement fails.

= 1.4.1 =
* Readme: SDK size updated (no code change).

= 1.4.0 =
* Thin connector: the plugin no longer has its own banner texts/language. The banner is designed and published centrally in Parwana (Notification UI) and updates without plugin updates. Old local banner texts are ignored.
* "Banner" tab renamed "Website" (enable on site + service worker).
* Publishing audience defaults to "All subscribers" (topics are optional/advanced). Existing sites keep their saved choice.
* [parwana_button] now opens the central Parwana banner (no topic picker).

= 1.3.0 =
* Parwana moved to https://parwanapush.com. New installs use it by default; sites saved with the old https://kuna6.club/parwana address switch automatically (same API key).

= 1.2.0 =
* One-paste setup: paste the connection code from Parwana (Websites → your site → Setup → Connect WordPress) instead of a URL and key.
* Adds a public <meta name="parwana-site-key"> install marker in <head>. Parwana uses it for the connection check and domain verification, so no verification file is needed.


= 1.1.0 =
* Connect & test: nothing is saved until the handshake succeeds; changing the Parwana URL requires re-entering the API key; clear messages for wrong URL, TLS, timeout, revoked key and missing campaigns:write scope.
* Admin notices: stored key can't be decrypted (salts changed), recent publish failure. Retry button in Logs.
* Publishing: imports (WP_IMPORTING) and back-dated posts never trigger auto pushes; new filter parwana_push_should_send; empty titles fall back to the site name; non-https URLs are reported clearly; campaigns held for approval or by the live-sending lock are logged as "held", not "sent".
* Health: correct service-worker check (escaped slashes, subdirectory installs, content type) and an OpenSSL warning.
* Multisite: per-site install on first load; uninstall cleans every site. Deactivation removes all scheduled sends.
* Service worker response marked non-cacheable for page-cache plugins; requests use wp_safe_remote_request.


= 1.0.0 =
* First release.
