=== Mesh-Plug for Meshtastic ===
Contributors: potar
Donate link: https://www.paypal.com/ncp/payment/4RV65EGN96SLS
Tags: mqtt, meshtastic, websocket
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.3.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight Meshtastic/MQTT viewer for WordPress via MQTT over WebSocket (WS/WSS).

== Description ==
Mesh-Plug provides a simple shortcode that connects to your MQTT broker over WebSocket and prints incoming messages to a live log.

Shortcode: [mesh_plug]

Map shortcode options:
- map_tiles="voyager|osm|light|dark" (default: voyager)
- map_zoom="13" map_min_zoom="2" map_max_zoom="18"
- fit="1|0|once" fit_max_zoom="13" center="lat,lon"

== External services ==

Mesh-Plug can connect to external services depending on how you configure and use it.

= MQTT broker (configured by the site administrator) =
Mesh-Plug connects directly from the visitor's browser to the MQTT broker WebSocket URL you enter in Settings → Mesh-Plug.
This is required for the plugin to receive and display Meshtastic/MQTT messages.

Data sent: the visitor's browser establishes a WebSocket connection to your broker; it may send a client ID and (optionally) the username/password you configured; it subscribes to the topic filter you configured.
When: whenever a page containing the [mesh_plug] shortcode is loaded and the user connects (or auto-connect is enabled).

Terms/Privacy: this depends on the broker provider you choose. If you use a third-party MQTT hosting provider, review their terms and privacy policy.

= Map tile providers (CARTO / OpenStreetMap) =
If you use the Map tab, Mesh-Plug downloads map tiles from a free provider to render the basemap.
By default, Mesh-Plug uses CARTO Voyager tiles. You can switch to OpenStreetMap tiles with shortcode map attributes.

Data sent: standard HTTP requests for map tiles; this typically includes the visitor's IP address, user agent, and the requested tile coordinates.
When: whenever the Map tab is opened/visible and the map needs to load tiles.

CARTO basemaps: https://carto.com/basemaps
OpenStreetMap tile usage policy: https://operations.osmfoundation.org/policies/tiles/
OpenStreetMap privacy policy: https://osmfoundation.org/wiki/Privacy_Policy

== Installation ==
1. Upload the plugin folder to /wp-content/plugins/mesh-plug or install via the Plugins screen.
2. Activate Mesh-Plug.
3. Go to Settings → Mesh-Plug and configure your broker URL, topic, and credentials.
4. Add [mesh_plug] to any page.

== Screenshots ==
1. Log: Where you can see mesh traffic moving
2. Nodes: List of the Nodes in your local mesh
3. Map: Nodes are required to use GPS/share location
4. Chat: Messages between connected Nodes
5. Settings: MQTT required for Mesh-Plug 

== Changelog ==

= 1.3.1 =
* Upgraded map rendering to Leaflet with drag/pan, zoom controls, and GPS-accurate marker placement.
* Added shortcode map options: map_tiles, map_zoom, map_min_zoom, map_max_zoom, fit, fit_max_zoom, center.
* Improved MQTT WebSocket compatibility and close-code logging for broker troubleshooting.
* Fixed duplicate-message filtering so valid repeated node updates are not suppressed.
* Hardened schema upgrades on MariaDB by moving index creation out of dbDelta parser edge cases.

= 1.1.8 =
* Updated frontend output to use WordPress enqueue/inline-script APIs (plugin check compliance).
* Documented external services (OpenStreetMap tiles; optional broker connections).

= 1.1.7 =
* Chat now displays node longname (fallback: shortname, then node ID).

= 1.1.6 =
* Added message de-duplication to prevent double-posted chat and repeated entries.

= 1.1.5 =
* Map zoom is admin-controlled (shortcode); removed end-user zoom controls.
* Added Mesh-Plug logo branding to the Settings page.

= 1.1.1 =
* Map tab now renders a real basemap using OpenStreetMap raster tiles (no external JS libraries required).

= 1.1.0 =
* Added Map and Charts tabs for a richer dashboard experience.

= 1.0.8 =
* Added simple tabs (Log, Nodes, Chat) for non-technical viewing.
* Binary/protobuf payloads now display as a byte count instead of garbled text.
* Default topic updated to msh/2/json/# to show human-readable Meshtastic JSON by default.
= 1.0.7 =
* Fix shortcode rendering and JavaScript mount errors.
* Fix password handling: leaving password blank keeps the stored value.
* Allow ws:// and wss:// broker URLs.

== License ==
GPLv2 or later.

== Credits ==

Developed by **Michael Winchester**  
For documentation and updates, visit [https://meshplug.michaelwinchester.com/](https://meshplug.michaelwinchester.com/)
