diff --git a/bin/telebit-remote.js b/bin/telebit-remote.js index c7d28ed..9cf37b0 100755 --- a/bin/telebit-remote.js +++ b/bin/telebit-remote.js @@ -548,7 +548,9 @@ function parseConfig(err, text) { } } else if ('status' === body.module) { // TODO funny one this one - console.info('http://localhost:' + (body.port || state.config.ipc.port)); + if (body.port) { + console.info('http://localhost:' + (body.port)); + } console.info(JSON.stringify(body, null, 2)); } else { console.info(JSON.stringify(body, null, 2)); diff --git a/bin/telebitd.js b/bin/telebitd.js index 1d72074..cbbaf74 100755 --- a/bin/telebitd.js +++ b/bin/telebitd.js @@ -589,6 +589,7 @@ function handleApi(req, res) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify( { module: 'status' + , port: (state.config.ipc && state.config.ipc.port || state._ipc.port || undefined) , status: (state.config.disable ? 'disabled' : 'enabled') , ready: ((state.config.relay && (state.config.token || state.config.agreeTos)) ? true : false) , active: !!myRemote diff --git a/lib/rc/index.js b/lib/rc/index.js index c3b8fe0..fd6da53 100644 --- a/lib/rc/index.js +++ b/lib/rc/index.js @@ -88,12 +88,12 @@ module.exports.create = function (state) { if (fs.existsSync(portFile)) { reqOpts.host = 'localhost'; reqOpts.port = parseInt(fs.readFileSync(portFile, 'utf8').trim(), 10); - if (!state.config.ipc) { - state.config.ipc = {}; + if (!state.ipc) { + state.ipc = {}; } - state.config.ipc.type = 'port'; - state.config.ipc.path = path.dirname(state._ipc.path); - state.config.ipc.port = reqOpts.port; + state.ipc.type = 'port'; + state.ipc.path = path.dirname(state._ipc.path); + state.ipc.port = reqOpts.port; } else { reqOpts.socketPath = state._ipc.path; }