kryptheon 0.1.73 → 0.1.74
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/kryptheon-dashboard-page.js +57 -1
- package/kryptheon-dashboard.html +12 -0
- package/kryptheon-dashboard.js +40 -0
- package/kryptheon-questions.js +2 -1
- package/kryptheon-tour.js +26 -1
- package/package.json +2 -2
|
@@ -899,7 +899,11 @@
|
|
|
899
899
|
body.appendChild(allLocked);
|
|
900
900
|
}
|
|
901
901
|
if (!shown.length) {
|
|
902
|
-
|
|
902
|
+
// Nothing found while recordings wait for a password is not "nothing wrong": they never ran.
|
|
903
|
+
var waiting = (state.passwordsNeeded || []).reduce(function (n, p) { return n + p.files.length; }, 0);
|
|
904
|
+
body.appendChild(el('p', 'empty', state.findings.length ? 'Nothing matches.' : waiting
|
|
905
|
+
? 'Nothing found yet - because your recordings did not run: ' + plural((state.passwordsNeeded || []).length, 'password is', 'passwords are') + ' missing. Give ' + ((state.passwordsNeeded || []).length === 1 ? 'it' : 'them') + ' in the box at the top, and they run.'
|
|
906
|
+
: 'Nothing found by the checks that are on and have run. That is not the same as nothing wrong - see which checks are not built yet.'));
|
|
903
907
|
return;
|
|
904
908
|
}
|
|
905
909
|
var newlyBroken = (lastRecheck ? lastRecheck.newProblems : []).map(function (p) { return p.id; });
|
|
@@ -1210,6 +1214,57 @@
|
|
|
1210
1214
|
byId('notCheckedBadge').textContent = String((state.notChecked || []).length);
|
|
1211
1215
|
}
|
|
1212
1216
|
|
|
1217
|
+
// A recording that signed in keeps its password out of the file; until it is given, the recording replays
|
|
1218
|
+
// nothing and every check after it is empty. Asked for here, at the top, one box per account - saved to .env
|
|
1219
|
+
// by the accounts route, then the recordings are replayed. Typed values are kept across the page's redraws.
|
|
1220
|
+
var pwTyped = {};
|
|
1221
|
+
function renderPasswords() {
|
|
1222
|
+
var box = byId('pwBox');
|
|
1223
|
+
if (!box) return;
|
|
1224
|
+
var need = state.passwordsNeeded || [];
|
|
1225
|
+
var focused = document.activeElement && box.contains(document.activeElement) ? document.activeElement.getAttribute('data-env') : null;
|
|
1226
|
+
clear(box);
|
|
1227
|
+
box.hidden = !need.length;
|
|
1228
|
+
if (!need.length) { pwTyped = {}; return; }
|
|
1229
|
+
var files = [];
|
|
1230
|
+
need.forEach(function (p) { p.files.forEach(function (f) { if (files.indexOf(f) < 0) files.push(f); }); });
|
|
1231
|
+
box.appendChild(el('h3', null, need.length === 1 ? 'Your recording needs a password to run' : 'Your recordings need ' + need.length + ' passwords to run'));
|
|
1232
|
+
box.appendChild(el('p', null, 'You signed in while recording. Kryptheon never keeps a password in the recording, so ' +
|
|
1233
|
+
plural(files.length, 'recording') + ' cannot sign in, and ' + (files.length === 1 ? 'it has' : 'they have') +
|
|
1234
|
+
' not been checked yet. Type ' + (need.length === 1 ? 'the password' : 'each password') + ' you used - a test account, never a real customer\'s.'));
|
|
1235
|
+
var inputs = [];
|
|
1236
|
+
need.forEach(function (p) {
|
|
1237
|
+
var row = el('div', 'pw-row');
|
|
1238
|
+
var who = el('span', 'pw-who', p.account || 'The account you signed in with');
|
|
1239
|
+
who.appendChild(el('small', null, p.files.join(', ')));
|
|
1240
|
+
row.appendChild(who);
|
|
1241
|
+
var pw = el('input');
|
|
1242
|
+
pw.type = 'password';
|
|
1243
|
+
pw.autocomplete = 'off';
|
|
1244
|
+
pw.placeholder = 'its password';
|
|
1245
|
+
pw.setAttribute('data-env', p.envName);
|
|
1246
|
+
pw.setAttribute('aria-label', 'Password of ' + (p.account || 'the recorded account'));
|
|
1247
|
+
pw.value = pwTyped[p.envName] || '';
|
|
1248
|
+
pw.addEventListener('input', function () { pwTyped[p.envName] = pw.value; });
|
|
1249
|
+
inputs.push({ envName: p.envName, input: pw });
|
|
1250
|
+
row.appendChild(pw);
|
|
1251
|
+
box.appendChild(row);
|
|
1252
|
+
if (focused === p.envName) setTimeout(function () { pw.focus(); }, 0);
|
|
1253
|
+
});
|
|
1254
|
+
var save = button('sun', 'check', 'Save and run my recordings', function () {
|
|
1255
|
+
var entries = inputs.filter(function (x) { return x.input.value.trim(); }).map(function (x) { return { envName: x.envName, value: x.input.value }; });
|
|
1256
|
+
if (!entries.length) { toast('Type the password first.'); return; }
|
|
1257
|
+
post('/api/setup/accounts', { entries: entries }).then(function () {
|
|
1258
|
+
pwTyped = {};
|
|
1259
|
+
toast('Saved. Running your recordings now - 2-3 minutes.');
|
|
1260
|
+
load().then(function () { runChecks(['regression']); });
|
|
1261
|
+
}, function (err) { toast(err.message); });
|
|
1262
|
+
});
|
|
1263
|
+
save.setAttribute('data-action', 'pw-save');
|
|
1264
|
+
box.appendChild(save);
|
|
1265
|
+
box.appendChild(el('div', 'fallback', 'Saved only on this computer, in the .env file of this folder. Nothing already in it is changed.'));
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1213
1268
|
function renderRuns() {
|
|
1214
1269
|
var box = byId('runList');
|
|
1215
1270
|
clear(box);
|
|
@@ -1966,6 +2021,7 @@
|
|
|
1966
2021
|
state = next;
|
|
1967
2022
|
renderSide();
|
|
1968
2023
|
renderTop();
|
|
2024
|
+
renderPasswords();
|
|
1969
2025
|
renderApp();
|
|
1970
2026
|
renderAccount();
|
|
1971
2027
|
setupStart();
|
package/kryptheon-dashboard.html
CHANGED
|
@@ -332,6 +332,16 @@
|
|
|
332
332
|
.consent pre.warn { color: var(--orange-deep); background: rgba(255, 77, 0, 0.06); border-left: 2px solid var(--orange); }
|
|
333
333
|
.consent .tick { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
|
|
334
334
|
.consent .tick input { margin-top: 3px; }
|
|
335
|
+
/* A recording waiting for a password: asked for at the top of every view, in a box, never as ".env". */
|
|
336
|
+
.pw-need { margin-top: 20px; padding: 20px 22px; background: #fff4ec; border: 2px solid var(--orange); }
|
|
337
|
+
.pw-need h3 { margin: 0 0 6px; font-size: 18px; }
|
|
338
|
+
.pw-need p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--on-light); }
|
|
339
|
+
.pw-need .pw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 10px; }
|
|
340
|
+
.pw-need .pw-who { flex: 0 1 260px; min-width: 0; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
|
|
341
|
+
.pw-need .pw-who small { display: block; font-weight: 400; color: var(--muted); }
|
|
342
|
+
.pw-need input[type=password] { flex: 1 1 220px; min-width: 0; max-width: 360px; padding: 10px 12px; border: 1px solid var(--line); background: var(--white); font: inherit; font-size: 14px; }
|
|
343
|
+
.pw-need input[type=password]:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
|
|
344
|
+
.pw-need .fallback { margin-top: 10px; }
|
|
335
345
|
.every { margin-top: 20px; padding: 18px 20px; background: var(--white); border-left: 3px solid var(--orange); }
|
|
336
346
|
.every-steps { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-size: 14px; }
|
|
337
347
|
.every-why, .every-out li { color: var(--muted); }
|
|
@@ -435,6 +445,8 @@
|
|
|
435
445
|
<button class="btn sun" id="runAll" type="button" data-action="run"></button>
|
|
436
446
|
</div>
|
|
437
447
|
|
|
448
|
+
<section class="pw-need" id="pwBox" hidden aria-live="polite"></section>
|
|
449
|
+
|
|
438
450
|
<section class="every" id="everyBox" hidden></section>
|
|
439
451
|
|
|
440
452
|
<section class="job" id="job" hidden aria-live="polite"></section>
|
package/kryptheon-dashboard.js
CHANGED
|
@@ -239,6 +239,44 @@ function flowPrompt(t, lastPass) {
|
|
|
239
239
|
return lines.join('\n');
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
/**
|
|
243
|
+
* The passwords the recordings need and nobody gave - not in the environment, not in .env - each once, with
|
|
244
|
+
* the account it signs in as (an email in the recording whose name it is) and the recordings that need it.
|
|
245
|
+
* Never a value. The page asks for each in a box at the top: a recording waiting for one replays nothing,
|
|
246
|
+
* and every check after it comes back empty, which reads as "no problems" when nothing was tried.
|
|
247
|
+
*/
|
|
248
|
+
function passwordsNeeded(root, env) {
|
|
249
|
+
const secrets = require('./kryptheon-secrets.js');
|
|
250
|
+
const ownName = questionsModule().ENV_NAME;
|
|
251
|
+
const dir = path.join(root, 'tests');
|
|
252
|
+
const byName = new Map();
|
|
253
|
+
let names = [];
|
|
254
|
+
try {
|
|
255
|
+
names = require('./kryptheon-testfiles.js').recordingNames(dir);
|
|
256
|
+
} catch (err) {
|
|
257
|
+
return [];
|
|
258
|
+
}
|
|
259
|
+
for (const file of names) {
|
|
260
|
+
let source;
|
|
261
|
+
try {
|
|
262
|
+
source = fs.readFileSync(path.join(dir, file), 'utf8');
|
|
263
|
+
} catch (err) {
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const absent = secrets.missingSecrets(secrets.requiredSecrets(source), { env: env || process.env, envFile: secrets.envFileFor(root) });
|
|
267
|
+
if (!absent.length) continue;
|
|
268
|
+
const emails = source.match(/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g) || [];
|
|
269
|
+
for (const envName of absent) {
|
|
270
|
+
if (!ownName.test(envName)) continue; // only names the box may write
|
|
271
|
+
const item = byName.get(envName) || { envName: envName, account: null, files: [] };
|
|
272
|
+
if (!item.account) item.account = emails.find((e) => 'KRYPTHEON_PASSWORD_' + replay.accountPart(e) === envName) || null;
|
|
273
|
+
item.files.push(('tests/' + file).split('\\').join('/'));
|
|
274
|
+
byName.set(envName, item);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return Array.from(byName.values()).slice(0, 20);
|
|
278
|
+
}
|
|
279
|
+
|
|
242
280
|
function countRecordings(root) {
|
|
243
281
|
try {
|
|
244
282
|
// Recordings only - not the project's own unit tests in tests/.
|
|
@@ -1037,6 +1075,8 @@ function buildState(root, env) {
|
|
|
1037
1075
|
allFixPrompt: combinedPrompt(forAll),
|
|
1038
1076
|
runs: history.slice().reverse().map((r) => ({ runAt: r.runAt, status: r.status, passed: r.passed, failed: r.failed, durationMs: r.durationMs, skipped: (r.skipped || []).slice(0, 20) })),
|
|
1039
1077
|
recordings: recordings,
|
|
1078
|
+
// passwords the recordings wait for, asked for at the top of the page (names and accounts, never values)
|
|
1079
|
+
passwordsNeeded: passwordsNeeded(root, env),
|
|
1040
1080
|
steps: steps,
|
|
1041
1081
|
// Which app this dashboard is for: its web address, kept here, and whether
|
|
1042
1082
|
// its code is on this computer at all. The dashboard started from the home
|
package/kryptheon-questions.js
CHANGED
|
@@ -18,7 +18,8 @@ const roles = require('./kryptheon-roles.js');
|
|
|
18
18
|
const replay = require('./kryptheon-replay.js');
|
|
19
19
|
const secrets = require('./kryptheon-secrets.js');
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// The plain KRYPTHEON_PASSWORD too: a recording with no email typed before its password box uses it.
|
|
22
|
+
const ENV_NAME = /^KRYPTHEON_(PASSWORD|TOKEN)(_[A-Z0-9_]{1,80})?$/;
|
|
22
23
|
const ROLE_NAME = /^[A-Za-z][A-Za-z0-9_ -]{0,39}$/;
|
|
23
24
|
const GRANT_WORDS = /(^|\/)(invite|invites|invitations?|members?|team|users?|roles?|staff)(\/|$)/i;
|
|
24
25
|
|
package/kryptheon-tour.js
CHANGED
|
@@ -135,6 +135,7 @@
|
|
|
135
135
|
function recordings() { var s = recordStep(); return s ? (s.count || (s.state === 'done' ? 1 : 0)) : 0; }
|
|
136
136
|
function hasAddress() { return !!(state && state.app && state.app.address); }
|
|
137
137
|
function findings() { return (state && state.findings) || []; }
|
|
138
|
+
function needsPassword() { return !!(state && state.passwordsNeeded && state.passwordsNeeded.length); }
|
|
138
139
|
function needsConnect() {
|
|
139
140
|
var f = findings()[0];
|
|
140
141
|
return !!(f && !f.fixPrompt && f.promptLock && f.promptLock.reason === 'connect' && !(state.account && state.account.connected));
|
|
@@ -234,6 +235,26 @@
|
|
|
234
235
|
done: function () { return recordings() > seen.recordings; },
|
|
235
236
|
next: 'check',
|
|
236
237
|
},
|
|
238
|
+
// Not counted in the steps: a detour after recording when the recording signed in. Its password is never
|
|
239
|
+
// kept in the file, so until it is typed the recording replays nothing and every check comes back empty.
|
|
240
|
+
password: {
|
|
241
|
+
view: 'dashboard',
|
|
242
|
+
target: function () { return byId('pwBox'); },
|
|
243
|
+
show: function (c) {
|
|
244
|
+
if (busy) {
|
|
245
|
+
title(c, 'Running ', 'your recordings', '');
|
|
246
|
+
c.appendChild(el('p', 'kt-red', 'Please wait - this takes 2 or 3 minutes. Keep this page and the black window open.'));
|
|
247
|
+
waiting(c, 'Running');
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
title(c, 'Type the ', 'password', ' you used');
|
|
251
|
+
c.appendChild(el('p', null, 'You signed in while recording. Kryptheon never keeps a password in the recording, so it cannot sign in by itself yet. Type the same password in the box, then press Save and run my recordings.'));
|
|
252
|
+
c.appendChild(el('p', null, 'It stays on this computer only.'));
|
|
253
|
+
waiting(c, 'Waiting for you to press Save');
|
|
254
|
+
},
|
|
255
|
+
done: function () { return !needsPassword() && !busy; },
|
|
256
|
+
next: 'check',
|
|
257
|
+
},
|
|
237
258
|
check: runStep('check', 'Press ', 'Check my app', '', 'One press runs every check on your app, one after another. Nothing is deleted, and every problem comes back with its proof.', 'findings'),
|
|
238
259
|
findings: {
|
|
239
260
|
view: 'findings',
|
|
@@ -616,10 +637,12 @@
|
|
|
616
637
|
function signature() {
|
|
617
638
|
return [at, busy, Date.now() - stepSince > STUCK_MS, seen.connectWhy || '', visible(byId('everyBox')), hasAddress(), recordings(), findings().length, seen.pressed, needsConnect(), connected(),
|
|
618
639
|
!!((q('#accountBox input') || {}).value),
|
|
619
|
-
state && state.autostart && state.autostart.on, state && state.daily && state.daily.on].join('|');
|
|
640
|
+
state && state.autostart && state.autostart.on, state && state.daily && state.daily.on, needsPassword()].join('|');
|
|
620
641
|
}
|
|
621
642
|
|
|
622
643
|
function move(id, back) {
|
|
644
|
+
// also when the guide opens again at a step past recording: the password comes first
|
|
645
|
+
if (!busy && needsPassword() && (id === 'check' || id === 'findings')) id = 'password';
|
|
623
646
|
at = id;
|
|
624
647
|
seen.back = back ? id : null;
|
|
625
648
|
stepSince = Date.now();
|
|
@@ -689,6 +712,8 @@
|
|
|
689
712
|
if (!kept.done && !kept.dismissed && (kept.at || !hasAddress() || recordings() === 0)) start(kept.at && STEPS[kept.at] ? kept.at : 'hello');
|
|
690
713
|
return;
|
|
691
714
|
}
|
|
715
|
+
// A recording waiting for its password comes before checking: a check without it tries nothing.
|
|
716
|
+
if (!busy && needsPassword() && (at === 'check' || at === 'findings')) return move('password');
|
|
692
717
|
var step = STEPS[at];
|
|
693
718
|
if (step.tick) step.tick();
|
|
694
719
|
if (step.done && step.done()) return move(step.next);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kryptheon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.74",
|
|
4
4
|
"description": "Record what you do in your app and get plain-language reports when it breaks.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"pg": "^8.23.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
|
-
"check": "node kryptheon-store.check.js && node kryptheon-code.check.js && node kryptheon-constdata.check.js && node kryptheon-listitems.check.js && node kryptheon-accept.check.js && node kryptheon-keys.check.js && node kryptheon-dashboard.check.js && node kryptheon-tour.check.js && node kryptheon-upgrade.check.js && node kryptheon-edge.check.js && node kryptheon-reliability.check.js && node kryptheon-fresh.check.js && node kryptheon-payments-dash.check.js && node kryptheon-embedded.check.js && node kryptheon-autostart.check.js && node kryptheon-changes.check.js && node kryptheon-look.check.js && node kryptheon-verify.check.js && node kryptheon-recheck.check.js && node kryptheon-reporter.check.js && node kryptheon-signature.check.js && node kryptheon-signature.stream.check.js && node kryptheon-signature.baseline.check.js && node kryptheon-signature.settle.check.js && node kryptheon-signature.number.check.js && node kryptheon-signature.rows.check.js && node kryptheon-env.check.js && node kryptheon-watchdog.check.js && node kryptheon-phone.check.js && node kryptheon-homedash.check.js && node kryptheon-record.check.js && node kryptheon-selectors.check.js && node kryptheon-recordings.check.js && node kryptheon-testfiles.check.js && node kryptheon-cleanup.check.js && node kryptheon-orphan.check.js && node kryptheon-project.check.js && node kryptheon-setup.check.js && node kryptheon-browser.check.js && node kryptheon-heal.check.js && node kryptheon-load.check.js && node kryptheon-authz.check.js && node kryptheon-roles.check.js && node kryptheon-map.check.js && node kryptheon-api.check.js && node kryptheon-webhook.check.js && node kryptheon-csv.check.js && node kryptheon-witness.check.js && node kryptheon-round34.check.js && node kryptheon-token.check.js && node kryptheon-questions.check.js && node kryptheon-daily.check.js && node kryptheon-live.check.js && node kryptheon-aim.check.js && node kryptheon-peruser.check.js && node kryptheon-aiapp.check.js && node kryptheon-package.check.js && node kryptheon-newer.check.js",
|
|
78
|
+
"check": "node kryptheon-store.check.js && node kryptheon-code.check.js && node kryptheon-constdata.check.js && node kryptheon-listitems.check.js && node kryptheon-accept.check.js && node kryptheon-keys.check.js && node kryptheon-dashboard.check.js && node kryptheon-tour.check.js && node kryptheon-upgrade.check.js && node kryptheon-edge.check.js && node kryptheon-reliability.check.js && node kryptheon-fresh.check.js && node kryptheon-payments-dash.check.js && node kryptheon-embedded.check.js && node kryptheon-autostart.check.js && node kryptheon-changes.check.js && node kryptheon-look.check.js && node kryptheon-verify.check.js && node kryptheon-recheck.check.js && node kryptheon-reporter.check.js && node kryptheon-signature.check.js && node kryptheon-signature.stream.check.js && node kryptheon-signature.baseline.check.js && node kryptheon-signature.settle.check.js && node kryptheon-signature.number.check.js && node kryptheon-signature.rows.check.js && node kryptheon-env.check.js && node kryptheon-watchdog.check.js && node kryptheon-phone.check.js && node kryptheon-homedash.check.js && node kryptheon-record.check.js && node kryptheon-selectors.check.js && node kryptheon-recordings.check.js && node kryptheon-testfiles.check.js && node kryptheon-cleanup.check.js && node kryptheon-orphan.check.js && node kryptheon-project.check.js && node kryptheon-setup.check.js && node kryptheon-browser.check.js && node kryptheon-heal.check.js && node kryptheon-load.check.js && node kryptheon-authz.check.js && node kryptheon-roles.check.js && node kryptheon-map.check.js && node kryptheon-api.check.js && node kryptheon-webhook.check.js && node kryptheon-csv.check.js && node kryptheon-witness.check.js && node kryptheon-round34.check.js && node kryptheon-token.check.js && node kryptheon-questions.check.js && node kryptheon-pwbox.check.js && node kryptheon-daily.check.js && node kryptheon-live.check.js && node kryptheon-aim.check.js && node kryptheon-peruser.check.js && node kryptheon-aiapp.check.js && node kryptheon-package.check.js && node kryptheon-newer.check.js",
|
|
79
79
|
"check:store": "node kryptheon-store.check.js",
|
|
80
80
|
"check:code": "node kryptheon-code.check.js",
|
|
81
81
|
"check:constdata": "node kryptheon-constdata.check.js",
|