node-red-contrib-tak-registration 0.1.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.
Files changed (195) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +35 -0
  3. package/node_modules/adm-zip/LICENSE +21 -0
  4. package/node_modules/adm-zip/README.md +65 -0
  5. package/node_modules/adm-zip/adm-zip.js +783 -0
  6. package/node_modules/adm-zip/headers/entryHeader.js +338 -0
  7. package/node_modules/adm-zip/headers/index.js +2 -0
  8. package/node_modules/adm-zip/headers/mainHeader.js +129 -0
  9. package/node_modules/adm-zip/methods/deflater.js +33 -0
  10. package/node_modules/adm-zip/methods/index.js +3 -0
  11. package/node_modules/adm-zip/methods/inflater.js +31 -0
  12. package/node_modules/adm-zip/methods/zipcrypto.js +170 -0
  13. package/node_modules/adm-zip/package.json +77 -0
  14. package/node_modules/adm-zip/util/constants.js +142 -0
  15. package/node_modules/adm-zip/util/errors.js +35 -0
  16. package/node_modules/adm-zip/util/fattr.js +79 -0
  17. package/node_modules/adm-zip/util/fileSystem.js +11 -0
  18. package/node_modules/adm-zip/util/index.js +4 -0
  19. package/node_modules/adm-zip/util/utils.js +246 -0
  20. package/node_modules/adm-zip/zipEntry.js +333 -0
  21. package/node_modules/adm-zip/zipFile.js +384 -0
  22. package/node_modules/asynckit/LICENSE +21 -0
  23. package/node_modules/asynckit/README.md +233 -0
  24. package/node_modules/asynckit/bench.js +76 -0
  25. package/node_modules/asynckit/index.js +6 -0
  26. package/node_modules/asynckit/lib/abort.js +29 -0
  27. package/node_modules/asynckit/lib/async.js +34 -0
  28. package/node_modules/asynckit/lib/defer.js +26 -0
  29. package/node_modules/asynckit/lib/iterate.js +75 -0
  30. package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  31. package/node_modules/asynckit/lib/readable_parallel.js +25 -0
  32. package/node_modules/asynckit/lib/readable_serial.js +25 -0
  33. package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  34. package/node_modules/asynckit/lib/state.js +37 -0
  35. package/node_modules/asynckit/lib/streamify.js +141 -0
  36. package/node_modules/asynckit/lib/terminator.js +29 -0
  37. package/node_modules/asynckit/package.json +91 -0
  38. package/node_modules/asynckit/parallel.js +43 -0
  39. package/node_modules/asynckit/serial.js +17 -0
  40. package/node_modules/asynckit/serialOrdered.js +75 -0
  41. package/node_modules/asynckit/stream.js +21 -0
  42. package/node_modules/axios/CHANGELOG.md +836 -0
  43. package/node_modules/axios/LICENSE +19 -0
  44. package/node_modules/axios/README.md +892 -0
  45. package/node_modules/axios/SECURITY.md +5 -0
  46. package/node_modules/axios/UPGRADE_GUIDE.md +162 -0
  47. package/node_modules/axios/dist/axios.js +2275 -0
  48. package/node_modules/axios/dist/axios.map +1 -0
  49. package/node_modules/axios/dist/axios.min.js +2 -0
  50. package/node_modules/axios/dist/axios.min.map +1 -0
  51. package/node_modules/axios/index.d.ts +206 -0
  52. package/node_modules/axios/index.js +1 -0
  53. package/node_modules/axios/lib/adapters/README.md +37 -0
  54. package/node_modules/axios/lib/adapters/http.js +363 -0
  55. package/node_modules/axios/lib/adapters/xhr.js +212 -0
  56. package/node_modules/axios/lib/axios.js +57 -0
  57. package/node_modules/axios/lib/cancel/Cancel.js +19 -0
  58. package/node_modules/axios/lib/cancel/CancelToken.js +119 -0
  59. package/node_modules/axios/lib/cancel/isCancel.js +5 -0
  60. package/node_modules/axios/lib/core/Axios.js +148 -0
  61. package/node_modules/axios/lib/core/InterceptorManager.js +54 -0
  62. package/node_modules/axios/lib/core/README.md +8 -0
  63. package/node_modules/axios/lib/core/buildFullPath.js +20 -0
  64. package/node_modules/axios/lib/core/createError.js +18 -0
  65. package/node_modules/axios/lib/core/dispatchRequest.js +87 -0
  66. package/node_modules/axios/lib/core/enhanceError.js +43 -0
  67. package/node_modules/axios/lib/core/mergeConfig.js +99 -0
  68. package/node_modules/axios/lib/core/settle.js +25 -0
  69. package/node_modules/axios/lib/core/transformData.js +22 -0
  70. package/node_modules/axios/lib/defaults.js +134 -0
  71. package/node_modules/axios/lib/env/README.md +3 -0
  72. package/node_modules/axios/lib/env/data.js +3 -0
  73. package/node_modules/axios/lib/helpers/README.md +7 -0
  74. package/node_modules/axios/lib/helpers/bind.js +11 -0
  75. package/node_modules/axios/lib/helpers/buildURL.js +70 -0
  76. package/node_modules/axios/lib/helpers/combineURLs.js +14 -0
  77. package/node_modules/axios/lib/helpers/cookies.js +53 -0
  78. package/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
  79. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
  80. package/node_modules/axios/lib/helpers/isAxiosError.js +11 -0
  81. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
  82. package/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
  83. package/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
  84. package/node_modules/axios/lib/helpers/spread.js +27 -0
  85. package/node_modules/axios/lib/helpers/validator.js +82 -0
  86. package/node_modules/axios/lib/utils.js +349 -0
  87. package/node_modules/axios/package.json +113 -0
  88. package/node_modules/axios/tsconfig.json +14 -0
  89. package/node_modules/axios/tslint.json +6 -0
  90. package/node_modules/combined-stream/License +19 -0
  91. package/node_modules/combined-stream/Readme.md +138 -0
  92. package/node_modules/combined-stream/lib/combined_stream.js +208 -0
  93. package/node_modules/combined-stream/package.json +57 -0
  94. package/node_modules/combined-stream/yarn.lock +17 -0
  95. package/node_modules/delayed-stream/.npmignore +1 -0
  96. package/node_modules/delayed-stream/License +19 -0
  97. package/node_modules/delayed-stream/Makefile +7 -0
  98. package/node_modules/delayed-stream/Readme.md +141 -0
  99. package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  100. package/node_modules/delayed-stream/package.json +62 -0
  101. package/node_modules/follow-redirects/LICENSE +18 -0
  102. package/node_modules/follow-redirects/README.md +148 -0
  103. package/node_modules/follow-redirects/debug.js +15 -0
  104. package/node_modules/follow-redirects/http.js +1 -0
  105. package/node_modules/follow-redirects/https.js +1 -0
  106. package/node_modules/follow-redirects/index.js +569 -0
  107. package/node_modules/follow-redirects/package.json +95 -0
  108. package/node_modules/form-data/License +19 -0
  109. package/node_modules/form-data/README.md.bak +358 -0
  110. package/node_modules/form-data/Readme.md +358 -0
  111. package/node_modules/form-data/index.d.ts +62 -0
  112. package/node_modules/form-data/lib/browser.js +2 -0
  113. package/node_modules/form-data/lib/form_data.js +501 -0
  114. package/node_modules/form-data/lib/populate.js +10 -0
  115. package/node_modules/form-data/package.json +101 -0
  116. package/node_modules/mime-db/HISTORY.md +499 -0
  117. package/node_modules/mime-db/LICENSE +22 -0
  118. package/node_modules/mime-db/README.md +100 -0
  119. package/node_modules/mime-db/db.json +8471 -0
  120. package/node_modules/mime-db/index.js +11 -0
  121. package/node_modules/mime-db/package.json +102 -0
  122. package/node_modules/mime-types/HISTORY.md +388 -0
  123. package/node_modules/mime-types/LICENSE +23 -0
  124. package/node_modules/mime-types/README.md +113 -0
  125. package/node_modules/mime-types/index.js +188 -0
  126. package/node_modules/mime-types/package.json +87 -0
  127. package/node_modules/uuid/CHANGELOG.md +229 -0
  128. package/node_modules/uuid/CONTRIBUTING.md +18 -0
  129. package/node_modules/uuid/LICENSE.md +9 -0
  130. package/node_modules/uuid/README.md +505 -0
  131. package/node_modules/uuid/dist/bin/uuid +2 -0
  132. package/node_modules/uuid/dist/esm-browser/index.js +9 -0
  133. package/node_modules/uuid/dist/esm-browser/md5.js +215 -0
  134. package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
  135. package/node_modules/uuid/dist/esm-browser/parse.js +35 -0
  136. package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  137. package/node_modules/uuid/dist/esm-browser/rng.js +19 -0
  138. package/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
  139. package/node_modules/uuid/dist/esm-browser/stringify.js +30 -0
  140. package/node_modules/uuid/dist/esm-browser/v1.js +95 -0
  141. package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
  142. package/node_modules/uuid/dist/esm-browser/v35.js +64 -0
  143. package/node_modules/uuid/dist/esm-browser/v4.js +24 -0
  144. package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
  145. package/node_modules/uuid/dist/esm-browser/validate.js +7 -0
  146. package/node_modules/uuid/dist/esm-browser/version.js +11 -0
  147. package/node_modules/uuid/dist/esm-node/index.js +9 -0
  148. package/node_modules/uuid/dist/esm-node/md5.js +13 -0
  149. package/node_modules/uuid/dist/esm-node/nil.js +1 -0
  150. package/node_modules/uuid/dist/esm-node/parse.js +35 -0
  151. package/node_modules/uuid/dist/esm-node/regex.js +1 -0
  152. package/node_modules/uuid/dist/esm-node/rng.js +12 -0
  153. package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
  154. package/node_modules/uuid/dist/esm-node/stringify.js +29 -0
  155. package/node_modules/uuid/dist/esm-node/v1.js +95 -0
  156. package/node_modules/uuid/dist/esm-node/v3.js +4 -0
  157. package/node_modules/uuid/dist/esm-node/v35.js +64 -0
  158. package/node_modules/uuid/dist/esm-node/v4.js +24 -0
  159. package/node_modules/uuid/dist/esm-node/v5.js +4 -0
  160. package/node_modules/uuid/dist/esm-node/validate.js +7 -0
  161. package/node_modules/uuid/dist/esm-node/version.js +11 -0
  162. package/node_modules/uuid/dist/index.js +79 -0
  163. package/node_modules/uuid/dist/md5-browser.js +223 -0
  164. package/node_modules/uuid/dist/md5.js +23 -0
  165. package/node_modules/uuid/dist/nil.js +8 -0
  166. package/node_modules/uuid/dist/parse.js +45 -0
  167. package/node_modules/uuid/dist/regex.js +8 -0
  168. package/node_modules/uuid/dist/rng-browser.js +26 -0
  169. package/node_modules/uuid/dist/rng.js +24 -0
  170. package/node_modules/uuid/dist/sha1-browser.js +104 -0
  171. package/node_modules/uuid/dist/sha1.js +23 -0
  172. package/node_modules/uuid/dist/stringify.js +39 -0
  173. package/node_modules/uuid/dist/umd/uuid.min.js +1 -0
  174. package/node_modules/uuid/dist/umd/uuidNIL.min.js +1 -0
  175. package/node_modules/uuid/dist/umd/uuidParse.min.js +1 -0
  176. package/node_modules/uuid/dist/umd/uuidStringify.min.js +1 -0
  177. package/node_modules/uuid/dist/umd/uuidValidate.min.js +1 -0
  178. package/node_modules/uuid/dist/umd/uuidVersion.min.js +1 -0
  179. package/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
  180. package/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
  181. package/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
  182. package/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
  183. package/node_modules/uuid/dist/uuid-bin.js +85 -0
  184. package/node_modules/uuid/dist/v1.js +107 -0
  185. package/node_modules/uuid/dist/v3.js +16 -0
  186. package/node_modules/uuid/dist/v35.js +78 -0
  187. package/node_modules/uuid/dist/v4.js +37 -0
  188. package/node_modules/uuid/dist/v5.js +16 -0
  189. package/node_modules/uuid/dist/validate.js +17 -0
  190. package/node_modules/uuid/dist/version.js +21 -0
  191. package/node_modules/uuid/package.json +164 -0
  192. package/node_modules/uuid/wrapper.mjs +10 -0
  193. package/package.json +32 -0
  194. package/tak-registration.html +111 -0
  195. package/tak-registration.js +169 -0
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _validate = _interopRequireDefault(require("./validate.js"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function version(uuid) {
13
+ if (!(0, _validate.default)(uuid)) {
14
+ throw TypeError('Invalid UUID');
15
+ }
16
+
17
+ return parseInt(uuid.substr(14, 1), 16);
18
+ }
19
+
20
+ var _default = version;
21
+ exports.default = _default;
@@ -0,0 +1,164 @@
1
+ {
2
+ "_from": "uuid@^8.3.2",
3
+ "_id": "uuid@8.3.2",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
6
+ "_location": "/node-red-contrib-takfiles/uuid",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "range",
10
+ "registry": true,
11
+ "raw": "uuid@^8.3.2",
12
+ "name": "uuid",
13
+ "escapedName": "uuid",
14
+ "rawSpec": "^8.3.2",
15
+ "saveSpec": null,
16
+ "fetchSpec": "^8.3.2"
17
+ },
18
+ "_requiredBy": [
19
+ "/node-red-contrib-takfiles"
20
+ ],
21
+ "_resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
22
+ "_shasum": "80d5b5ced271bb9af6c445f21a1a04c606cefbe2",
23
+ "_spec": "uuid@^8.3.2",
24
+ "_where": "/Users/conway/Projects/DCJNodes/takfile/",
25
+ "bin": {
26
+ "uuid": "dist/bin/uuid"
27
+ },
28
+ "browser": {
29
+ "./dist/md5.js": "./dist/md5-browser.js",
30
+ "./dist/rng.js": "./dist/rng-browser.js",
31
+ "./dist/sha1.js": "./dist/sha1-browser.js",
32
+ "./dist/esm-node/index.js": "./dist/esm-browser/index.js"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/uuidjs/uuid/issues"
36
+ },
37
+ "bundleDependencies": false,
38
+ "commitlint": {
39
+ "extends": [
40
+ "@commitlint/config-conventional"
41
+ ]
42
+ },
43
+ "deprecated": false,
44
+ "description": "RFC4122 (v1, v4, and v5) UUIDs",
45
+ "devDependencies": {
46
+ "@babel/cli": "7.11.6",
47
+ "@babel/core": "7.11.6",
48
+ "@babel/preset-env": "7.11.5",
49
+ "@commitlint/cli": "11.0.0",
50
+ "@commitlint/config-conventional": "11.0.0",
51
+ "@rollup/plugin-node-resolve": "9.0.0",
52
+ "babel-eslint": "10.1.0",
53
+ "bundlewatch": "0.3.1",
54
+ "eslint": "7.10.0",
55
+ "eslint-config-prettier": "6.12.0",
56
+ "eslint-config-standard": "14.1.1",
57
+ "eslint-plugin-import": "2.22.1",
58
+ "eslint-plugin-node": "11.1.0",
59
+ "eslint-plugin-prettier": "3.1.4",
60
+ "eslint-plugin-promise": "4.2.1",
61
+ "eslint-plugin-standard": "4.0.1",
62
+ "husky": "4.3.0",
63
+ "jest": "25.5.4",
64
+ "lint-staged": "10.4.0",
65
+ "npm-run-all": "4.1.5",
66
+ "optional-dev-dependency": "2.0.1",
67
+ "prettier": "2.1.2",
68
+ "random-seed": "0.3.0",
69
+ "rollup": "2.28.2",
70
+ "rollup-plugin-terser": "7.0.2",
71
+ "runmd": "1.3.2",
72
+ "standard-version": "9.0.0"
73
+ },
74
+ "exports": {
75
+ ".": {
76
+ "node": {
77
+ "module": "./dist/esm-node/index.js",
78
+ "require": "./dist/index.js",
79
+ "import": "./wrapper.mjs"
80
+ },
81
+ "default": "./dist/esm-browser/index.js"
82
+ },
83
+ "./package.json": "./package.json"
84
+ },
85
+ "files": [
86
+ "CHANGELOG.md",
87
+ "CONTRIBUTING.md",
88
+ "LICENSE.md",
89
+ "README.md",
90
+ "dist",
91
+ "wrapper.mjs"
92
+ ],
93
+ "homepage": "https://github.com/uuidjs/uuid#readme",
94
+ "husky": {
95
+ "hooks": {
96
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
97
+ "pre-commit": "lint-staged"
98
+ }
99
+ },
100
+ "keywords": [
101
+ "uuid",
102
+ "guid",
103
+ "rfc4122"
104
+ ],
105
+ "license": "MIT",
106
+ "lint-staged": {
107
+ "*.{js,jsx,json,md}": [
108
+ "prettier --write"
109
+ ],
110
+ "*.{js,jsx}": [
111
+ "eslint --fix"
112
+ ]
113
+ },
114
+ "main": "./dist/index.js",
115
+ "module": "./dist/esm-node/index.js",
116
+ "name": "uuid",
117
+ "optionalDevDependencies": {
118
+ "@wdio/browserstack-service": "6.4.0",
119
+ "@wdio/cli": "6.4.0",
120
+ "@wdio/jasmine-framework": "6.4.0",
121
+ "@wdio/local-runner": "6.4.0",
122
+ "@wdio/spec-reporter": "6.4.0",
123
+ "@wdio/static-server-service": "6.4.0",
124
+ "@wdio/sync": "6.4.0"
125
+ },
126
+ "repository": {
127
+ "type": "git",
128
+ "url": "git+https://github.com/uuidjs/uuid.git"
129
+ },
130
+ "scripts": {
131
+ "build": "./scripts/build.sh",
132
+ "bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json",
133
+ "docs": "( node --version | grep -q 'v12' ) && ( npm run build && runmd --output=README.md README_js.md )",
134
+ "docs:diff": "npm run docs && git diff --quiet README.md",
135
+ "eslint:check": "eslint src/ test/ examples/ *.js",
136
+ "eslint:fix": "eslint --fix src/ test/ examples/ *.js",
137
+ "examples:browser:rollup:build": "cd examples/browser-rollup && npm install && npm run build",
138
+ "examples:browser:webpack:build": "cd examples/browser-webpack && npm install && npm run build",
139
+ "examples:node:commonjs:test": "cd examples/node-commonjs && npm install && npm test",
140
+ "examples:node:esmodules:test": "cd examples/node-esmodules && npm install && npm test",
141
+ "lint": "npm run eslint:check && npm run prettier:check",
142
+ "md": "runmd --watch --output=README.md README_js.md",
143
+ "prepack": "npm run build",
144
+ "pretest": "[ -n $CI ] || npm run build",
145
+ "pretest:benchmark": "npm run build",
146
+ "pretest:browser": "optional-dev-dependency && npm run build && npm-run-all --parallel examples:browser:**",
147
+ "pretest:node": "npm run build",
148
+ "prettier:check": "prettier --ignore-path .prettierignore --check '**/*.{js,jsx,json,md}'",
149
+ "prettier:fix": "prettier --ignore-path .prettierignore --write '**/*.{js,jsx,json,md}'",
150
+ "release": "standard-version --no-verify",
151
+ "test": "BABEL_ENV=commonjs node --throw-deprecation node_modules/.bin/jest test/unit/",
152
+ "test:benchmark": "cd examples/benchmark && npm install && npm test",
153
+ "test:browser": "wdio run ./wdio.conf.js",
154
+ "test:node": "npm-run-all --parallel examples:node:**",
155
+ "test:pack": "./scripts/testpack.sh"
156
+ },
157
+ "sideEffects": false,
158
+ "standard-version": {
159
+ "scripts": {
160
+ "postchangelog": "prettier --write CHANGELOG.md"
161
+ }
162
+ },
163
+ "version": "8.3.2"
164
+ }
@@ -0,0 +1,10 @@
1
+ import uuid from './dist/index.js';
2
+ export const v1 = uuid.v1;
3
+ export const v3 = uuid.v3;
4
+ export const v4 = uuid.v4;
5
+ export const v5 = uuid.v5;
6
+ export const NIL = uuid.NIL;
7
+ export const version = uuid.version;
8
+ export const validate = uuid.validate;
9
+ export const stringify = uuid.stringify;
10
+ export const parse = uuid.parse;
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name" : "node-red-contrib-tak-registration",
3
+ "version" : "0.1.0",
4
+ "description" : "A Node-RED node to register to TAK and to help wrap files as datapackages to send to TAK",
5
+ "dependencies" : {
6
+ "adm-zip": "^0.5.9",
7
+ "axios": "^0.24.0",
8
+ "form-data": "^4.0.0",
9
+ "uuid": "^8.3.2"
10
+ },
11
+ "bundledDependencies": [
12
+ "adm-zip",
13
+ "axios",
14
+ "form-data",
15
+ "uuid"
16
+ ],
17
+ "repository" : {
18
+ "type":"git",
19
+ "url":"https://github.com/dceejay/takreg/tree/master/"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "keywords": [ "TAK" ],
23
+ "node-red" : {
24
+ "nodes" : {
25
+ "takfiles": "tak-registration.js"
26
+ }
27
+ },
28
+ "author": {
29
+ "name": "Dave Conway-Jones",
30
+ "email": "dceejay@gmail.com"
31
+ }
32
+ }
@@ -0,0 +1,111 @@
1
+ <script type="text/html" data-template-name="tak registration">
2
+ <div class="form-row">
3
+ <label for="node-input-latitude"><i class="fa fa-globe"></i> Latitude</label>
4
+ <input type="text" id="node-input-latitude" placeholder="degrees dd.ddddd">
5
+ </div>
6
+ <div class="form-row">
7
+ <label for="node-input-longitude"><i class="fa fa-globe"></i> Longitude</label>
8
+ <input type="text" id="node-input-longitude" placeholder="degrees dd.ddddd">
9
+ </div>
10
+ <div class="form-row">
11
+ <label for="node-input-callsign"><i class="fa fa-user-circle-o"></i> Callsign</label>
12
+ <input type="text" id="node-input-callsign" placeholder="Nickname">
13
+ </div>
14
+ <div class="form-row">
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)">
17
+ </div>
18
+ <div class="form-row" id="node-timing">
19
+ <label for="node-once"><i class="fa fa-heartbeat"></i> Heartbeat</label>
20
+ Send heartbeat every
21
+ <input id="inject-time-interval-count" class="inject-time-count" value="30" type="text"/>
22
+ <select style="width:100px" id="inject-time-interval-units">
23
+ <option value="s">Seconds</option>
24
+ <option value="m">Minutes</option>
25
+ <option value="h">Hours</option>
26
+ </select><br/>
27
+ <input type="hidden" id="node-input-repeat">
28
+ </div>
29
+ <div class="form-row">
30
+ <label for="node-input-dphost"><i class="fa fa-globe"></i> DP-Host url:port</label>
31
+ <input type="text" id="node-input-dphost" placeholder="Data package url http://server:port">
32
+ </div>
33
+ <div class="form-row">
34
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
35
+ <input type="text" id="node-input-name">
36
+ </div>
37
+ </script>
38
+ <style>
39
+ .inject-time-count {
40
+ width: 40px !important;
41
+ }
42
+ </style>
43
+
44
+ <script type="text/javascript">
45
+ RED.nodes.registerType('tak registration',{
46
+ category: 'location',
47
+ color:"#C0DEED",
48
+ defaults: {
49
+ name: {value:""},
50
+ callsign: {value: ""},
51
+ group: {value: "Cyan"},
52
+ latitude: {value: ""},
53
+ longitude: {value: ""},
54
+ repeat: {value:"60", validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 2147483))) }},
55
+ dphost: {value:""}
56
+ },
57
+ icon: "debug.png",
58
+ inputs: 1,
59
+ outputs: 1,
60
+ paletteLabel: "TAK gateway",
61
+ label: function() {
62
+ return "TAK gateway" || this.name;
63
+ },
64
+ oneditprepare: function() {
65
+ var r = "s";
66
+ var c = this.repeat;
67
+ if (this.repeat % 60 === 0) { r = "m"; c = c/60; }
68
+ if (this.repeat % 1440 === 0) { r = "h"; c = c/60; }
69
+ $("#inject-time-interval-count").val(c);
70
+ $("#inject-time-interval-units").val(r);
71
+ $("#inject-time-interval-days").prop("disabled","disabled");
72
+ },
73
+ oneditsave: function() {
74
+ var repeat = "";
75
+ var count = $("#inject-time-interval-count").val();
76
+ var units = $("#inject-time-interval-units").val();
77
+ if (units == "s") {
78
+ repeat = count;
79
+ } else {
80
+ if (units == "m") {
81
+ repeat = count * 60;
82
+ } else if (units == "h") {
83
+ repeat = count * 60 * 60;
84
+ }
85
+ }
86
+ $("#node-input-repeat").val(repeat);
87
+ }
88
+ });
89
+ </script>
90
+
91
+ <script type="text/html" data-help-name="tak registration">
92
+ <p>Registers a TAK gateway node and sets up a heartbeat.</p>
93
+ <p>Works in conjunction with a TCP request node, set to point to the TAK server tcp address and port
94
+ (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>
97
+ <dl class="message-properties">
98
+ <dt>sendTo <span class="property-type">string|array</span></dt>
99
+ <dd>can either be an individual TAK callsign, an array of callsigns, or <b>broadcast</b>
100
+ to send to all users, or <b>public</b> to just upload the package to the TAK server.</dd>
101
+ <dt>topic <span class="property-type">string</span></dt>
102
+ <dd>the overall package name - IE what you want it to be called on the TAK device (keep it short).</dd>
103
+ <dt>attachments <span class="property-type">array of objects</span></dt>
104
+ <dd>each object must contain at least a <b>filename</b> (string) and <b>content</b> a buffer of the file/data.
105
+ eg <code>[{filename:"foo.kml", content: &lt;buffer of the file&gt;}]</code></dd>
106
+ </dl>
107
+ <h3>Details</h3>
108
+ <p>This should work almost directly with messages received from an email-in node for example -
109
+ but you will need to add the recipients in the sendTo property and may need to filter out
110
+ unwanted messages first.</p>
111
+ </script>
@@ -0,0 +1,169 @@
1
+
2
+ module.exports = function(RED) {
3
+ "use strict";
4
+ const os = require('os');
5
+ const AdmZip = require('adm-zip');
6
+ const axios = require('axios').default;
7
+ const crypto = require("crypto");
8
+ const FormData = require('form-data')
9
+ const { v4: uuidv4 } = require('uuid');
10
+ const uuid = require('uuid');
11
+
12
+ function TakRegistrationNode(n) {
13
+ RED.nodes.createNode(this,n);
14
+ this.group = n.group;
15
+ this.lat = n.latitude;
16
+ this.lon = n.longitude;
17
+ this.callsign = n.callsign;
18
+ this.repeat = n.repeat;
19
+ this.host = n.dphost;
20
+ this.uuid = "GATEWAY-"+(crypto.createHash('md5').update(Buffer.from(os.hostname())).digest('hex')).slice(0,16);
21
+ var node = this;
22
+
23
+ if (node.repeat > 2147483) {
24
+ node.error("TAK Heartbeat interval is too long.");
25
+ delete node.repeat;
26
+ }
27
+
28
+ var sendIt = function() {
29
+ node.emit("input", {
30
+ time: new Date().toISOString(),
31
+ etime: new Date(Date.now() + 2000 * node.repeat).toISOString(),
32
+ lat: node.lat,
33
+ lon: node.lon,
34
+ callsign: node.callsign,
35
+ group: node.group,
36
+ heartbeat: true
37
+ });
38
+ };
39
+
40
+ node.repeaterSetup = function () {
41
+ node.repeat = node.repeat * 1000;
42
+ if (RED.settings.verbose) {
43
+ node.log(RED._("inject.repeat", node));
44
+ }
45
+ node.interval_id = setInterval(sendIt, node.repeat);
46
+ };
47
+
48
+ node.repeaterSetup();
49
+ setTimeout(sendIt, 2000);
50
+
51
+ this.on("input",function(msg) {
52
+ if (msg.heartbeat) { // Register gateway and do the heartbeats
53
+ var template = `<event version="2.0" uid="${node.uuid}" type="a-f-G-I-B" how="h-e" time="${msg.time}" start="${msg.time}" stale="${msg.etime}"><point lat="${msg.lat}" lon="${msg.lon}" hae="9999999" ce="9999999" le="9999999"/><detail><takv os="${os.platform()}" version="4.1.0.231" device="${os.hostname()}" platform="ATAK-CIV"/><contact endpoint="*:-1:stcp" callsign="${msg.callsign}"/><uid Droid="${msg.callsign}"/><__group name="${msg.group}" role="Gateway"/><status battery="99"/></detail></event>`;
54
+ node.send({payload:template});
55
+ node.status({fill:"green", shape:"dot", text: node.repeat/1000+"s - "+node.callsign});
56
+ return;
57
+ }
58
+ // If there are attachments handle them first.
59
+ if (msg.hasOwnProperty("attachments") && Array.isArray(msg.attachments) && msg.attachments.length > 0) {
60
+ if (!msg.sendTo) { node.error("Missing 'sendTo' user TAK callsign property.",msg); return; }
61
+ var UUID = uuid.v5(msg.topic,'d5d4a57d-48fb-58b6-93b8-d9fde658481a');
62
+ var fnam = msg.topic;
63
+ var fname = msg.topic+'.zip';
64
+ var mf = `<MissionPackageManifest version="2"><Configuration>
65
+ <Parameter name="uid" value="${UUID}"/>
66
+ <Parameter name="name" value="${msg.topic}"/>
67
+ </Configuration><Contents>`;
68
+ var zip = new AdmZip();
69
+ for (var i=0; i < msg.attachments.length; i++) {
70
+ var data;
71
+ if (Buffer.isBuffer(msg.attachments[i].content)) {
72
+ data = msg.attachments[i].content;
73
+ }
74
+ else if (Array.isArray(msg.attachments[i].content)) {
75
+ data = Buffer.from(msg.attachments[i].content);
76
+ }
77
+ else if (!Array.isArray(msg.attachments[i].content) && msg.attachments[i].content.hasOwnProperty("data")) {
78
+ data = Buffer.from(msg.attachments[i].content.data);
79
+ }
80
+ var hash = crypto.createHash('md5').update(data).digest('hex');
81
+ var fhash = hash + '/' + msg.attachments[i].filename;
82
+ zip.addFile(fhash, data, "Added by Node-RED");
83
+ mf +=`<Content ignore="false" zipEntry="${fhash}" />`;
84
+ }
85
+ mf +=`</Contents></MissionPackageManifest>`;
86
+ mf = mf.replace(/>\s+</g, "><");
87
+ zip.addFile('MANIFEST/manifest.xml', Buffer.from(mf,'utf8'), msg.topic);
88
+ var zipbuff = zip.toBuffer();
89
+ //zip.writeZip("/tmp/takfile")
90
+
91
+ msg = {
92
+ from: node.callsign || msg.from || "Anonymous",
93
+ sendTo: msg.sendTo,
94
+ lat: node.lat || msg.lat || 0,
95
+ lon: node.lon || msg.lon || 0,
96
+ assetfile: fname,
97
+ len: zipbuff.length,
98
+ uid: node.uuid,
99
+ hash: crypto.createHash('sha256').update(zipbuff).digest('hex')
100
+ }
101
+
102
+ let formData = new FormData();
103
+ const opts = { filename:fname, contentType:'application/x-zip-compressed' };
104
+ formData.append('assetfile', zipbuff, opts);
105
+
106
+ const url = encodeURI(node.host+'/Marti/sync/missionupload?hash='+msg.hash+'&filename='+fname+'&creatorUid='+node.uuid);
107
+ axios({
108
+ method: 'post',
109
+ url: url,
110
+ headers: formData.getHeaders(),
111
+ data: formData
112
+ })
113
+ .then(function (response) {
114
+ const urlp = encodeURI(node.host+'/Marti/api/sync/metadata/'+msg.hash+'/tool');
115
+ var priv = (msg.sendTo === "public") ? "public" : "private";
116
+ axios({
117
+ method: 'put',
118
+ url: urlp,
119
+ data: priv
120
+ })
121
+ .then(function (response) {
122
+ if (priv === "private") {
123
+ const start = new Date().toISOString();
124
+ const stale = new Date(new Date().getTime() + (10000)).toISOString();
125
+
126
+ var m = `<event version="2.0" uid="${uuidv4()}" type="b-f-t-r" how="h-e" time="${start}" start="${start}" stale="${stale}">
127
+ <point lat="${msg.lat}" lon="${msg.lon}" hae="9999999" ce="9999999" le="9999999" />
128
+ <detail>
129
+ <fileshare filename="${fname}" senderUrl="${node.host}/Marti/sync/content?hash=${msg.hash}" sizeInBytes="${msg.len}" sha256="${msg.hash}" senderUid="${msg.uid}" senderCallsign="${msg.from}" name="${fnam}" />`
130
+ if (msg.sendTo !== "broadcast") {
131
+ var t = msg.sendTo;
132
+ if (!Array.isArray(t)) { t = [ t ]; }
133
+ m += '<marti>' + t.map(v => '<dest callsign="' + v +'"/>') + '</marti>';
134
+ }
135
+ m += '</detail></event>';
136
+ node.log( "DP: " + node.host + "/Marti/sync/content?hash=" + msg.hash );
137
+ msg.payload = m.replace(/>\s+</g, "><");
138
+ node.send(msg);
139
+ }
140
+ })
141
+ .catch(function (error) {
142
+ node.error(error.message,error);
143
+ })
144
+ })
145
+ .catch(function (error) {
146
+ node.error(error.message,error);
147
+ })
148
+ }
149
+ else if (typeof msg.payload === "string") { // Assume it's proper XML event so pass straight through
150
+ if (msg.payload.trim().startsWith('<') && msg.payload.trim().endsWith('>')) {
151
+ node.send(msg);
152
+ }
153
+ }
154
+ else { // Drop anything we don't handle yet.
155
+ node.log("Dropped: "+JSON.stringify(msg.payload));
156
+ }
157
+ });
158
+
159
+ this.on("close", function() {
160
+ // var tim = new Date().toISOString();
161
+ // var template = `<?xml version="1.0" encoding="utf-8" standalone="yes"?><event version="2.0" uid="${node.uuid}" type="t-x-d-d" how="h-g-i-g-o" time="${tim}" start="${tim}" stale="${tim}"><detail><link uid="${node.uuid}" relation="p-p" type="a-f-G-I-B" /></detail><point le="9999999.0" ce="9999999.0" hae="9999999.0" lon="0" lat="0" /></event>"`;
162
+ // node.send({payload:template}); // This never happens in time so not useful
163
+ clearInterval(this.interval_id);
164
+ if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
165
+ });
166
+ }
167
+
168
+ RED.nodes.registerType("tak registration",TakRegistrationNode);
169
+ };