MAJOR: Updates for Authenticated Web UI and CLI #30
| @ -123,13 +123,10 @@ function askForConfig(state, mainCb) { | ||||
|             return; | ||||
|           } | ||||
|           if (200 !== resp.statusCode || (Buffer.isBuffer(body) || 'object' !== typeof body) || !body.api_host) { | ||||
|             console.warn("==================="); | ||||
|             console.warn("      WARNING      "); | ||||
|             console.warn("==================="); | ||||
|             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(TPLS.remote.setup.fail_relay_check | ||||
|               .replace(/{{\s*status_code\s*}}/, resp.statusCode) | ||||
|               .replace(/{{\s*url\s*}}/, urlstr) | ||||
|             ); | ||||
|             console.warn(body); | ||||
|           } else if (body && body.pair_request) { | ||||
|             state._can_pair = true; | ||||
| @ -158,7 +155,7 @@ function askForConfig(state, mainCb) { | ||||
|     } | ||||
|   ]; | ||||
|   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
 | ||||
|     function askAgree(cb) { | ||||
|       if (state.config.agreeTos) { cb(); return; } | ||||
|  | ||||
| @ -400,6 +400,12 @@ function handleApi(req, res) { | ||||
|       res.end('{"error":{"message":"module \'init\' needs more arguments"}}'); | ||||
|       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
 | ||||
|     //
 | ||||
|     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: | ||||
| " | ||||
| 
 | ||||
| fail_relay_check = "=================== | ||||
|       WARNING | ||||
| =================== | ||||
| 
 | ||||
| [{{status_code}}] '{{url}}' | ||||
| This server does not describe a current telebit version (but it may still work). | ||||
| " | ||||
| 
 | ||||
| [daemon] | ||||
| version = "telebit daemon v{version}" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user