MAJOR: Updates for Authenticated Web UI and CLI #30
| @ -548,7 +548,9 @@ function parseConfig(err, text) { | |||||||
|           } |           } | ||||||
|         } else if ('status' === body.module) { |         } else if ('status' === body.module) { | ||||||
|           // TODO funny one this one
 |           // 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)); |           console.info(JSON.stringify(body, null, 2)); | ||||||
|         } else { |         } else { | ||||||
|           console.info(JSON.stringify(body, null, 2)); |           console.info(JSON.stringify(body, null, 2)); | ||||||
|  | |||||||
| @ -589,6 +589,7 @@ function handleApi(req, res) { | |||||||
|     res.setHeader('Content-Type', 'application/json'); |     res.setHeader('Content-Type', 'application/json'); | ||||||
|     res.end(JSON.stringify( |     res.end(JSON.stringify( | ||||||
|       { module: 'status' |       { module: 'status' | ||||||
|  |       , port: (state.config.ipc && state.config.ipc.port || state._ipc.port || undefined) | ||||||
|       , status: (state.config.disable ? 'disabled' : 'enabled') |       , status: (state.config.disable ? 'disabled' : 'enabled') | ||||||
|       , ready: ((state.config.relay && (state.config.token || state.config.agreeTos)) ? true : false) |       , ready: ((state.config.relay && (state.config.token || state.config.agreeTos)) ? true : false) | ||||||
|       , active: !!myRemote |       , active: !!myRemote | ||||||
|  | |||||||
| @ -88,12 +88,12 @@ module.exports.create = function (state) { | |||||||
|     if (fs.existsSync(portFile)) { |     if (fs.existsSync(portFile)) { | ||||||
|       reqOpts.host = 'localhost'; |       reqOpts.host = 'localhost'; | ||||||
|       reqOpts.port = parseInt(fs.readFileSync(portFile, 'utf8').trim(), 10); |       reqOpts.port = parseInt(fs.readFileSync(portFile, 'utf8').trim(), 10); | ||||||
|       if (!state.config.ipc) { |       if (!state.ipc) { | ||||||
|         state.config.ipc = {}; |         state.ipc = {}; | ||||||
|       } |       } | ||||||
|       state.config.ipc.type = 'port'; |       state.ipc.type = 'port'; | ||||||
|       state.config.ipc.path = path.dirname(state._ipc.path); |       state.ipc.path = path.dirname(state._ipc.path); | ||||||
|       state.config.ipc.port = reqOpts.port; |       state.ipc.port = reqOpts.port; | ||||||
|     } else { |     } else { | ||||||
|       reqOpts.socketPath = state._ipc.path; |       reqOpts.socketPath = state._ipc.path; | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user