mirror of
				https://git.coolaj86.com/coolaj86/telebit.js.git
				synced 2025-11-04 10:42:45 +00:00 
			
		
		
		
	allow port in remote client
This commit is contained in:
		
							parent
							
								
									a6e4bda317
								
							
						
					
					
						commit
						0bdaacb8aa
					
				@ -79,11 +79,19 @@ module.exports.create = function (state) {
 | 
			
		||||
      url += ('?_body=' + encodeURIComponent(json));
 | 
			
		||||
    }
 | 
			
		||||
    var method = opts.method || (args && 'POST') || 'GET';
 | 
			
		||||
    var req = http.request({
 | 
			
		||||
      socketPath: state._ipc.path
 | 
			
		||||
    , method: method
 | 
			
		||||
    var reqOpts = {
 | 
			
		||||
      method: method
 | 
			
		||||
    , path: url
 | 
			
		||||
    }, function (resp) {
 | 
			
		||||
    };
 | 
			
		||||
    var fs = require('fs');
 | 
			
		||||
    var portFile = path.join(path.dirname(state._ipc.path), 'telebit.port');
 | 
			
		||||
    if (fs.existsSync(portFile)) {
 | 
			
		||||
      reqOpts.host = 'localhost';
 | 
			
		||||
      reqOpts.port = parseInt(fs.readFileSync(portFile, 'utf8').trim(), 10);
 | 
			
		||||
    } else {
 | 
			
		||||
      reqOpts.socketPath = state._ipc.path;
 | 
			
		||||
    }
 | 
			
		||||
    var req = http.request(reqOpts, function (resp) {
 | 
			
		||||
      makeResponder(service, resp, fn);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user