node-red-contrib-tak-registration 0.1.2 → 0.2.2

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.
@@ -26,14 +26,14 @@ function Axios(instanceConfig) {
26
26
  *
27
27
  * @param {Object} config The config specific for this request (merged with this.defaults)
28
28
  */
29
- Axios.prototype.request = function request(config) {
29
+ Axios.prototype.request = function request(configOrUrl, config) {
30
30
  /*eslint no-param-reassign:0*/
31
31
  // Allow for axios('example/url'[, config]) a la fetch API
32
- if (typeof config === 'string') {
33
- config = arguments[1] || {};
34
- config.url = arguments[0];
35
- } else {
32
+ if (typeof configOrUrl === 'string') {
36
33
  config = config || {};
34
+ config.url = configOrUrl;
35
+ } else {
36
+ config = configOrUrl || {};
37
37
  }
38
38
 
39
39
  config = mergeConfig(this.defaults, config);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var utils = require('./../utils');
4
- var defaults = require('./../defaults');
4
+ var defaults = require('../defaults');
5
5
 
6
6
  /**
7
7
  * Transform the data for a request or a response
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('./utils');
4
- var normalizeHeaderName = require('./helpers/normalizeHeaderName');
5
- var enhanceError = require('./core/enhanceError');
3
+ var utils = require('../utils');
4
+ var normalizeHeaderName = require('../helpers/normalizeHeaderName');
5
+ var enhanceError = require('../core/enhanceError');
6
+ var transitionalDefaults = require('./transitional');
6
7
 
7
8
  var DEFAULT_CONTENT_TYPE = {
8
9
  'Content-Type': 'application/x-www-form-urlencoded'
@@ -18,10 +19,10 @@ function getDefaultAdapter() {
18
19
  var adapter;
19
20
  if (typeof XMLHttpRequest !== 'undefined') {
20
21
  // For browsers use XHR adapter
21
- adapter = require('./adapters/xhr');
22
+ adapter = require('../adapters/xhr');
22
23
  } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
23
24
  // For node use HTTP adapter
24
- adapter = require('./adapters/http');
25
+ adapter = require('../adapters/http');
25
26
  }
26
27
  return adapter;
27
28
  }
@@ -43,11 +44,7 @@ function stringifySafely(rawValue, parser, encoder) {
43
44
 
44
45
  var defaults = {
45
46
 
46
- transitional: {
47
- silentJSONParsing: true,
48
- forcedJSONParsing: true,
49
- clarifyTimeoutError: false
50
- },
47
+ transitional: transitionalDefaults,
51
48
 
52
49
  adapter: getDefaultAdapter(),
53
50
 
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ silentJSONParsing: true,
5
+ forcedJSONParsing: true,
6
+ clarifyTimeoutError: false
7
+ };
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- "version": "0.24.0"
2
+ "version": "0.26.1"
3
3
  };
@@ -10,5 +10,5 @@ module.exports = function isAbsoluteURL(url) {
10
10
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
11
11
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
12
12
  // by any combination of letters, digits, plus, period, or hyphen.
13
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
13
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
14
14
  };
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var utils = require('./../utils');
4
+
3
5
  /**
4
6
  * Determines whether the payload is an error thrown by Axios
5
7
  *
@@ -7,5 +9,5 @@
7
9
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
8
10
  */
9
11
  module.exports = function isAxiosError(payload) {
10
- return (typeof payload === 'object') && (payload.isAxiosError === true);
12
+ return utils.isObject(payload) && (payload.isAxiosError === true);
11
13
  };
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ function combinedKey(parentKey, elKey) {
4
+ return parentKey + '.' + elKey;
5
+ }
6
+
7
+ function buildFormData(formData, data, parentKey) {
8
+ if (Array.isArray(data)) {
9
+ data.forEach(function buildArray(el, i) {
10
+ buildFormData(formData, el, combinedKey(parentKey, i));
11
+ });
12
+ } else if (
13
+ typeof data === 'object' &&
14
+ !(data instanceof File || data === null)
15
+ ) {
16
+ Object.keys(data).forEach(function buildObject(key) {
17
+ buildFormData(
18
+ formData,
19
+ data[key],
20
+ parentKey ? combinedKey(parentKey, key) : key
21
+ );
22
+ });
23
+ } else {
24
+ if (data === undefined) {
25
+ return;
26
+ }
27
+
28
+ var value =
29
+ typeof data === 'boolean' || typeof data === 'number'
30
+ ? data.toString()
31
+ : data;
32
+ formData.append(parentKey, value);
33
+ }
34
+ }
35
+
36
+ /**
37
+ * convert a data object to FormData
38
+ *
39
+ * type FormDataPrimitive = string | Blob | number | boolean
40
+ * interface FormDataNest {
41
+ * [x: string]: FormVal
42
+ * }
43
+ *
44
+ * type FormVal = FormDataNest | FormDataPrimitive
45
+ *
46
+ * @param {FormVal} data
47
+ */
48
+
49
+ module.exports = function getFormData(data) {
50
+ var formData = new FormData();
51
+
52
+ buildFormData(formData, data);
53
+
54
+ return formData;
55
+ };
@@ -13,7 +13,7 @@ var toString = Object.prototype.toString;
13
13
  * @returns {boolean} True if value is an Array, otherwise false
14
14
  */
15
15
  function isArray(val) {
16
- return toString.call(val) === '[object Array]';
16
+ return Array.isArray(val);
17
17
  }
18
18
 
19
19
  /**
@@ -54,7 +54,7 @@ function isArrayBuffer(val) {
54
54
  * @returns {boolean} True if value is an FormData, otherwise false
55
55
  */
56
56
  function isFormData(val) {
57
- return (typeof FormData !== 'undefined') && (val instanceof FormData);
57
+ return toString.call(val) === '[object FormData]';
58
58
  }
59
59
 
60
60
  /**
@@ -68,7 +68,7 @@ function isArrayBufferView(val) {
68
68
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
69
69
  result = ArrayBuffer.isView(val);
70
70
  } else {
71
- result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
71
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
72
72
  }
73
73
  return result;
74
74
  }
@@ -175,7 +175,7 @@ function isStream(val) {
175
175
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
176
176
  */
177
177
  function isURLSearchParams(val) {
178
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
178
+ return toString.call(val) === '[object URLSearchParams]';
179
179
  }
180
180
 
181
181
  /**
@@ -1,27 +1,28 @@
1
1
  {
2
- "_from": "axios@^0.24.0",
3
- "_id": "axios@0.24.0",
2
+ "_from": "axios@0.26.1",
3
+ "_id": "axios@0.26.1",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
6
- "_location": "/node-red-contrib-takfiles/axios",
5
+ "_integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
6
+ "_location": "/axios",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
- "type": "range",
9
+ "type": "version",
10
10
  "registry": true,
11
- "raw": "axios@^0.24.0",
11
+ "raw": "axios@0.26.1",
12
12
  "name": "axios",
13
13
  "escapedName": "axios",
14
- "rawSpec": "^0.24.0",
14
+ "rawSpec": "0.26.1",
15
15
  "saveSpec": null,
16
- "fetchSpec": "^0.24.0"
16
+ "fetchSpec": "0.26.1"
17
17
  },
18
18
  "_requiredBy": [
19
- "/node-red-contrib-takfiles"
19
+ "#USER",
20
+ "/"
20
21
  ],
21
- "_resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
22
- "_shasum": "804e6fa1e4b9c5288501dd9dff56a7a0940d20d6",
23
- "_spec": "axios@^0.24.0",
24
- "_where": "/Users/conway/Projects/DCJNodes/takfile/",
22
+ "_resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
23
+ "_shasum": "1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9",
24
+ "_spec": "axios@0.26.1",
25
+ "_where": "/Users/conway/Projects/TAKreg",
25
26
  "author": {
26
27
  "name": "Matt Zabriskie"
27
28
  },
@@ -39,7 +40,7 @@
39
40
  }
40
41
  ],
41
42
  "dependencies": {
42
- "follow-redirects": "^1.14.4"
43
+ "follow-redirects": "^1.14.8"
43
44
  },
44
45
  "deprecated": false,
45
46
  "description": "Promise based HTTP client for the browser and node.js",
@@ -109,5 +110,5 @@
109
110
  "types": "index.d.ts",
110
111
  "typings": "./index.d.ts",
111
112
  "unpkg": "dist/axios.min.js",
112
- "version": "0.24.0"
113
+ "version": "0.26.1"
113
114
  }
@@ -336,96 +336,101 @@ RedirectableRequest.prototype._processResponse = function (response) {
336
336
  // the user agent MAY automatically redirect its request to the URI
337
337
  // referenced by the Location field value,
338
338
  // even if the specific status code is not understood.
339
+
340
+ // If the response is not a redirect; return it as-is
339
341
  var location = response.headers.location;
340
- if (location && this._options.followRedirects !== false &&
341
- statusCode >= 300 && statusCode < 400) {
342
- // Abort the current request
343
- abortRequest(this._currentRequest);
344
- // Discard the remainder of the response to avoid waiting for data
345
- response.destroy();
346
-
347
- // RFC7231§6.4: A client SHOULD detect and intervene
348
- // in cyclical redirections (i.e., "infinite" redirection loops).
349
- if (++this._redirectCount > this._options.maxRedirects) {
350
- this.emit("error", new TooManyRedirectsError());
351
- return;
352
- }
342
+ if (!location || this._options.followRedirects === false ||
343
+ statusCode < 300 || statusCode >= 400) {
344
+ response.responseUrl = this._currentUrl;
345
+ response.redirects = this._redirects;
346
+ this.emit("response", response);
353
347
 
354
- // RFC7231§6.4: Automatic redirection needs to done with
355
- // care for methods not known to be safe, []
356
- // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
357
- // the request method from POST to GET for the subsequent request.
358
- if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
359
- // RFC7231§6.4.4: The 303 (See Other) status code indicates that
360
- // the server is redirecting the user agent to a different resource […]
361
- // A user agent can perform a retrieval request targeting that URI
362
- // (a GET or HEAD request if using HTTP) […]
363
- (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
364
- this._options.method = "GET";
365
- // Drop a possible entity and headers related to it
366
- this._requestBodyBuffers = [];
367
- removeMatchingHeaders(/^content-/i, this._options.headers);
368
- }
348
+ // Clean up
349
+ this._requestBodyBuffers = [];
350
+ return;
351
+ }
369
352
 
370
- // Drop the Host header, as the redirect might lead to a different host
371
- var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
353
+ // The response is a redirect, so abort the current request
354
+ abortRequest(this._currentRequest);
355
+ // Discard the remainder of the response to avoid waiting for data
356
+ response.destroy();
372
357
 
373
- // If the redirect is relative, carry over the host of the last request
374
- var currentUrlParts = url.parse(this._currentUrl);
375
- var currentHost = currentHostHeader || currentUrlParts.host;
376
- var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
377
- url.format(Object.assign(currentUrlParts, { host: currentHost }));
358
+ // RFC7231§6.4: A client SHOULD detect and intervene
359
+ // in cyclical redirections (i.e., "infinite" redirection loops).
360
+ if (++this._redirectCount > this._options.maxRedirects) {
361
+ this.emit("error", new TooManyRedirectsError());
362
+ return;
363
+ }
378
364
 
379
- // Determine the URL of the redirection
380
- var redirectUrl;
381
- try {
382
- redirectUrl = url.resolve(currentUrl, location);
383
- }
384
- catch (cause) {
385
- this.emit("error", new RedirectionError(cause));
386
- return;
387
- }
365
+ // RFC7231§6.4: Automatic redirection needs to done with
366
+ // care for methods not known to be safe, […]
367
+ // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
368
+ // the request method from POST to GET for the subsequent request.
369
+ if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
370
+ // RFC7231§6.4.4: The 303 (See Other) status code indicates that
371
+ // the server is redirecting the user agent to a different resource […]
372
+ // A user agent can perform a retrieval request targeting that URI
373
+ // (a GET or HEAD request if using HTTP) […]
374
+ (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
375
+ this._options.method = "GET";
376
+ // Drop a possible entity and headers related to it
377
+ this._requestBodyBuffers = [];
378
+ removeMatchingHeaders(/^content-/i, this._options.headers);
379
+ }
388
380
 
389
- // Create the redirected request
390
- debug("redirecting to", redirectUrl);
391
- this._isRedirect = true;
392
- var redirectUrlParts = url.parse(redirectUrl);
393
- Object.assign(this._options, redirectUrlParts);
381
+ // Drop the Host header, as the redirect might lead to a different host
382
+ var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
394
383
 
395
- // Drop the confidential headers when redirecting to another domain
396
- if (!(redirectUrlParts.host === currentHost || isSubdomainOf(redirectUrlParts.host, currentHost))) {
397
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
398
- }
384
+ // If the redirect is relative, carry over the host of the last request
385
+ var currentUrlParts = url.parse(this._currentUrl);
386
+ var currentHost = currentHostHeader || currentUrlParts.host;
387
+ var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
388
+ url.format(Object.assign(currentUrlParts, { host: currentHost }));
399
389
 
400
- // Evaluate the beforeRedirect callback
401
- if (typeof this._options.beforeRedirect === "function") {
402
- var responseDetails = { headers: response.headers };
403
- try {
404
- this._options.beforeRedirect.call(null, this._options, responseDetails);
405
- }
406
- catch (err) {
407
- this.emit("error", err);
408
- return;
409
- }
410
- this._sanitizeOptions(this._options);
411
- }
390
+ // Determine the URL of the redirection
391
+ var redirectUrl;
392
+ try {
393
+ redirectUrl = url.resolve(currentUrl, location);
394
+ }
395
+ catch (cause) {
396
+ this.emit("error", new RedirectionError(cause));
397
+ return;
398
+ }
399
+
400
+ // Create the redirected request
401
+ debug("redirecting to", redirectUrl);
402
+ this._isRedirect = true;
403
+ var redirectUrlParts = url.parse(redirectUrl);
404
+ Object.assign(this._options, redirectUrlParts);
405
+
406
+ // Drop confidential headers when redirecting to a less secure protocol
407
+ // or to a different domain that is not a superdomain
408
+ if (redirectUrlParts.protocol !== currentUrlParts.protocol &&
409
+ redirectUrlParts.protocol !== "https:" ||
410
+ redirectUrlParts.host !== currentHost &&
411
+ !isSubdomain(redirectUrlParts.host, currentHost)) {
412
+ removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
413
+ }
412
414
 
413
- // Perform the redirected request
415
+ // Evaluate the beforeRedirect callback
416
+ if (typeof this._options.beforeRedirect === "function") {
417
+ var responseDetails = { headers: response.headers };
414
418
  try {
415
- this._performRequest();
419
+ this._options.beforeRedirect.call(null, this._options, responseDetails);
416
420
  }
417
- catch (cause) {
418
- this.emit("error", new RedirectionError(cause));
421
+ catch (err) {
422
+ this.emit("error", err);
423
+ return;
419
424
  }
425
+ this._sanitizeOptions(this._options);
420
426
  }
421
- else {
422
- // The response is not a redirect; return it as-is
423
- response.responseUrl = this._currentUrl;
424
- response.redirects = this._redirects;
425
- this.emit("response", response);
426
427
 
427
- // Clean up
428
- this._requestBodyBuffers = [];
428
+ // Perform the redirected request
429
+ try {
430
+ this._performRequest();
431
+ }
432
+ catch (cause) {
433
+ this.emit("error", new RedirectionError(cause));
429
434
  }
430
435
  };
431
436
 
@@ -559,7 +564,7 @@ function abortRequest(request) {
559
564
  request.abort();
560
565
  }
561
566
 
562
- function isSubdomainOf(subdomain, domain) {
567
+ function isSubdomain(subdomain, domain) {
563
568
  const dot = subdomain.length - domain.length - 1;
564
569
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
565
570
  }
@@ -1,27 +1,27 @@
1
1
  {
2
- "_from": "follow-redirects@^1.14.4",
3
- "_id": "follow-redirects@1.14.7",
2
+ "_from": "follow-redirects@^1.14.8",
3
+ "_id": "follow-redirects@1.14.9",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
6
- "_location": "/node-red-contrib-takfiles/follow-redirects",
5
+ "_integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
6
+ "_location": "/follow-redirects",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "range",
10
10
  "registry": true,
11
- "raw": "follow-redirects@^1.14.4",
11
+ "raw": "follow-redirects@^1.14.8",
12
12
  "name": "follow-redirects",
13
13
  "escapedName": "follow-redirects",
14
- "rawSpec": "^1.14.4",
14
+ "rawSpec": "^1.14.8",
15
15
  "saveSpec": null,
16
- "fetchSpec": "^1.14.4"
16
+ "fetchSpec": "^1.14.8"
17
17
  },
18
18
  "_requiredBy": [
19
- "/node-red-contrib-takfiles/axios"
19
+ "/axios"
20
20
  ],
21
- "_resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
22
- "_shasum": "2004c02eb9436eee9a21446a6477debf17e81685",
23
- "_spec": "follow-redirects@^1.14.4",
24
- "_where": "/Users/conway/Projects/DCJNodes/takfile/node_modules/axios",
21
+ "_resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
22
+ "_shasum": "dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7",
23
+ "_spec": "follow-redirects@^1.14.8",
24
+ "_where": "/Users/conway/Projects/TAKreg/node_modules/axios",
25
25
  "author": {
26
26
  "name": "Ruben Verborgh",
27
27
  "email": "ruben@verborgh.org",
@@ -91,5 +91,5 @@
91
91
  "mocha": "nyc mocha",
92
92
  "test": "npm run lint && npm run mocha"
93
93
  },
94
- "version": "1.14.7"
94
+ "version": "1.14.9"
95
95
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "name" : "node-red-contrib-tak-registration",
3
- "version" : "0.1.2",
4
- "description" : "A Node-RED node to register to TAK and to help wrap files as datapackages to send to TAK",
5
- "dependencies" : {
2
+ "name": "node-red-contrib-tak-registration",
3
+ "version": "0.2.2",
4
+ "description": "A Node-RED node to register to TAK and to help wrap files as datapackages to send to TAK",
5
+ "dependencies": {
6
6
  "adm-zip": "^0.5.9",
7
- "axios": "^0.24.0",
7
+ "axios": "^0.26.1",
8
8
  "form-data": "^4.0.0",
9
9
  "uuid": "^8.3.2"
10
10
  },
@@ -14,15 +14,18 @@
14
14
  "form-data",
15
15
  "uuid"
16
16
  ],
17
- "repository" : {
18
- "type":"git",
19
- "url":"https://github.com/dceejay/takreg/tree/master/"
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/dceejay/takreg/tree/master/"
20
20
  },
21
21
  "license": "Apache-2.0",
22
- "keywords": [ "TAK" ],
23
- "node-red" : {
22
+ "keywords": [
23
+ "TAK",
24
+ "node-red"
25
+ ],
26
+ "node-red": {
24
27
  "version": ">=2.0.0",
25
- "nodes" : {
28
+ "nodes": {
26
29
  "tak registration": "tak-registration.js"
27
30
  }
28
31
  },
@@ -13,7 +13,37 @@
13
13
  </div>
14
14
  <div class="form-row">
15
15
  <label for="node-input-group"><i class="fa fa-users"></i> Group</label>
16
- <input type="text" id="node-input-group" placeholder="Group (if any)">
16
+ <!-- <input type="text" id="node-input-group" placeholder="Group (if any)"> -->
17
+ <select id="node-input-group">
18
+ <option value="Cyan">Cyan</option>
19
+ <option value="Yellow">Yellow</option>
20
+ <option value="Red">Red</option>
21
+ <option value="Blue">Blue</option>
22
+ <option value="Green">Green</option>
23
+ <option value="Orange">Orange</option>
24
+ <option value="Magenta">Magenta</option>
25
+ <option value="Maroon">Maroon</option>
26
+ <option value="Purple">Purple</option>
27
+ <option value="Dark Blue">Dark Blue</option>
28
+ <option value="Dark Green">Dark Green</option>
29
+ <option value="Teal">Teal</option>
30
+ <option value="Brown">Brown</option>
31
+ </select>
32
+ </div>
33
+ <div class="form-row">
34
+ <label for="node-input-role"><i class="fa fa-crosshairs"></i> Role</label>
35
+ <!-- <input type="text" id="node-input-group" placeholder="Group (if any)"> -->
36
+ <select id="node-input-role">
37
+ <option value="Gateway">Gateway</option>
38
+ <option value="Team Member">Team Member</option>
39
+ <option value="Team Lead">Team Lead</option>
40
+ <option value="HQ">HQ</option>
41
+ <option value="Sniper">Sniper</option>
42
+ <option value="Medic">Medic</option>
43
+ <option value="Forward Observer">Forward Observer</option>
44
+ <option value="RTO">RTO</option>
45
+ <option value="K9">K9</option>
46
+ </select>
17
47
  </div>
18
48
  <div class="form-row" id="node-timing">
19
49
  <label for="node-once"><i class="fa fa-heartbeat"></i> Heartbeat</label>
@@ -23,7 +53,7 @@
23
53
  <option value="s">Seconds</option>
24
54
  <option value="m">Minutes</option>
25
55
  <option value="h">Hours</option>
26
- </select><br/>
56
+ </select>
27
57
  <input type="hidden" id="node-input-repeat">
28
58
  </div>
29
59
  <div class="form-row">
@@ -34,6 +64,9 @@
34
64
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
35
65
  <input type="text" id="node-input-name">
36
66
  </div>
67
+ <div class="form-tips" id="pin-tip"><b>Note</b>: This node MUST be used in conjunction with a TCP request node,
68
+ configured to point to your TAK server tcp address and port (usually 8087 or 8089), set to return strings,
69
+ <i>keep connection open</i> mode, and split on "&lt;/event&gt;"</div>
37
70
  </script>
38
71
  <style>
39
72
  .inject-time-count {
@@ -49,6 +82,7 @@
49
82
  name: {value:""},
50
83
  callsign: {value: ""},
51
84
  group: {value: "Cyan"},
85
+ role: {value: "Gateway"},
52
86
  latitude: {value: ""},
53
87
  longitude: {value: ""},
54
88
  repeat: {value:"60", validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 2147483))) }},
@@ -90,12 +124,13 @@
90
124
 
91
125
  <script type="text/html" data-help-name="tak registration">
92
126
  <p>Registers a TAK gateway node and sets up a heartbeat.</p>
93
- <p>This node must be used in conjunction with a TCP request node, set to point to the TAK server tcp address and port
127
+ <p>Works in conjunction with a TCP request node, set to point to the TAK server tcp address and port
94
128
  (usually 8087 or 8089), set to return strings, <i>keep connection open</i> mode, and split on <code>&lt;/event&gt;</code>.</p>
95
- <p>It can also accepts files to be sent to the TAK server by sending a msg as follows:</p>
96
- <h3>Inputs</h3>
129
+ <p>If the <code>msg.payload</code> is an XML string it will be passed directly though.</p>
130
+
131
+ <h3>Sending data packages...</h3>
97
132
  <dl class="message-properties">
98
- <dt>sendTo <span class="property-type">string|array</span></dt>
133
+ <dt>sendTo <span class="property-type">string | array</span></dt>
99
134
  <dd>can either be an individual TAK callsign, an array of callsigns, or <b>broadcast</b>
100
135
  to send to all users, or <b>public</b> to just upload the package to the TAK server.</dd>
101
136
  <dt>topic <span class="property-type">string</span></dt>
@@ -104,8 +139,23 @@
104
139
  <dd>each object must contain at least a <b>filename</b> (string) and <b>content</b> a buffer of the file/data.
105
140
  eg <code>[{filename:"foo.kml", content: &lt;buffer of the file&gt;}]</code></dd>
106
141
  </dl>
142
+ <h3>Sending marker position...</h3>
143
+ <dl class="message-properties">
144
+ <dt>payload <span class="property-type">object</span></dt>
145
+ <dd>a "standard" <b>node-red worldmap</b> format msg.payload containing `name, lat, lon, SIDC or cottype or aistype,
146
+ (alt), (speed), (bearing), (layer)`, where SIDC is the standard mil 2525C code, eg SFGPU, or cottype is the
147
+ CoT type, eg a-f-g-u, or aistype is the AIS type code, eg 80 for a tanker. The layer will get turned into a hashtag
148
+ which can then be selected on/off in the TAK app layers control.</dd>
149
+ </dl>
150
+
151
+ <h3>Updating gateway position...</h3>
152
+ <dl class="message-properties">
153
+ <dt>payload <span class="property-type">string | object</span></dt>
154
+ <dd>Either an NMEA string starting `$GPGGA`, for example from a locally attached serial GPS, or an object
155
+ containing `lat` and `lon` and optional `alt` properties (but no name property).</dd>
156
+ </dl>
107
157
  <h3>Details</h3>
108
158
  <p>This should work almost directly with messages received from an email-in node for example -
109
159
  but you will need to add the recipients in the sendTo property and may need to filter out
110
160
  unwanted messages first.</p>
111
- </script>
161
+ </script>