From 5491b8d91d28b1c48db9f2b1006f8214d4937b18 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 21 Jun 2018 18:56:36 +0000 Subject: [PATCH] allow older relay versions, with warning --- bin/telebit.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/bin/telebit.js b/bin/telebit.js index 177af73..3f1bf0c 100755 --- a/bin/telebit.js +++ b/bin/telebit.js @@ -149,24 +149,10 @@ function askForConfig(answers, mainCb) { askRelay(cb); return; } - if (200 !== resp.statusCode) { - console.error("[" + resp.statusCode + " Error] Failed to retrieve '" + urlstr + "'"); - askRelay(cb); - return; - } - if (Buffer.isBuffer(body) || 'object' !== typeof body) { - console.error("[Parse Error] Failed to retrieve '" + urlstr + "'"); - console.error(body); - askRelay(cb); - return; - } - if (!body.api_host) { - console.error("[API Error] API Index '" + urlstr + "' does not describe a known version of telebit.cloud"); - console.error(e); - askRelay(cb); - return; - } - if (body.pair_request) { + if (200 !== resp.statusCode || (Buffer.isBuffer(body) || 'object' !== typeof body) || !body.api_host) { + console.warn("[" + resp.statusCode + " Warning] '" + urlstr + "' does not describe a current telebit version."); + console.warn(body); + } else if (body && body.pair_request) { answers._can_pair = true; } answers.relay = relay;