tlsd 2.4.1 → 2.6.0

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.
Files changed (76) hide show
  1. package/README.md +26 -3
  2. package/domains/README.txt +0 -0
  3. package/inchtml.js +40 -0
  4. package/package.json +2 -1
  5. package/proxy/config.json +5 -0
  6. package/proxy/package-lock.json +118 -0
  7. package/proxy/package.json +15 -0
  8. package/proxy/proxy.js +20 -0
  9. package/proxy/siriusmercantile.com/index.js +14 -0
  10. package/proxy/siriusmercantile.com/package-lock.json +137 -0
  11. package/proxy/siriusmercantile.com/package.json +7 -0
  12. package/proxy/zzz/was-nm/debug/CHANGELOG.md +395 -0
  13. package/proxy/zzz/was-nm/debug/LICENSE +19 -0
  14. package/proxy/zzz/was-nm/debug/README.md +437 -0
  15. package/proxy/zzz/was-nm/debug/dist/debug.js +886 -0
  16. package/proxy/zzz/was-nm/debug/node.js +1 -0
  17. package/proxy/zzz/was-nm/debug/package.json +90 -0
  18. package/proxy/zzz/was-nm/debug/src/browser.js +180 -0
  19. package/proxy/zzz/was-nm/debug/src/common.js +249 -0
  20. package/proxy/zzz/was-nm/debug/src/index.js +12 -0
  21. package/proxy/zzz/was-nm/debug/src/node.js +174 -0
  22. package/proxy/zzz/was-nm/eventemitter3/LICENSE +21 -0
  23. package/proxy/zzz/was-nm/eventemitter3/README.md +92 -0
  24. package/proxy/zzz/was-nm/eventemitter3/index.d.ts +67 -0
  25. package/proxy/zzz/was-nm/eventemitter3/index.js +336 -0
  26. package/proxy/zzz/was-nm/eventemitter3/package.json +84 -0
  27. package/proxy/zzz/was-nm/eventemitter3/umd/eventemitter3.js +340 -0
  28. package/proxy/zzz/was-nm/eventemitter3/umd/eventemitter3.min.js +1 -0
  29. package/proxy/zzz/was-nm/eventemitter3/umd/eventemitter3.min.js.map +1 -0
  30. package/proxy/zzz/was-nm/follow-redirects/LICENSE +18 -0
  31. package/proxy/zzz/was-nm/follow-redirects/README.md +145 -0
  32. package/proxy/zzz/was-nm/follow-redirects/http.js +1 -0
  33. package/proxy/zzz/was-nm/follow-redirects/https.js +1 -0
  34. package/proxy/zzz/was-nm/follow-redirects/index.js +452 -0
  35. package/proxy/zzz/was-nm/follow-redirects/package.json +87 -0
  36. package/proxy/zzz/was-nm/http-proxy/.auto-changelog +6 -0
  37. package/proxy/zzz/was-nm/http-proxy/.gitattributes +1 -0
  38. package/proxy/zzz/was-nm/http-proxy/CHANGELOG.md +1864 -0
  39. package/proxy/zzz/was-nm/http-proxy/CODE_OF_CONDUCT.md +74 -0
  40. package/proxy/zzz/was-nm/http-proxy/LICENSE +23 -0
  41. package/proxy/zzz/was-nm/http-proxy/README.md +568 -0
  42. package/proxy/zzz/was-nm/http-proxy/codecov.yml +10 -0
  43. package/proxy/zzz/was-nm/http-proxy/index.js +13 -0
  44. package/proxy/zzz/was-nm/http-proxy/lib/http-proxy/common.js +248 -0
  45. package/proxy/zzz/was-nm/http-proxy/lib/http-proxy/index.js +185 -0
  46. package/proxy/zzz/was-nm/http-proxy/lib/http-proxy/passes/web-incoming.js +192 -0
  47. package/proxy/zzz/was-nm/http-proxy/lib/http-proxy/passes/web-outgoing.js +147 -0
  48. package/proxy/zzz/was-nm/http-proxy/lib/http-proxy/passes/ws-incoming.js +162 -0
  49. package/proxy/zzz/was-nm/http-proxy/lib/http-proxy.js +66 -0
  50. package/proxy/zzz/was-nm/http-proxy/package.json +77 -0
  51. package/proxy/zzz/was-nm/http-proxy/renovate.json +19 -0
  52. package/proxy/zzz/was-nm/ms/index.js +162 -0
  53. package/proxy/zzz/was-nm/ms/license.md +21 -0
  54. package/proxy/zzz/was-nm/ms/package.json +69 -0
  55. package/proxy/zzz/was-nm/ms/readme.md +60 -0
  56. package/proxy/zzz/was-nm/requires-port/.travis.yml +19 -0
  57. package/proxy/zzz/was-nm/requires-port/LICENSE +22 -0
  58. package/proxy/zzz/was-nm/requires-port/README.md +47 -0
  59. package/proxy/zzz/was-nm/requires-port/index.js +38 -0
  60. package/proxy/zzz/was-nm/requires-port/package.json +74 -0
  61. package/proxy/zzz/was-nm/requires-port/test.js +98 -0
  62. package/proxy/zzz/was-nm/sleepless/README.md +4 -0
  63. package/proxy/zzz/was-nm/sleepless/autosite/README.txt +0 -0
  64. package/proxy/zzz/was-nm/sleepless/autosite/site/foobar.txt +1 -0
  65. package/proxy/zzz/was-nm/sleepless/autosite/site/pull.php +4 -0
  66. package/proxy/zzz/was-nm/sleepless/index.js +2 -0
  67. package/proxy/zzz/was-nm/sleepless/package.json +44 -0
  68. package/proxy/zzz/was-nm/sleepless/sleepless.js +613 -0
  69. package/proxy/zzz/was-nm/sleepless/test.html +9 -0
  70. package/proxy/zzz/was-nm/sleepless/test.js +146 -0
  71. package/server_static/rpc/rpc.js +2 -5
  72. package/test.html +4 -0
  73. package/tlsd +11 -2
  74. package/tlsd.js +16 -14
  75. package/foo/rpc/index.js +0 -13
  76. package/foo/static/index.html +0 -15
