MAJOR: Updates for Authenticated Web UI and CLI #30
| @ -123,13 +123,10 @@ function askForConfig(state, mainCb) { | |||||||
|             return; |             return; | ||||||
|           } |           } | ||||||
|           if (200 !== resp.statusCode || (Buffer.isBuffer(body) || 'object' !== typeof body) || !body.api_host) { |           if (200 !== resp.statusCode || (Buffer.isBuffer(body) || 'object' !== typeof body) || !body.api_host) { | ||||||
|             console.warn("==================="); |             console.warn(TPLS.remote.setup.fail_relay_check | ||||||
|             console.warn("      WARNING      "); |               .replace(/{{\s*status_code\s*}}/, resp.statusCode) | ||||||
|             console.warn("==================="); |               .replace(/{{\s*url\s*}}/, urlstr) | ||||||
|             console.warn(""); |             ); | ||||||
|             console.warn("[" + resp.statusCode + "] '" + urlstr + "'"); |  | ||||||
|             console.warn("This server does not describe a current telebit version (but it may still work)."); |  | ||||||
|             console.warn(""); |  | ||||||
|             console.warn(body); |             console.warn(body); | ||||||
|           } else if (body && body.pair_request) { |           } else if (body && body.pair_request) { | ||||||
|             state._can_pair = true; |             state._can_pair = true; | ||||||
| @ -158,7 +155,7 @@ function askForConfig(state, mainCb) { | |||||||
|     } |     } | ||||||
|   ]; |   ]; | ||||||
|   var standardSet = [ |   var standardSet = [ | ||||||
|     // There are questions that we need to aks in the CLI
 |     // There are questions that we need to ask in the CLI
 | ||||||
|     // if we can't guarantee that they are being asked in the web interface
 |     // if we can't guarantee that they are being asked in the web interface
 | ||||||
|     function askAgree(cb) { |     function askAgree(cb) { | ||||||
|       if (state.config.agreeTos) { cb(); return; } |       if (state.config.agreeTos) { cb(); return; } | ||||||
|  | |||||||
| @ -400,6 +400,12 @@ function handleApi(req, res) { | |||||||
|       res.end('{"error":{"message":"module \'init\' needs more arguments"}}'); |       res.end('{"error":{"message":"module \'init\' needs more arguments"}}'); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |     if (!Array.isArray(opts.body)) { | ||||||
|  |       // TODO
 | ||||||
|  |       res.statusCode = 500; | ||||||
|  |       res.end('{"error":{"message":"[internal error (our fault)] module \'init\' expected an array"}}'); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     // relay, email, agree_tos, servernames, ports
 |     // relay, email, agree_tos, servernames, ports
 | ||||||
|     //
 |     //
 | ||||||
|     opts.body.forEach(function (opt) { |     opts.body.forEach(function (opt) { | ||||||
|  | |||||||
| @ -476,5 +476,13 @@ By using Telebit you agree to: | |||||||
| Enter your email to agree and login/create your account: | Enter your email to agree and login/create your account: | ||||||
| " | " | ||||||
| 
 | 
 | ||||||
|  | fail_relay_check = "=================== | ||||||
|  |       WARNING | ||||||
|  | =================== | ||||||
|  | 
 | ||||||
|  | [{{status_code}}] '{{url}}' | ||||||
|  | This server does not describe a current telebit version (but it may still work). | ||||||
|  | " | ||||||
|  | 
 | ||||||
| [daemon] | [daemon] | ||||||
| version = "telebit daemon v{version}" | version = "telebit daemon v{version}" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user