From 399a5bc15ea0989abcfbc0b59e782bf75d8d4c7f Mon Sep 17 00:00:00 2001 From: Derek Anderson Date: Fri, 10 May 2024 21:41:23 -0500 Subject: [PATCH] add both IPs to the CLI (#120) Signed-off-by: Derek Anderson --- src/commands/login/index.ts | 118 +++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 56 deletions(-) diff --git a/src/commands/login/index.ts b/src/commands/login/index.ts index 8e1200c..2374141 100644 --- a/src/commands/login/index.ts +++ b/src/commands/login/index.ts @@ -1,36 +1,36 @@ -import Chalk from "chalk" +import Chalk from "chalk"; import Fastify from "fastify"; import { getDb } from "../../store/db"; import { openInBrowser } from "../../lib/browser"; -import { getGatewayUrl, validateGatewayVersion } from "../../lib/urls" -import axios from "axios" +import { getGatewayUrl, validateGatewayVersion } from "../../lib/urls"; +import axios from "axios"; const portastic = require("portastic"); const clientId = "7ddcb826-e84a-4102-b95b-d9b8d3a57176"; const fastify = Fastify({ - // no logging to the console - logger: false, - //return jwt bigger than default - maxParamLength: 10000, + // no logging to the console + logger: false, + //return jwt bigger than default + maxParamLength: 10000, }); // we have the jwt, store it fastify.get("/token/:userId", async (request: any, reply: any) => { - const userId = request.params.userId; - const error = request.params.error; - getDb().set("config.token", userId).write(); + const userId = request.params.userId; + const error = request.params.error; + getDb().set("config.token", userId).write(); - if (error) { - console.log("Error when attempting to login"); - return; - } + if (error) { + console.log("Error when attempting to login"); + return; + } - reply.redirect("/complete"); + reply.redirect("/complete"); }); fastify.get("/complete", async (request: any, reply: any) => { - const html = ` + const html = `