From 075342920d3c4c400cf7d2d1c756a61ef3194c5f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Oct 2018 04:10:39 -0600 Subject: [PATCH] fixes... --- lib/admin/js/telebit-token.js | 6 +++--- lib/admin/js/telebit.js | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/admin/js/telebit-token.js b/lib/admin/js/telebit-token.js index 4b09245..2cb3204 100644 --- a/lib/admin/js/telebit-token.js +++ b/lib/admin/js/telebit-token.js @@ -47,7 +47,7 @@ common.authorize = common.getToken = function getToken(state) { state.config.pretoken = pretoken; state._connecting = true; - return common.reqLocalAsync({ url: '/api/config', method: 'POST', data: state.config || {} }).then(function () { + return common.reqLocalAsync({ url: '/api/config', method: 'POST', body: state.config }).then(function () { console.info("waiting..."); return PromiseA.resolve(); }).catch(function (err) { @@ -77,7 +77,7 @@ common.authorize = common.getToken = function getToken(state) { } catch(e) { console.warn("[warning] could not decode token"); } - return common.reqLocalAsync({ url: '/api/config', method: 'POST', data: state.config }).then(function () { + return common.reqLocalAsync({ url: '/api/config', method: 'POST', body: state.config }).then(function () { //console.log("Pairing Enabled Locally"); return PromiseA.resolve(); }).catch(function (err) { @@ -92,7 +92,7 @@ common.authorize = common.getToken = function getToken(state) { return PromiseA.resolve(); } , end: function () { - return common.reqLocalAsync({ url: '/api/enable', method: 'POST', data: [] }).then(function () { + return common.reqLocalAsync({ url: '/api/enable', method: 'POST', body: [] }).then(function () { console.info("Success"); // workaround for https://github.com/nodejs/node/issues/21319 diff --git a/lib/admin/js/telebit.js b/lib/admin/js/telebit.js index 6747e83..e6c8907 100644 --- a/lib/admin/js/telebit.js +++ b/lib/admin/js/telebit.js @@ -226,9 +226,12 @@ common.api.token = function (state, handlers) { , hostname: pairRequestUrl.hostname , href: pairRequestUrl.href , pathname: pairRequestUrl.pathname - , port: pairRequestUrl.port + // because why wouldn't node require 'path' on a json object and accept 'pathname' on a URL object... + // https://twitter.com/coolaj86/status/1053947919890403328 + , path: pairRequestUrl.pathname + , port: pairRequestUrl.port || null , protocol: pairRequestUrl.protocol - , search: pairRequestUrl.search + , search: pairRequestUrl.search || null } , method: dir.pair_request.method , json: authReq