node-red-contrib-remote 1.5.1 → 1.5.3

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/README.md CHANGED
@@ -36,9 +36,15 @@ You will find more information on [www.remote-red-com](https://www.remote-red.co
36
36
 
37
37
  ## Version History
38
38
 
39
+ Version 1.5.3
40
+ - Improved error logging while the instance registration process.
41
+
42
+ Version 1.5.2
43
+ - Compatibility to 'node-red-contrib-remote-cli'.
44
+
39
45
  Version 1.5.1
40
46
  - Added support for running Node-RED with a self signed https certificate.
41
- - Notifications and Questions will automatically convert values to string if a string is needed (e.g. title and body).
47
+ - Notifications and Questions will automatically convert values to string if a string is needed (e.g. title and body).
42
48
 
43
49
  Version 1.5.0
44
50
  - Geofencing! You can add geofences in the apps. Entering and leaving them will trigger a message on the new output of the remote access node.
@@ -34,16 +34,28 @@ module.exports = function(RED) {
34
34
  res.json(ipData);
35
35
  });
36
36
 
37
- RED.httpAdmin.get("/contrib-remote/requestInstanceHash/:region", RED.auth.needsPermission('remote-config.read'), function(req,res) {
37
+ RED.httpAdmin.get("/contrib-remote/requestInstanceHash/:regionorserver", RED.auth.needsPermission('remote-config.read'), function(req,res) {
38
38
  // Call API for a instacehash and a instanceauth
39
39
  const axiosInstance = commons.createAxiosInstance();
40
- console.log('https://contact-' + req.params.region + '.remote-red.com/instanceHashRequest')
41
- axiosInstance.post('https://contact-' + req.params.region + '.remote-red.com/instanceHashRequest', {})
40
+
41
+ // Region or server?
42
+ let url = '';
43
+ if (req.params.regionorserver.includes('.')) {
44
+ // server
45
+ url = 'https://api-' + req.params.regionorserver + '/instanceHashRequest';
46
+ } else {
47
+ // region
48
+ url = 'https://contact-' + req.params.regionorserver + '.remote-red.com/instanceHashRequest';
49
+ }
50
+
51
+ // Call API
52
+ axiosInstance.post(url, {})
42
53
  .then(response => {
43
54
  res.json(response.data);
44
55
  })
45
56
  .catch((error) => {
46
57
  console.log("ERROR: requestInstanceHash: " + error);
58
+ console.error(error);
47
59
  let errorMessage = error.message;
48
60
  if ( error.response && error.response.data && error.response.data.message ) {
49
61
  errorMessage = errorMessage + " / " + error.response.data.message;
@@ -56,11 +68,12 @@ module.exports = function(RED) {
56
68
  });
57
69
 
58
70
  RED.httpAdmin.post("/contrib-remote/registerApp", RED.auth.needsPermission('remote-config.read'), function(req,res) {
59
- // Call API for a instacehash and a instanceauth
71
+ // Call API for a appHash and password
60
72
  const axiosInstance = commons.createAxiosInstance();
61
73
  axiosInstance.post(`https://api-${req.body.server}/registerApp`, {
62
74
  'instancehash': req.body.instancehash,
63
- 'instanceauth': req.body.instanceauth
75
+ 'instanceauth': req.body.instanceauth,
76
+ 'customerhash': req.body.customerhash
64
77
  })
65
78
  .then(response => {
66
79
  var localip = req.body.host;
@@ -96,6 +109,7 @@ module.exports = function(RED) {
96
109
  })
97
110
  .catch((error) => {
98
111
  console.log("ERROR: registerApp: " + error);
112
+ console.error(error);
99
113
  let errorMessage = error.message;
100
114
  if ( error.response && error.response.data && error.response.data.message ) {
101
115
  errorMessage = errorMessage + " / " + error.response.data.message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-remote",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Remote-RED is an ecosystem to bring remote access, push notification and geofencing to Node-RED. There are also additional functions like directly answer on a notification and homescreen widgets.",
5
5
  "author": "Thorsten Heilmann",
6
6
  "license": "GPL-3.0",