kryptheon 0.1.21 → 0.1.23

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.
@@ -127,6 +127,13 @@ function recentChanges(root) {
127
127
  };
128
128
  }
129
129
 
130
+ /** " - the risky part: x" for a frontend finding that names one, else "". */
131
+ function riskyPartsLine(f) {
132
+ const parts = (f.parts || []).filter((p) => p && p.text && p.text !== f.expression);
133
+ if (!parts.length) return '';
134
+ return ' - the risky part' + (parts.length === 1 ? ': ' : 's: ') + parts.map((p) => p.text).join(', ');
135
+ }
136
+
130
137
  /** When this flow last passed, from the run history, or null. */
131
138
  function lastPassOf(history, title) {
132
139
  for (let i = history.length - 1; i >= 0; i--) {
@@ -197,7 +204,9 @@ function startSteps(checks, seen) {
197
204
  {
198
205
  id: 'record',
199
206
  title: 'Record your main flows',
200
- why: 'Sign up, log in, pay - do each once while Kryptheon watches. It then knows what "working" looks like.',
207
+ // The lesson of a test where 26 bugs were planted before recording and
208
+ // none was caught: what is recorded is taken as right.
209
+ why: 'Sign up, log in, pay - do each once while Kryptheon watches. Record while your app works: what it sees is taken as right, so a bug already there when you record becomes part of "working".',
201
210
  state: seen.recordings ? 'done' : 'todo',
202
211
  at: null,
203
212
  count: seen.recordings,
@@ -214,7 +223,7 @@ function startSteps(checks, seen) {
214
223
  {
215
224
  id: 'data',
216
225
  title: 'Check your database',
217
- why: 'Attacks a copy of your Postgres or Supabase database and reports what got in. Needs your connection string, so it runs in your terminal.',
226
+ why: 'Attacks a copy inside your Postgres or Supabase database and reports what got in; your own rows are not touched. It asks for the connection string - in Supabase: Project Settings, Database, Connection string, URI. Try it on a test project first. It runs in your terminal, so the string never reaches this page.',
218
227
  state: !on('data') ? 'off' : seen.nightAt ? 'done' : 'todo',
219
228
  at: seen.nightAt,
220
229
  action: on('data') ? { kind: 'command', command: 'npx kryptheon-night' } : null,
@@ -290,7 +299,9 @@ function buildState(root, env) {
290
299
  confidence: f.confidence,
291
300
  where: f.file + ':' + f.line,
292
301
  headline: f.headline,
293
- detail: f.sink + ': ' + f.expression,
302
+ // The part of a long template that decides it, so the person reading
303
+ // it looks at one value instead of sixty lines of markup.
304
+ detail: f.sink + ': ' + f.expression + riskyPartsLine(f),
294
305
  fixPrompt: f.fixPrompt,
295
306
  when: code.checkedAt,
296
307
  });
@@ -422,10 +433,17 @@ function createServer(root, options) {
422
433
  'x-content-type-options': 'nosniff',
423
434
  'referrer-policy': 'no-referrer',
424
435
  // The page loads nothing from anywhere else, and says so.
425
- 'content-security-policy': "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",
436
+ 'content-security-policy': "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",
426
437
  });
427
438
  res.end(body);
428
439
  };
440
+ // Files served as they are from next to this one. A missing one is a
441
+ // missing picture or font, never a stopped dashboard.
442
+ const ASSETS = {
443
+ '/logo.png': ['image/png', opts.logoFile || path.join(__dirname, 'kryptheon-logo.png')],
444
+ '/fonts/archivo.woff2': ['font/woff2', path.join(__dirname, 'kryptheon-archivo.woff2')],
445
+ '/fonts/spacemono.woff2': ['font/woff2', path.join(__dirname, 'kryptheon-spacemono.woff2')],
446
+ };
429
447
  const json = (res, code, value) => send(res, code, 'application/json; charset=utf-8', JSON.stringify(value));
430
448
 
431
449
  const server = http.createServer((req, res) => {
@@ -438,15 +456,15 @@ function createServer(root, options) {
438
456
  if (req.method === 'GET' && url.pathname === '/dashboard.js') {
439
457
  return send(res, 200, 'text/javascript; charset=utf-8', fs.readFileSync(path.join(__dirname, 'kryptheon-dashboard-page.js'), 'utf8'));
440
458
  }
441
- if (req.method === 'GET' && url.pathname === '/logo.png') {
442
- // A missing logo is a missing picture, never a stopped dashboard.
443
- let logo;
459
+ if (req.method === 'GET' && Object.prototype.hasOwnProperty.call(ASSETS, url.pathname)) {
460
+ const [type, file] = ASSETS[url.pathname];
461
+ let body;
444
462
  try {
445
- logo = fs.readFileSync(opts.logoFile || path.join(__dirname, 'kryptheon-logo.png'));
463
+ body = fs.readFileSync(file);
446
464
  } catch (err) {
447
465
  return send(res, 404, 'text/plain', 'Not found');
448
466
  }
449
- return send(res, 200, 'image/png', logo);
467
+ return send(res, 200, type, body);
450
468
  }
451
469
  if (req.method === 'GET' && url.pathname === '/api/state') {
452
470
  return json(res, 200, buildState(root, env));
@@ -0,0 +1,98 @@
1
+ The dashboard ships two fonts, both under the SIL Open Font License 1.1:
2
+
3
+ kryptheon-archivo.woff2 Archivo (latin subset, variable weight and width)
4
+ Copyright 2020 The Archivo Project Authors
5
+ (https://github.com/Omnibus-Type/Archivo)
6
+
7
+ kryptheon-spacemono.woff2 Space Mono (latin subset, regular)
8
+ Copyright 2016 Google Inc. All Rights Reserved.
9
+
10
+ They are the same files kryptheon.tech uses, so the dashboard and the site
11
+ read alike. The license follows.
12
+
13
+ -----------------------------------------------------------
14
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
15
+ -----------------------------------------------------------
16
+
17
+ PREAMBLE
18
+ The goals of the Open Font License (OFL) are to stimulate worldwide
19
+ development of collaborative font projects, to support the font creation
20
+ efforts of academic and linguistic communities, and to provide a free and
21
+ open framework in which fonts may be shared and improved in partnership
22
+ with others.
23
+
24
+ The OFL allows the licensed fonts to be used, studied, modified and
25
+ redistributed freely as long as they are not sold by themselves. The
26
+ fonts, including any derivative works, can be bundled, embedded,
27
+ redistributed and/or sold with any software provided that any reserved
28
+ names are not used by derivative works. The fonts and derivatives,
29
+ however, cannot be released under any other type of license. The
30
+ requirement for fonts to remain under this license does not apply
31
+ to any document created using the fonts or their derivatives.
32
+
33
+ DEFINITIONS
34
+ "Font Software" refers to the set of files released by the Copyright
35
+ Holder(s) under this license and clearly marked as such. This may
36
+ include source files, build scripts and documentation.
37
+
38
+ "Reserved Font Name" refers to any names specified as such after the
39
+ copyright statement(s).
40
+
41
+ "Original Version" refers to the collection of Font Software components as
42
+ distributed by the Copyright Holder(s).
43
+
44
+ "Modified Version" refers to any derivative made by adding to, deleting,
45
+ or substituting -- in part or in whole -- any of the components of the
46
+ Original Version, by changing formats or by porting the Font Software to a
47
+ new environment.
48
+
49
+ "Author" refers to any designer, engineer, programmer, technical
50
+ writer or other person who contributed to the Font Software.
51
+
52
+ PERMISSION & CONDITIONS
53
+ Permission is hereby granted, free of charge, to any person obtaining
54
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
55
+ redistribute, and sell modified and unmodified copies of the Font
56
+ Software, subject to the following conditions:
57
+
58
+ 1) Neither the Font Software nor any of its individual components,
59
+ in Original or Modified Versions, may be sold by itself.
60
+
61
+ 2) Original or Modified Versions of the Font Software may be bundled,
62
+ redistributed and/or sold with any software, provided that each copy
63
+ contains the above copyright notice and this license. These can be
64
+ included either as stand-alone text files, human-readable headers or
65
+ in the appropriate machine-readable metadata fields within text or
66
+ binary files as long as those fields can be easily viewed by the user.
67
+
68
+ 3) No Modified Version of the Font Software may use the Reserved Font
69
+ Name(s) unless explicit written permission is granted by the corresponding
70
+ Copyright Holder. This restriction only applies to the primary font name as
71
+ presented to the users.
72
+
73
+ 4) The name(s) of the Copyright Holder(s) and the Author(s) of the Font
74
+ Software shall not be used to promote, endorse or advertise any
75
+ Modified Version, except to acknowledge the contribution(s) of the
76
+ Copyright Holder(s) and the Author(s) or with their explicit written
77
+ permission.
78
+
79
+ 5) The Font Software, modified or unmodified, in part or in whole,
80
+ must be distributed entirely under this license, and must not be
81
+ distributed under any other license. The requirement for fonts to
82
+ remain under this license does not apply to any document created
83
+ using the Font Software.
84
+
85
+ TERMINATION
86
+ This license becomes null and void if any of the above conditions are
87
+ not met.
88
+
89
+ DISCLAIMER
90
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
91
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
92
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
93
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
94
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
95
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
96
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
97
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
98
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kryptheon",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Record what you do in your app and get plain-language reports when it breaks.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -37,6 +37,9 @@
37
37
  "kryptheon-dashboard.html",
38
38
  "kryptheon-dashboard-page.js",
39
39
  "kryptheon-logo.png",
40
+ "kryptheon-fonts-OFL.txt",
41
+ "kryptheon-spacemono.woff2",
42
+ "kryptheon-archivo.woff2",
40
43
  "kryptheon-changes.js",
41
44
  "kryptheon-look.js"
42
45
  ],