@@ -0,0 +1,146 @@
1
+
2
+ var l = console.log
3
+ require("./sleepless.js")
4
+
5
+ o = { a:[1,2,3], t:true, f:false, o:{key:'val'}, pi:3.1415, n:null };
6
+ j = JSON.stringify(o);
7
+
8
+ throwIf( typeof nop !== "function" );
9
+
10
+ throwIf( o2j(o) !== j );
11
+ throwIf( o2j(j2o(j)) !== j );
12
+
13
+ throwIf( toInt(3) !== 3 );
14
+ throwIf( toInt(3.0) !== 3 );
15
+ throwIf( toInt("3") !== 3 );
16
+ throwIf( toInt("1,234") !== 1234 );
17
+ throwIf( toInt("1,234.56") !== 1234 );
18
+ throwIf( toInt("-1,234.56") !== -1234 );
19
+ throwIf( toInt(-1234.56) !== -1234 );
20
+
21
+ throwIf( toFlt(3) !== 3 );
22
+ throwIf( toFlt(3.0) !== 3 );
23
+ throwIf( toFlt("3") !== 3 );
24
+ throwIf( toFlt("1,234") !== 1234 );
25
+ throwIf( toFlt("1,234.56") !== 1234.56 );
26
+ throwIf( toFlt("-1,234.56") !== -1234.56 );
27
+ throwIf( toFlt(-1234.56) !== -1234.56 );
28
+
29
+ throwIf( c2b("10") !== 0.1 );
30
+ throwIf( c2b("12345") !== 123.45 );
31
+ throwIf( c2b(12345) !== 123.45 );
32
+ throwIf( c2b(1) !== 0.01 );
33
+ throwIf( b2c("100") !== 10000 );
34
+ throwIf( b2c("1.23") !== 123 );
35
+ throwIf( b2c("1,234.56") !== 123456 );
36
+ throwIf( b2c("1,234.5") !== 123450 );
37
+ throwIf( b2c("1,234") !== 123400 );
38
+ throwIf( b2c("0.01") !== 1 );
39
+ throwIf( b2c("0.01") !== 1 );
40
+
41
+ throwIf( numFmt(0) !== "0" );
42
+ throwIf( numFmt(0, 1) !== "0.0" );
43
+ throwIf( numFmt(0, 4) !== "0.0000" );
44
+ throwIf( numFmt(1, 4) !== "1.0000" );
45
+ throwIf( numFmt(1.1, 3) !== "1.100" );
46
+ throwIf( numFmt(-1.1, 3) !== "-1.100" );
47
+ throwIf( numFmt(-1.104, 2) !== "-1.10" );
48
+ throwIf( numFmt(1.105, 2) !== "1.11" );
49
+ throwIf( numFmt(-1.105, 2) !== "-1.10" );
50
+ throwIf( numFmt(1234) !== "1,234" );
51
+ throwIf( numFmt(123456) !== "123,456" );
52
+ throwIf( numFmt(1234567) !== "1,234,567" );
53
+ throwIf( numFmt(1234, 1) !== "1,234.0" );
54
+ throwIf( numFmt(1234, 3) !== "1,234.000" );
55
+ throwIf( numFmt(1234, 3, ".", "") !== "1234.000" );
56
+ throwIf( numFmt(-0.0001, 4, ":") !== "-0:0001" );
57
+ throwIf( numFmt(1234, 3, ":", "!") !== "1!234:000" );
58
+
59
+ throwIf( byteSize(123) !== "123 B" );
60
+ throwIf( byteSize(1234) !== "1.2 KB" );
61
+ throwIf( byteSize(1234567) !== "1.2 MB" );
62
+ throwIf( byteSize(1234567890) !== "1.1 GB" );
63
+ throwIf( byteSize(1234567890123) !== "1.1 TB" );
64
+
65
+ throwIf( toMoney("0.01") !== "0.01" );
66
+ throwIf( toMoney("31415.015") !== "31,415.02" );
67
+ throwIf( toMoney("31415.01") !== "31,415.01" );
68
+ throwIf( toMoney("31415.99") !== "31,415.99" );
69
+ throwIf( toMoney(0.01) !== "0.01");
70
+ throwIf( toMoney(31415.015) !== "31,415.02");
71
+ throwIf( toMoney(31415.01) !== "31,415.01" );
72
+ throwIf( toMoney(31415.99) !== "31,415.99" );
73
+ throwIf( toMoney(-0.01) !== "-0.01" );
74
+ throwIf( toMoney(-31415.016) !== "-31,415.02" );
75
+ throwIf( toMoney(-31415.01) !== "-31,415.01" );
76
+ throwIf( toMoney(-31415.99) !== "-31,415.99" );
77
+ throwIf( toMoney("1,000.00") !== "1,000.00" );
78
+
79
+ throwIf( toPct(1) !== "100", toPct(1) );
80
+ throwIf( toPct(1.013, 0) !== "101" );
81
+ throwIf( toPct(1.016, 0) !== "102" );
82
+ throwIf( toPct(0.01, 0) !== "1" );
83
+ throwIf( toPct(2.3, 3) !== "230.000" );
84
+ throwIf( toPct(-314.15, 2) !== "-31,415.00" );
85
+
86
+ throwIf( my2ts("") !== 0 );
87
+ throwIf( my2ts("2014-01-02 12:13:14") !== 1388693594 );
88
+ throwIf( my2ts(ts2my(1388693594)) !== 1388693594 );
89
+
90
+ throwIf( dt2ts() !== 0 );
91
+ throwIf( ts2us(1384565221) !== "11/15/2013 17:27:01" );
92
+ throwIf( ts2us_md(1384565221) !== "11/15" );
93
+ throwIf( ts2us_mdy(1384565221) !== "11/15/2013" );
94
+ throwIf( ts2us_mdy2(1384565221) !== "11/15/13" );
95
+ throwIf( ts2us_hm(1384565221) !== "17:27" );
96
+ throwIf( ts2us_mdyhm(1384565221) !== "11/15/2013 17:27" );
97
+ throwIf( ts2us_mdy2hm(1384565221) !== "11/15/13 17:27" );
98
+ throwIf( ts2us_dMy(1384565221) !== "15-Nov-2013" );
99
+
100
+ throwIf( !( us2dt("11/15/2013 17:27:01") instanceof Date) );
101
+ throwIf( dt2ts( us2dt("11/15/2013 17:27:01") ) !== 1384565221 );
102
+
103
+ throwIf( "foO".lcase() !== "foo" );
104
+ throwIf( "foO".ucase() !== "FOO" );
105
+ throwIf( "foO".ucfirst() !== "FoO" );
106
+ throwIf( "foo baR".ucwords() !== "Foo BaR" );
107
+ throwIf( "foo bar baz".abbr(7) !== "foo ..." );
108
+ throwIf( "foo".abbr(7) != "foo" ); // XXX why doesn't this work with !== ?
109
+ throwIf( " \tfoo bar \n".trim() !== "foo bar" );
110
+
111
+ throwIf( "Foo Bar".toId() !== "foo_bar" );
112
+ throwIf( "Foo_Bar".toId() !== "foo_bar" );
113
+ throwIf( " Foo_Bar ! ".toId() !== "foo_bar" );
114
+ throwIf( "foo_bar".toLabel() !== "Foo Bar" );
115
+ throwIf( "foo_bar".toLabel() !== "Foo Bar" );
116
+ throwIf( "foo_bar!".toLabel() !== "Foo Bar!" );
117
+
118
+ getFile("test.js", "utf8", function(err, data) {
119
+ throwIf( err, err );
120
+ throwIf( getFile("test.js").toString() !== data.toString() );
121
+ });
122
+
123
+ throwIf( sha1("I have a lovely bunch of coconuts.") !== "9fd0f467384256f02560d0694316b6d9bdfe7c68");
124
+ throwIf( sha256("I have a lovely bunch of coconuts.") !== "1a983ac204ea2bc92d8871d53111e021483c12a3e1ccb8ec59b0d62f3167cb13");
125
+
126
+ throwIf( "I,\nhave a lovely bunch of coconuts.".looksLike("i have", "coconuts") !== true)
127
+
128
+ throwIf( "joe@sleepless.com".is_email() !== true );
129
+ throwIf( "a@b.cd".is_email() !== true );
130
+ throwIf( "aaaaaaaaaaaaaaaaaaaa-_12.aaaa@bbbbbb.cccccccc.dddddddddddddddd".is_email() !== true );
131
+ throwIf( "joe.sleepless.com".is_email() !== false );
132
+
133
+ Thing = function() {
134
+ this.name = "Mr. Thing";
135
+ }
136
+
137
+ t = new EE(Thing);
138
+ t.on("foo", function(n) {
139
+ throwIf(n != "Mr. Thing");
140
+ })
141
+ t.emit("foo", t.name);
142
+
143
+ if(isBrowser) {
144
+ }
145
+
146
+
@@ -196,13 +196,10 @@
196
196
  let xhr = new XMLHttpRequest();
