@cocreate/acme 1.1.0 → 1.1.2
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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/index.js +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.1.2](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.1.1...v1.1.2) (2024-01-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added proxy.createServer ([ec8e37f](https://github.com/CoCreate-app/CoCreate-acme/commit/ec8e37fbce371bd615807f290e695e2880572fb8))
|
|
7
|
+
|
|
8
|
+
## [1.1.1](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.1.0...v1.1.1) (2024-01-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* check pathname for acme-challenge and return true ([0b90df5](https://github.com/CoCreate-app/CoCreate-acme/commit/0b90df504cb452bc60a822ea55c0987c71e3fa11))
|
|
14
|
+
|
|
1
15
|
# [1.1.0](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.0.0...v1.1.0) (2023-12-31)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -15,7 +15,8 @@ const MINUTES = Math.floor(Math.random() * 60); // Random minutes between 0-59
|
|
|
15
15
|
// Store these constants in a configuration file, environment variable, or database
|
|
16
16
|
|
|
17
17
|
class CoCreateAcme {
|
|
18
|
-
constructor(crud) {
|
|
18
|
+
constructor(proxy, crud) {
|
|
19
|
+
this.proxy = proxy
|
|
19
20
|
this.crud = crud
|
|
20
21
|
this.init().catch(err => {
|
|
21
22
|
console.error('Error initializing ACME client:', err);
|
|
@@ -165,7 +166,8 @@ class CoCreateAcme {
|
|
|
165
166
|
fs.writeFileSync(hostKeyPath + 'private-key.pem', key);
|
|
166
167
|
// fs.chmodSync(keyPath + 'private-key.pem', '400')
|
|
167
168
|
|
|
168
|
-
process.emit('certificateCreated', host)
|
|
169
|
+
// process.emit('certificateCreated', host)
|
|
170
|
+
this.proxy.createServer(host)
|
|
169
171
|
|
|
170
172
|
let safeKey = host.replace(/\./g, '_');
|
|
171
173
|
let organization = await this.crud.send({
|
|
@@ -232,9 +234,9 @@ class CoCreateAcme {
|
|
|
232
234
|
return await this.requestCertificate(host, organization_id, false)
|
|
233
235
|
}
|
|
234
236
|
|
|
235
|
-
async checkCertificate(host, organization_id) {
|
|
237
|
+
async checkCertificate(host, organization_id, pathname = '') {
|
|
236
238
|
let hostname = host.split(':')[0]
|
|
237
|
-
if (hostname === 'localhost' || hostname === '127.0.0.1')
|
|
239
|
+
if (hostname === 'localhost' || hostname === '127.0.0.1' || pathname.startsWith('/.well-known/acme-challenge/'))
|
|
238
240
|
return true
|
|
239
241
|
|
|
240
242
|
let expires = certificates.get(host)
|