sitevision-cli 1.0.0-beta.17 → 1.0.0-beta.18
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/dist/components/AuthLoginScreen.js +3 -1
- package/dist/shell/ConfigForm.js +9 -3
- package/dist/utils/i18n.js +6 -0
- package/dist/utils/project-detection.d.ts +2 -0
- package/dist/utils/project-detection.js +14 -1
- package/dist/utils/session-cookie-auth.d.ts +1 -0
- package/dist/utils/session-cookie-auth.js +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ export function AuthLoginScreen({ method, devProperties, onComplete, onError, on
|
|
|
15
15
|
const [phase, setPhase] = React.useState('starting');
|
|
16
16
|
const [authUrl, setAuthUrl] = React.useState('');
|
|
17
17
|
const [note, setNote] = React.useState('');
|
|
18
|
+
const [loginUrl, setLoginUrl] = React.useState('');
|
|
18
19
|
const cookieRef = React.useRef(null);
|
|
19
20
|
const cancelOAuthRef = React.useRef(null);
|
|
20
21
|
React.useEffect(() => {
|
|
@@ -45,6 +46,7 @@ export function AuthLoginScreen({ method, devProperties, onComplete, onError, on
|
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
cookieRef.current = session;
|
|
49
|
+
setLoginUrl(session.loginUrl);
|
|
48
50
|
setPhase('awaiting');
|
|
49
51
|
}
|
|
50
52
|
})();
|
|
@@ -84,5 +86,5 @@ export function AuthLoginScreen({ method, devProperties, onComplete, onError, on
|
|
|
84
86
|
})();
|
|
85
87
|
}
|
|
86
88
|
});
|
|
87
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, color: "cyan", children: method === 'oauth2' ? t('OAuth2 login') : t('Session cookie login') }) }), method === 'oauth2' ? (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "green", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { children: [" ", t('Waiting for you to finish login in the browser…')] })] }), authUrl && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: t("If the browser didn't open, visit:") }), _jsx(Text, { children: authUrl })] }))] })) : (_jsxs(Box, { flexDirection: "column", children: [phase === 'starting' && (_jsxs(Box, { children: [_jsx(Text, { color: "green", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { children: [" ", t('Opening browser…')] })] })), phase === 'awaiting' && (_jsx(Text, { children: t('Log in
|
|
89
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, color: "cyan", children: method === 'oauth2' ? t('OAuth2 login') : t('Session cookie login') }) }), method === 'oauth2' ? (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "green", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { children: [" ", t('Waiting for you to finish login in the browser…')] })] }), authUrl && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: t("If the browser didn't open, visit:") }), _jsx(Text, { children: authUrl })] }))] })) : (_jsxs(Box, { flexDirection: "column", children: [phase === 'starting' && (_jsxs(Box, { children: [_jsx(Text, { color: "green", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { children: [" ", t('Opening browser…')] })] })), phase === 'awaiting' && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: t('A Chrome window is open at:') }), _jsx(Text, { color: "cyan", children: loginUrl }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { children: t('1. Log in to the site there, single sign-on included.') }), _jsx(Text, { children: t('2. Wait until the site itself has finished loading.') }), _jsx(Text, { children: t('3. Come back here and press Enter.') })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: t('Leave the browser window open; it closes once the session is captured.') }) })] })), phase === 'capturing' && (_jsxs(Box, { children: [_jsx(Text, { color: "green", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { children: [" ", t('Capturing session…')] })] })), note && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "yellow", children: note }) }))] })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: t('Press Esc to cancel.') }) })] }));
|
|
88
90
|
}
|
package/dist/shell/ConfigForm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Box, Text, useInput } from 'ink';
|
|
4
|
-
import { getPackageJsonSyncChanges, readInheritedDevProperties, writeDevProperties, } from '../utils/project-detection.js';
|
|
4
|
+
import { getPackageJsonSyncChanges, normalizeDomain, readInheritedDevProperties, writeDevProperties, } from '../utils/project-detection.js';
|
|
5
5
|
import { setDeployPassword, deleteDeployPassword, getOAuth2ClientSecret, setOAuth2ClientSecret, deleteOAuth2ClientSecret, getSigningPassword, setSigningPassword, deleteSigningPassword, } from '../utils/keychain.js';
|
|
6
6
|
import { DEFAULT_SCOPES, discoverOAuth2Config } from '../utils/oauth2-auth.js';
|
|
7
7
|
import { ACCENT } from './Frame.js';
|
|
@@ -298,10 +298,16 @@ export function ConfigForm({ project, active, width, height, pickAddon, onSaved,
|
|
|
298
298
|
: [];
|
|
299
299
|
// Write one field to disk (and the keychain for secrets) right away.
|
|
300
300
|
const commit = (key, value, label = current.label) => {
|
|
301
|
-
const
|
|
301
|
+
const clean = key === 'domain' ? normalizeDomain(value) : value;
|
|
302
|
+
const next = { ...values, [key]: clean };
|
|
302
303
|
setValues(next);
|
|
303
304
|
saveConfig(project, next, new Set([key]));
|
|
304
|
-
setNote(
|
|
305
|
+
setNote(clean === value
|
|
306
|
+
? t('Saved {label}.', { label: t(label) })
|
|
307
|
+
: t('Saved {label} as {value} — a domain is a host only.', {
|
|
308
|
+
label: t(label),
|
|
309
|
+
value: clean,
|
|
310
|
+
}));
|
|
305
311
|
onSaved();
|
|
306
312
|
};
|
|
307
313
|
// Auto-fill OAuth2 endpoints from the site's OpenID configuration.
|
package/dist/utils/i18n.js
CHANGED
|
@@ -230,6 +230,7 @@ const sv = {
|
|
|
230
230
|
idle: 'inaktiv',
|
|
231
231
|
'workspace config saved': 'arbetsytans konfig sparad',
|
|
232
232
|
'config saved': 'konfig sparad',
|
|
233
|
+
'Saved {label} as {value} — a domain is a host only.': 'Sparade {label} som {value} — en domän är enbart ett värdnamn.',
|
|
233
234
|
' · shared .dev_properties.json at the root': ' · delad .dev_properties.json i roten',
|
|
234
235
|
' · new workspace: fill in once, every app inherits · Esc skips': ' · ny arbetsyta: fyll i en gång, alla appar ärver · Esc hoppar över',
|
|
235
236
|
'y confirm · n cancel': 'y bekräfta · n avbryt',
|
|
@@ -267,5 +268,10 @@ const sv = {
|
|
|
267
268
|
'Opening browser…': 'Öppnar webbläsare…',
|
|
268
269
|
'Log in in the opened browser, then press Enter to capture the session.': 'Logga in i webbläsaren och tryck sedan Enter för att fånga sessionen.',
|
|
269
270
|
'Capturing session…': 'Fångar session…',
|
|
271
|
+
'A Chrome window is open at:': 'Ett Chrome-fönster är öppet på:',
|
|
272
|
+
'1. Log in to the site there, single sign-on included.': '1. Logga in på webbplatsen där, även med enkel inloggning.',
|
|
273
|
+
'2. Wait until the site itself has finished loading.': '2. Vänta tills själva webbplatsen har laddat klart.',
|
|
274
|
+
'3. Come back here and press Enter.': '3. Kom tillbaka hit och tryck Enter.',
|
|
275
|
+
'Leave the browser window open; it closes once the session is captured.': 'Låt webbläsarfönstret vara öppet; det stängs när sessionen har hämtats.',
|
|
270
276
|
'Press Esc to cancel.': 'Tryck Esc för att avbryta.',
|
|
271
277
|
};
|
|
@@ -22,6 +22,8 @@ export declare function findDevPropertiesPath(root: string): string | null;
|
|
|
22
22
|
* Get the default dev properties path (for creating new files)
|
|
23
23
|
*/
|
|
24
24
|
export declare function getDefaultDevPropertiesPath(root: string): string;
|
|
25
|
+
/** A bare host: no scheme, no path, no stray spaces. */
|
|
26
|
+
export declare function normalizeDomain(value: string): string;
|
|
25
27
|
/**
|
|
26
28
|
* The dev properties a workspace root defines (its own file merged over any
|
|
27
29
|
* ancestors'), with the deploy password resolved from the keychain like an
|
|
@@ -81,12 +81,25 @@ function ancestorDirs(root) {
|
|
|
81
81
|
}
|
|
82
82
|
return dirs;
|
|
83
83
|
}
|
|
84
|
+
/** A bare host: no scheme, no path, no stray spaces. */
|
|
85
|
+
export function normalizeDomain(value) {
|
|
86
|
+
const host = value
|
|
87
|
+
.trim()
|
|
88
|
+
.replace(/^[a-z]+:\/\//i, '')
|
|
89
|
+
.replaceAll(/\s/g, '');
|
|
90
|
+
const slash = host.indexOf('/');
|
|
91
|
+
return slash === -1 ? host : host.slice(0, slash);
|
|
92
|
+
}
|
|
84
93
|
function readDevPropertiesFile(dir) {
|
|
85
94
|
const file = findDevPropertiesPath(dir);
|
|
86
95
|
if (!file)
|
|
87
96
|
return null;
|
|
88
97
|
try {
|
|
89
|
-
|
|
98
|
+
const dev = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
99
|
+
// ponytail: top level only; a hand-edited environment override keeps its
|
|
100
|
+
// scheme until it is saved from the config form.
|
|
101
|
+
dev.domain &&= normalizeDomain(dev.domain);
|
|
102
|
+
return dev;
|
|
90
103
|
}
|
|
91
104
|
catch {
|
|
92
105
|
return null;
|