commit a13c883ba8623edc29fa42175e7047d19afc3fd9
parent 8985377c4bd344c76721dedeb27892e5a36d0378
Author: MTRNord <mtrnord1@gmail.com>
Date: Fri, 17 Jun 2016 21:52:36 +0200
Add changeGeo
Diffstat:
3 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/backend/commands.js b/backend/commands.js
@@ -40,7 +40,7 @@ export.modules[
sshclient.exec('uci commit gluon-node-info', cb);
})
});
- }.
+ },
activateMOL: function (ip, key) {
var opts = {
@@ -61,7 +61,7 @@ export.modules[
sshclient.exec('/etc/init.d/network restart', cb);
})
});
- }.
+ },
deactivateMOL: function (ip, key) {
var opts = {
@@ -82,7 +82,7 @@ export.modules[
sshclient.exec('/etc/init.d/network restart', cb);
})
});
- }.
+ },
activateMOW: function (ip, key) {
var opts = {
@@ -102,7 +102,7 @@ export.modules[
sshclient.exec('/etc/init.d/network restart', cb);
})
});
- }.
+ },
deactivateMOW: function (ip, key) {
var opts = {
@@ -122,5 +122,32 @@ export.modules[
sshclient.exec('/etc/init.d/network restart', cb);
})
});
+ },
+ changeGeo: function (ip, key, lat, long, alt, token) {
+ if (ccode === "ffnord" || ccode === "ffhh" || ccode === "ffhl" ||) {
+ //TODÃ’ Add formAPI
+ } else {
+ var opts = {
+
+ host: ip,
+ port: 22,
+ username: 'root',
+ privateKey: key,
+
+ debug: true, // optional
+ console: console // optional, allows logger overriding
+ };
+
+ sshclient.session(opts, _x(cb, true, function(err, ses) {
+ _x(null, false, function(cb) {
+ sshclient.exec('uci set gluon-node-info.@location[0].latitude=' + lat, cb);
+ sshclient.exec('uci set gluon-node-info.@location[0].longitude=' + long, cb);
+ sshclient.exec('uci set gluon-node-info.@location[0].altitude=' + alt, cb);
+ sshclient.exec('uci set gluon-node-info.@location[0].share_location=1', cb);
+ sshclient.exec('uci commit gluon-node-info', cb);
+ })
+ });
+ }
+
}
]
diff --git a/configs/config.json b/configs/config.json
@@ -1,4 +1,5 @@
{
"communityName": "Freifunk Nord",
+ "ccode": "ffnord",
"nodesJson": "https://mesh.nord.freifunk.net/data/nodes.json"
}
diff --git a/configs/schemas/config.json b/configs/schemas/config.json
@@ -4,6 +4,9 @@
"communityName": {
"type": "string"
},
+ "ccode": {
+ "type": "string"
+ },
"nodesJson": {
"type": "string",
"format": "uri"