@small-tech/https 5.1.1 → 5.3.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 (3) hide show
  1. package/README.md +39 -17
  2. package/index.js +3 -1
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -23,13 +23,39 @@ ___Note:__ This is a standard ECMAScript Modules (ESM; es6 modules) project. If
23
23
  __Tested and supported on:__
24
24
 
25
25
  - Linux (tested on Fedora Silverblue 37 and Ubuntu 22.04)
26
- - macOS (tested on Intel: Monterey, M1: Ventura)
26
+ - macOS (tested on Intel: Monterey, M1: Ventura, M4: Sequoia)
27
27
  - Windows (10 and 11 under Windows Terminal and with Windows PowerShell)
28
28
 
29
29
  > 💡 On macOS, if you’re using a third-party terminal application like iTerm, you must give it Full Disk Access rights or @small-tech/https will fail to install the policy file inside Firefox when creating local development servers. You can do this on the latest version of the operating system by adding iTerm to the list at System Settings → Privacy & Security → Full Disk Access.
30
30
 
31
31
  > 💡 On Windows, @small-tech/https will also run under WSL 2 but this is not recommended when creating local development servers as local development certificates will not be automatically installed in your Windows browsers for you since your guest Linux system knows nothing about and cannot configure your host Windows environment.
32
32
 
