node-red-contrib-web-worldmap 2.37.3 → 2.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v2.38.0 - Return client headers as part of connect message.
4
+ - v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh
3
5
  - v2.37.3 - Fix hang on layer change
4
6
  - v2.37.2 - If custom layer is only layer then show it automatically. Issue #230
5
7
  - v2.37.1 - Warn (and drop) messages that are missing a payload. Issue #229
package/README.md CHANGED
@@ -7,10 +7,14 @@
7
7
  A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a world
8
8
  map web page for plotting "things" on.
9
9
 
10
+ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/dceejay) this project.
11
+
10
12
  ![Map Image](https://dceejay.github.io/pages/images/redmap.png)
11
13
 
12
14
  ### Updates
13
15
 
16
+ - v2.38.0 - Return client headers as part of connect message.
17
+ - v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh
14
18
  - v2.37.3 - Fix hang on layer change
15
19
  - v2.37.2 - If custom layer is only layer then show it automatically. Issue #230
16
20
  - v2.37.1 - Warn (and drop) messages that are missing a payload. Issue #229
@@ -368,7 +372,11 @@ The **worldmap in** node can be used to receive various events from the map. Exa
368
372
 
369
373
  If File Drop is enabled - then the map can accept files of type gpx, kml, nvg, jpeg, png and geojson. The file content property will always be a binary buffer. The lat, lon of the cursor drop point will be included. Tracks will be locally rendered on the map. The node-red-node-exif node can be used to extract location information from a jpeg image and then geolocate it back on the map. Png images will be located where they are dropped but can then be dragged if required.
370
374
 
371
- All actions also include a `msg._sessionid` property that indicates which client session they came from. Any msg sent out that includes this property will ONLY be sent to that session - so you can target map updates to specific sessions if required.
375
+ All actions also include a:
376
+ `msg._sessionid` property that indicates which client session they came from. Any msg sent out that includes this property will ONLY be sent to that session - so you can target map updates to specific sessions if required.
377
+ 'msg._sessionip' property that shows the ip of the client that is connected to the session.
378
+
379
+ Only actions "connected" include a msg._clientheaders property that shows the headers sent by the client to make a connection to the session.
372
380
 
373
381
 
374
382
  ### Utility functions
@@ -422,13 +430,15 @@ Optional properties include
422
430
  - **zoomlock** - locks the zoom control to the current value and removes zoom control - `{"command":{"zoomlock":true}}`
423
431
  - **hiderightclick** - disables the right click that allows adding or deleting points on the map - `{"command":{"hiderightclick":true}}`
424
432
  - **coords** - turns on and off a display of the current mouse co-ordinates. Values can be "deg", "dms", or "none" (default). - `{"command":{"coords":"deg"}}`
425
- - **showruler** - turns on and off a display of the ruler control. Values can be "true" or "false". - `{"command":{"showruler":true}}`
433
+ - **showruler** - turns on and off a display of the ruler control. Values can be "true" or "false". - `{"command": {"ruler": {"showruler": true}}}`
426
434
  - **button** - if supplied with a `name` and `icon` property - adds a button to provide user input - sends
427
435
  a msg `{"action":"button", "name":"the_button_name"}` to the worldmap in node. If supplied with a `name` property only, it will remove the button. Optional `position` property can be 'bottomright', 'bottomleft', 'topleft' or 'topright' (default). button can also be an array of button objects.
428
436
  - **contextmenu** - html string to define the right click menu when not on a marker. Defaults to the simple add marker input. Empty string `""` disables this right click.
429
437
  - **toptitle** - Words to replace title in title bar (if not in iframe)
430
438
  - **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
431
439
  - **trackme** - Turns on/off the browser self locating. Boolean false = off, true = cyan circle showing accuracy error, or an object like `{"command":{"trackme":{"name":"Dave","icon":"car","iconColor":"blue","layer":"mytrack","accuracy":false}}}`. Usual marker options can be applied.
440
+ - **showmenu** - Show or hide the display of the hamberger menu control in the top right . Values can be "show" or "hide". - `{"command":{"showmenu": "hide"}}`
441
+ - **showlayers** - Show or hide the display of selectable layers. Does not control the display of an individual layer, rather a users ability to interact with them. Values can be "show" or "hide". - `{"command":{"showlayers": "hide"}}`
432
442
 
433
443
  #### To switch layer, move map and zoom
434
444
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.37.3",
3
+ "version": "2.38.0",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
6
  "@turf/bezier-spline": "~6.5.0",
@@ -751,10 +751,6 @@ map.on('moveend', function() {
751
751
  map.on('locationfound', onLocationFound);
752
752
  map.on('locationerror', onLocationError);
753
753
 
754
- //map.on('contextmenu', function(e) {
755
- // ws.send(JSON.stringify({action:"rightclick", lat:e.latlng.lat.toFixed(5), lon:e.latlng.lng.toFixed(5)}));
756
- //});
757
-
758
754
  // single right click to add a marker
759
755
  var addmenu = "<b>Add marker</b><br><input type='text' id='rinput' autofocus onkeydown='if (event.keyCode == 13) addThing();' placeholder='name (,icon/SIDC, layer, colour, heading)'/>";
760
756
  if (navigator.onLine) { addmenu += '<br/><a href="https://spatialillusions.com/unitgenerator/" target="_new">MilSymbol SIDC generator</a>'; }
@@ -809,6 +805,10 @@ var addToForm = function(n,v) {
809
805
  form[n] = v;
810
806
  }
811
807
 
808
+ // map.on('click', function(e) {
809
+ // ws.send(JSON.stringify({action:"click", lat:e.latlng.lat.toFixed(5), lon:e.latlng.lng.toFixed(5)}));
810
+ // });
811
+
812
812
  // allow double right click to zoom out (if enabled)
813
813
  // single right click opens a message window that adds a marker
814
814
  var rclicked = false;
package/worldmap.js CHANGED
@@ -120,6 +120,7 @@ module.exports = function(RED) {
120
120
  });
121
121
  node.status({fill:"green",shape:"dot",text:"connected "+Object.keys(clients).length,_sessionid:client.id});
122
122
  }
123
+
123
124
  node.on('input', function(msg) {
124
125
  if (!msg.hasOwnProperty("payload")) { node.warn("Missing payload"); return; }
125
126
  if (msg.hasOwnProperty("_sessionid")) {
@@ -134,7 +135,7 @@ module.exports = function(RED) {
134
135
  }
135
136
  }
136
137
  }
137
- if (msg.payload.hasOwnProperty("name")) {
138
+ if (msg.payload.hasOwnProperty("name") && !msg.hasOwnProperty("_sessionid")) {
138
139
  allPoints[msg.payload.name] = RED.util.cloneMessage(msg.payload);
139
140
  var t = node.maxage || 3600;
140
141
  if (msg.payload.ttl && msg.payload.ttl < t) { t = msg.payload.ttl; }
@@ -267,7 +268,7 @@ module.exports = function(RED) {
267
268
  message = JSON.parse(message);
268
269
  if (message.hasOwnProperty("action")) {
269
270
  if ((node.events.indexOf("connect")!==-1) && (message.action === "connected")) {
270
- setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
271
+ setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip, _clientheaders:client.headers})});
271
272
  }
272
273
  if ((node.events.indexOf("bounds")!==-1) && (message.action === "bounds")) {
273
274
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});