@solarains/va-cli 0.1.2 → 0.1.3
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.
|
@@ -6,6 +6,14 @@ const auth_api_client_1 = require("../../features/auth/auth-api-client");
|
|
|
6
6
|
const browser_login_1 = require("../../features/auth/browser-login");
|
|
7
7
|
const installation_state_1 = require("../../features/auth/installation-state");
|
|
8
8
|
const AUTH_TIMEOUT_MS = 10 * 60 * 1000;
|
|
9
|
+
function formatBrowserOrigin(continuationUri) {
|
|
10
|
+
try {
|
|
11
|
+
return new URL(continuationUri).origin;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return continuationUri;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
9
17
|
function printFallbackInstructions(logger, continuationUri, callbackMode) {
|
|
10
18
|
(0, output_1.printSection)(logger, 'Browser continuation');
|
|
11
19
|
(0, output_1.printKeyValue)(logger, 'URL', continuationUri);
|
|
@@ -71,7 +79,8 @@ exports.loginCommand = {
|
|
|
71
79
|
}
|
|
72
80
|
(0, output_1.printSection)(context.logger, 'Login context');
|
|
73
81
|
(0, output_1.printList)(context.logger, [
|
|
74
|
-
`Account login is handled in the browser against ${
|
|
82
|
+
`Account login is handled in the browser against ${formatBrowserOrigin(session.continuationUri)}.`,
|
|
83
|
+
`API requests use ${context.runtimeConfig.apiBaseUrl}.`,
|
|
75
84
|
`Installation binding uses ${installation.installationId} on ${installation.clientPlatform}/${installation.clientArch}.`,
|
|
76
85
|
`Callback mode: ${callbackMode}.`,
|
|
77
86
|
]);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_API_BASE_URL = void 0;
|
|
3
4
|
exports.loadRuntimeConfig = loadRuntimeConfig;
|
|
4
5
|
exports.saveRuntimeConfig = saveRuntimeConfig;
|
|
5
6
|
const node_os_1 = require("node:os");
|
|
6
7
|
const promises_1 = require("node:fs/promises");
|
|
7
8
|
const node_path_1 = require("node:path");
|
|
8
9
|
const locale_1 = require("./locale");
|
|
10
|
+
exports.DEFAULT_API_BASE_URL = 'https://skills.api.dev.vizionalpha.com';
|
|
9
11
|
function parseBoolean(value) {
|
|
10
12
|
if (value === undefined) {
|
|
11
13
|
return undefined;
|
|
@@ -46,7 +48,7 @@ async function loadRuntimeConfig(env, paths) {
|
|
|
46
48
|
appEnv: env.VAONE_ENV ?? fileConfig.appEnv ?? 'local',
|
|
47
49
|
apiBaseUrl: normalizeHomePath(env.VAONE_API_BASE_URL ??
|
|
48
50
|
fileConfig.apiBaseUrl ??
|
|
49
|
-
|
|
51
|
+
exports.DEFAULT_API_BASE_URL).replace(/\/$/, ''),
|
|
50
52
|
debug: parseBoolean(env.VAONE_DEBUG) ?? fileConfig.debug ?? false,
|
|
51
53
|
authCallbackMode,
|
|
52
54
|
locale,
|
|
@@ -121,6 +121,9 @@ function getInitCopy(locale) {
|
|
|
121
121
|
summaryBrowser(value) {
|
|
122
122
|
return `浏览器状态: ${value}`;
|
|
123
123
|
},
|
|
124
|
+
summaryBrowserOrigin(value) {
|
|
125
|
+
return `浏览器地址: ${value}`;
|
|
126
|
+
},
|
|
124
127
|
summaryCallbackMode(value) {
|
|
125
128
|
return `回调模式: ${value}`;
|
|
126
129
|
},
|
|
@@ -279,6 +282,9 @@ function getInitCopy(locale) {
|
|
|
279
282
|
summaryBrowser(value) {
|
|
280
283
|
return `Browser: ${value}`;
|
|
281
284
|
},
|
|
285
|
+
summaryBrowserOrigin(value) {
|
|
286
|
+
return `Browser origin: ${value}`;
|
|
287
|
+
},
|
|
282
288
|
summaryCallbackMode(value) {
|
|
283
289
|
return `Callback mode: ${value}`;
|
|
284
290
|
},
|
|
@@ -69,6 +69,11 @@ function extractValue(lines, key) {
|
|
|
69
69
|
function extractLoginSummary(lines, copy) {
|
|
70
70
|
const summary = [];
|
|
71
71
|
const details = [];
|
|
72
|
+
const browserOrigin = lines
|
|
73
|
+
.find((line) => line.startsWith('Account login is handled in the browser against '))
|
|
74
|
+
?.replace('Account login is handled in the browser against ', '')
|
|
75
|
+
.replace(/\.$/, '')
|
|
76
|
+
.trim();
|
|
72
77
|
const browserLine = lines.find((line) => line.includes('Automatic browser launch failed') ||
|
|
73
78
|
line.includes('Browser opened'));
|
|
74
79
|
const callbackMode = extractValue(lines, 'Callback mode');
|
|
@@ -79,6 +84,9 @@ function extractLoginSummary(lines, copy) {
|
|
|
79
84
|
if (browserLine) {
|
|
80
85
|
summary.push(copy.messages.summaryBrowser(browserLine));
|
|
81
86
|
}
|
|
87
|
+
if (browserOrigin) {
|
|
88
|
+
summary.push(copy.messages.summaryBrowserOrigin(browserOrigin));
|
|
89
|
+
}
|
|
82
90
|
if (callbackMode) {
|
|
83
91
|
summary.push(copy.messages.summaryCallbackMode(callbackMode));
|
|
84
92
|
}
|