node-red-contrib-web-worldmap 2.37.4 → 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,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v2.38.0 - Return client headers as part of connect message.
3
4
  - v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh
4
5
  - v2.37.3 - Fix hang on layer change
5
6
  - v2.37.2 - If custom layer is only layer then show it automatically. Issue #230
package/README.md CHANGED
@@ -7,10 +7,13 @@
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.
14
17
  - v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh
15
18
  - v2.37.3 - Fix hang on layer change
16
19
  - v2.37.2 - If custom layer is only layer then show it automatically. Issue #230
@@ -369,7 +372,11 @@ The **worldmap in** node can be used to receive various events from the map. Exa
369
372
 
370
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.
371
374
 
372
- 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.
373
380
 
374
381
 
375
382
  ### Utility functions
@@ -430,8 +437,8 @@ Optional properties include
430
437
  - **toptitle** - Words to replace title in title bar (if not in iframe)
431
438
  - **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
432
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.
433
- - **showmenu** - Show or hide the display of the hamberger menu control in the top right . Values can be "show" or "hide". - `{"command":{"showmenu: "hide"}}`
434
- - **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"}}`
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"}}`
435
442
 
436
443
  #### To switch layer, move map and zoom
437
444
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.37.4",
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
@@ -268,7 +268,7 @@ module.exports = function(RED) {
268
268
  message = JSON.parse(message);
269
269
  if (message.hasOwnProperty("action")) {
270
270
  if ((node.events.indexOf("connect")!==-1) && (message.action === "connected")) {
271
- 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})});
272
272
  }
273
273
  if ((node.events.indexOf("bounds")!==-1) && (message.action === "bounds")) {
274
274
  setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});