197
197
  xhr.onload = function() {
198
198
  let r = j2o( xhr.responseText );
199
- if( ! r ) {
199
+ if( r === null && xhr.responseText !== "null" ) {
200
200
  return fail( "Error parsing response from server." );
201
201
  }
202
- if( r.error ) {
203
- return fail( r.error );
204
- }
205
- okay( r.data, xhr );
202
+ okay( r, xhr );
206
203
  };
207
204
  xhr.onerror = fail;
208
205
  xhr.open( "POST", RPC_URL );
package/test.html ADDED
@@ -0,0 +1,4 @@
1
+ <html>
2
+ <head>
3
+ #include head.html
4
+ </head>
package/tlsd CHANGED
@@ -95,13 +95,22 @@ if [ "$cmd" = "init" ] ; then
95
95
 
96
96
  fi
97
97
 
98
+ if [ "$cmd" = "domain" ] ; then
99
+ domain="$2"
100
+ if cd "$home" ; then
101
+ npx greenlock add --subject "$domain" --altnames "$domain"
102
+ exit 0
103
+ else
104
+ exit 1
105
+ fi
106
+ fi
98
107
 
99
108
  if [ "$cmd" = "version" ] || [ "$cmd" = "-v" ] ; then
100
109
  node "$home/tlsd.js" -v
101
- exit 0;
110
+ exit 0
102
111
  fi
103
112
 
104
113
 
105
- echo "Usage: tlsd init|run|version ..."
114
+ echo "Usage: tlsd init|run|domain|version ..."
106
115
  exit 1
107
116
 
package/tlsd.js CHANGED
@@ -46,34 +46,34 @@ const next_seq = function() {
46
46
  // Tries to load the rpc handler module from root and if successful, passes the msg to it
47
47
  const rpc_handler = function( root, msg, _okay, _fail ) {
48
48
 
49
- D( "----------->>> RPC "+o2j( msg, null, 2 ));
49
+ D( "----------->>> RPC "+o2j( msg, null, 2 ) );
50
50
 
51
51
  const okay = data => {
52
- D( "<<<=========== RPC OKAY "+o2j(data, null, 2 ));
52
+ D( "<<<=========== RPC OKAY "+o2j( data, null, 2 ) );
53
53
  _okay( data );
54
54
  };
55
+
55
56
  const fail = error => {
56
- D( "<<<===******** RPC FAIL "+o2j(error, null, 2 ));
57
+ D( "<<<*********** RPC ERROR "+o2j( error, null, 2 ) );
57
58
  _fail( error );
58
59
  };
59
60
 
60
- const ouch = ( log_msg, error ) => {
61
- W( root + ": " + log_msg );
62
- if( error ) {
63
- E( error.stack );
64
- }
65
- fail( "RPC error" );
61
+ const ouch = audit_error => {
62
+ //E( root + ": " + audit_error );
63
+ fail( "RPC error" ); // this is returned to browser
66
64
  };
67
65
 
68
66
  try {
69
67
  const mod = require( root + "/rpc" );
70
68
  try {
71
- mod( msg, okay, fail );
69
+ mod( msg, okay, ouch );
72
70
  } catch( err ) {
73
- ouch( "RPC handler exception", err );
71
+ E( err );
72
+ ouch( "RPC handler exception" );
74
73
  }
75
74
  } catch( err ) {
76
- ouch( "Error loading RPC handler", err );
75
+ E( err );
76
+ ouch( "Error loading RPC handler" );
77
77
  }
78
78
  };
79
79
 
@@ -82,9 +82,9 @@ const rpc_handler = function( root, msg, _okay, _fail ) {
82
82
  // via the websockets msg object
83
83
  const ws_msg_handler = function( root, msg ) {
84
84
  rpc_handler( root, msg.msg, data => {
85
- msg.reply( { data } );
85
+ msg.reply( data );
86
86
  }, error => {
87
- msg.reply( { error } );
87
+ E( "This shouldn't happen." );
88
88
  } );
89
89
  };
90
90
 
@@ -168,6 +168,8 @@ const basic_handler = function( root ) {
168
168
  // Serve static files for domain
169
169
  app.use( serveStatic( root + "/static" ) );
170
170
 
171
+ app.use( serveStatic( root + "/static/404" ) );
172
+
171
173
  return app;
172
174
 
173
175
  }
package/foo/rpc/index.js DELETED
@@ -1,13 +0,0 @@
1
-
2
- module.exports = ( input, okay, fail ) => {
3
-
4
- const action = input.action;
5
-
6
- if( action == "hello" ) {
7
- return okay( "welcome" );
8
- }
9
-
10
- fail( "Invalid action: "+action );
11
-
12
- };
13
-
@@ -1,15 +0,0 @@
1
- <html>
2
- <body>
3
-
4
- <h1> Hello </h1>
5
-
6
- <script src="/rpc/rpc.js"></script>
7
-
8
- <script>
9
- RPC.on_connect = evt => {
10
- RPC( { action: "hello" }, console.log, alert );
11
- };
12
- </script>
13
-
14
- </body>
15
- </html>