33
+ ## Testing
34
+
35
+ To run the unit tests:
36
+
37
+ 1. Install dependencies:
38
+
39
+ ```shell
40
+ npm install
41
+ ```
42
+
43
+ 2. Ensure your computer is reachable from the Internet via its hostname.
44
+
45
+ > 💡The global tests provision Let’s Encrypt certificates using [Auto Encrypt](https://codeberg.org/small-tech/auto-encrypt)). For details on how to set up your machine for this, please see the [Tests section of the Auto Encrypt Developer Documentation](https://codeberg.org/small-tech/auto-encrypt/src/branch/main/developer-documentation.md#tests).
46
+
47
+ 3. Run:
48
+
49
+ ```shell
50
+ npm test
51
+ ```
52
+
53
+ > 💡 To run tests with debug output, use the following command instead:
54
+ >
55
+ > ```shell
56
+ > npm run test-debug
57
+ > ```
58
+
33
59
  ## Like this? Fund us!
34
60
 
35
61
  [Small Technology Foundation](https://small-tech.org) is a tiny, independent not-for-profit.
@@ -66,6 +92,8 @@ server.listen(443, () => {
66
92
 
67
93
  Hit `https://localhost` and you should see your site with locally-trusted TLS certificates.
68
94
 
95
+ > 💡 As of version 5.2.0, you can also use the localhost aliases _place1.localhost_ - _place4.localhost_ when testing the peer-to-peer features of [Small Web](https://ar.al/2020/08/07/what-is-the-small-web/) apps.
96
+
69
97
  @small-tech/https uses [Auto Encrypt Localhost](https://codeberg.org/small-tech/auto-encrypt-localhost) to create a local Certificate Authority (cA) and add it to the various trust stores. It then uses that CA to create locally-trusted TLS certificates that are automatically used by your server.
70
98
 
71
99
  ### At hostname with automatically-provisioned Let’s Encrypt certificates.
@@ -94,7 +122,7 @@ You can find a version of this example in the `/example` folder. To download and
94
122
 
95
123
  ```sh
96
124
  # Clone this repository.
97
- git clone https://source.small-tech.org/site.js/lib/https.git
125
+ git clone https://codeberg.org/small-tech/https.git
98
126
 
99
127
  # Switch to the directory.
100
128
  cd https
@@ -130,36 +158,30 @@ Lower-level:
130
158
 
131
159
  ### Auto Encrypt
132
160
 
133
- - Source: https://github.com/small-tech/auto-encrypt
161
+ - Source: https://codeberg.org/small-tech/auto-encrypt
134
162
  - Package: [@small-tech/auto-encrypt](https://www.npmjs.com/package/@small-tech/auto-encrypt)
135
163
 
136
- Adds automatic provisioning and renewal of [Let’s Encrypt](https://letsencrypt.org) TLS certificates with [OCSP Stapling](https://letsencrypt.org/docs/integration-guide/#implement-ocsp-stapling) to [Node.js](https://nodejs.org) [https](https://nodejs.org/dist/latest-v12.x/docs/api/https.html) servers (including Polka, Express.js, etc.)
164
+ Automatically provisions and renews [Let’s Encrypt](https://letsencrypt.org) TLS certificates for [Node.js](https://nodejs.org) [https](https://nodejs.org/docs/latest-v22.x/api/https.html) servers (including [Kitten](https://kitten.small-web.org), Polka, Express.js, etc.)
137
165
 
138
166
  ### Auto Encrypt Localhost
139
167
 
140
168
  - Source: https://codeberg.org/small-tech/auto-encrypt-localhost
141
169
  - Package: [@small-tech/auto-encrypt-localhost](https://www.npmjs.com/package/@small-tech/auto-encrypt-localhost)
142
170
 
143
- Automatically provisions and installs locally-trusted TLS certificates for Node.js https servers (including Polka, Express.js, etc.).
171
+ Automatically provisions and installs locally-trusted TLS certificates for Node.js https servers (including [Kitten](https://kitten.small-web.org), Polka, Express.js, etc.) in 100% JavaScript (without any native dependencies like mkcert and certutil).
144
172
 
145
173
  Higher level:
146
174
 
147
- ### Site.js
148
-
149
- - Web site: https://sitejs.org
150
- - Source: https://github.com/small-tech/site.js
151
-
152
- A tool for developing, testing, and deploying a secure static or dynamic personal web site or app with zero configuration.
153
-
154
- Note: **Deprecated.** Site.js is being used to serve a number of our own web sites and isn’t going away anytime soon but all new development work is on Kitten.
155
-
156
175
  ### Kitten
157
176
 
158
- - Web site/source code: https://codeberg.org/kitten/app
177
+ - Site: https://kitten.small-web.org
178
+ - Source code: https://codeberg.org/kitten/app
159
179
 
160
- A [Small Web](https://small-tech.org/research-and-development/) development kit.
180
+ A [Small Web](https://ar.al/2024/06/24/small-web-computer-science-colloquium-at-university-of-groningen/) development kit.
161
181
 
162
- Create your Small Web site using plain HTML, CSS, and JavaScript then enhance it with [htmx](https://htmx.org/) and [Alpine.js](https://alpinejs.dev), if you like.
182
+ - Build using HTML, CSS, and JavaScript.
183
+ - Progressively enhance with [Streaming HTML](https://kitten.small-web.org/tutorials/streaming-html).
184
+ - Go beyond traditional web apps to create peer-to-peer 💕 Small Web apps.
163
185
 
164
186
  ## Copyright
165
187
 
package/index.js CHANGED
@@ -36,7 +36,9 @@ smallTechHttps.createServer = function (options, listener) {
36
36
  options = {}
37
37
  }
38
38
 
39
- const serverScope = options.domains == undefined || options.domains.includes('localhost') ? 'local' : 'global'
39
+ const localDomains = ['localhost', 'place1.localhost', 'place2.localhost', 'place3.localhost', 'place4.localhost']
40
+ const isLocal = options.domains == undefined || options.domains.some(domain => localDomains.includes(domain))
41
+ const serverScope = isLocal ? 'local' : 'global'
40
42
  const settingsPath = options.settingsPath ? path.join(path.resolve(options.settingsPath), serverScope) : path.join(DEFAULT_SETTINGS_PATH, serverScope)
41
43
  options.settingsPath = settingsPath
42
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@small-tech/https",
3
- "version": "5.1.1",
3
+ "version": "5.3.0",
4
4
  "description": "A drop-in standard Node.js HTTPS module replacement with both automatic development-time (localhost) certificates via Auto Encrypt Localhost and automatic production certificates via Auto Encrypt.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "license": "AGPL-3.0",
48
48
  "dependencies": {
49
- "@small-tech/auto-encrypt": "^4.0.0",
49
+ "@small-tech/auto-encrypt": "^4.1.1",
50
50
  "@small-tech/auto-encrypt-localhost": "^8.3.2"
51
51
  },
52
52
  "devDependencies": {