diff --git a/cli.js b/cli.js index 7cf53f4..59d014b 100755 --- a/cli.js +++ b/cli.js @@ -25,10 +25,6 @@ function fromAscii(str) { return "0x" + hex; }; -function encodeObject(obj) { - return fromAscii(JSON.stringify(obj)); -} - function makeSubscription(client, watch, relativePath, contactData) { sub = { expression: ["allof", ["match", "*.*"]], @@ -56,13 +52,13 @@ function makeSubscription(client, watch, relativePath, contactData) { }); url = "http://" + (cli.ip || defaultIp) + ":5561/dapp-changed"; - child.execSync("curl -X POST -H \"Content-Type: application/json\" -d '{\"encoded\": \"" + contactData + "\"}' " + url); + child.execSync("curl -X POST -H \"Content-Type: application/json\" -d '{\"encoded\": \"" + fromAscii(contactData) + "\"}' " + url); request({ url: "http://" + (cli.ip || defaultIp) + ":5561/dapp-changed", method: "POST", json: true, - body: { encoded: contactData } + body: { encoded: fromAscii(contactData) } }, function (error, response, body) { if (error) { printMan(); @@ -200,7 +196,7 @@ cli.command("watch [dir] [contact]") client, resp.watch, resp.relative_path, - encodeObject(contactData) + contactData ); } ); diff --git a/package.json b/package.json index e67be82..89c8c37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "status-dev-cli", - "version": "3.0.1", + "version": "3.0.2", "description": "CLI for Status", "main": "index.js", "bin": {