This commit is contained in:
AJ ONeal 2018-10-15 22:17:10 -06:00
rodič 311e82b9b6
revize 66758f4dbf
3 změnil soubory, kde provedl 9 přidání a 6 odebrání

Zobrazit soubor

@ -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));

Zobrazit soubor

@ -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

Zobrazit soubor

@ -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;
}