ngx-git 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +20 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ console.log = () => {};
|
|
|
19
19
|
require("dotenv").config();
|
|
20
20
|
console.log = _log;
|
|
21
21
|
|
|
22
|
-
const VERSION = "1.0.
|
|
22
|
+
const VERSION = "1.0.5";
|
|
23
23
|
const CONFIG_PATH = path.join(os.homedir(), ".ngxconfig");
|
|
24
24
|
const CB_PORT = 9988; // local callback server port for OAuth
|
|
25
25
|
|
|
@@ -539,6 +539,25 @@ const { flags, rest } = parseArgs(rawArgs || []);
|
|
|
539
539
|
console.log(`ngx ${VERSION}`);
|
|
540
540
|
break;
|
|
541
541
|
|
|
542
|
+
case "token":
|
|
543
|
+
if (!rest[0]) fatal("Usage: ngx token <JWT>");
|
|
544
|
+
|
|
545
|
+
try {
|
|
546
|
+
const decoded = JSON.parse(
|
|
547
|
+
Buffer.from(rest[0].split(".")[1], "base64").toString(),
|
|
548
|
+
);
|
|
549
|
+
|
|
550
|
+
const c = cfg();
|
|
551
|
+
c.token = rest[0];
|
|
552
|
+
c.username = decoded.username; // 🔥 fix
|
|
553
|
+
saveCfg(c);
|
|
554
|
+
|
|
555
|
+
ok(`Token saved for ${decoded.username}`);
|
|
556
|
+
} catch {
|
|
557
|
+
fatal("Invalid JWT token");
|
|
558
|
+
}
|
|
559
|
+
break;
|
|
560
|
+
|
|
542
561
|
case "login":
|
|
543
562
|
await doLogin();
|
|
544
563
|
break;
|