@cocreate/lazy-loader 1.12.2 → 1.13.1
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 +19 -0
- package/package.json +1 -1
- package/src/server.js +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [1.13.1](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.13.0...v1.13.1) (2024-01-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fs.access error handling ([e3e61f6](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/e3e61f69d0728e437ce7980862cb4c72aa9bb34f))
|
|
7
|
+
|
|
8
|
+
# [1.13.0](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.12.2...v1.13.0) (2023-12-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* create script directory once ([a63b450](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/a63b4508f84ebcdad0f485de75287d2334b548b3))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* Added '@cocreate/acme' for dynamic ssl management ([5916bd5](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/5916bd53c7165b78274556f5717c84f4c8e1e512))
|
|
19
|
+
|
|
1
20
|
## [1.12.2](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.12.1...v1.12.2) (2023-12-28)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -11,6 +11,7 @@ class CoCreateLazyLoader {
|
|
|
11
11
|
constructor(server, crud, files) {
|
|
12
12
|
this.server = server
|
|
13
13
|
this.wsManager = crud.wsManager
|
|
14
|
+
this.acme = crud.wsManager.acme
|
|
14
15
|
this.crud = crud
|
|
15
16
|
this.files = files
|
|
16
17
|
this.exclusion = { ...require.cache };
|
|
@@ -19,10 +20,13 @@ class CoCreateLazyLoader {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
async init() {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const scriptsDirectory = './scripts';
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
await fs.access(directory);
|
|
27
|
+
console.log("The directory exists.");
|
|
28
|
+
} catch (error) {
|
|
24
29
|
try {
|
|
25
|
-
const scriptsDirectory = './scripts';
|
|
26
30
|
await fs.mkdir(scriptsDirectory, { recursive: true });
|
|
27
31
|
console.log(`Scripts directory created at ${scriptsDirectory}`);
|
|
28
32
|
} catch (error) {
|
|
@@ -31,9 +35,6 @@ class CoCreateLazyLoader {
|
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
|
|
34
|
-
// Call this function at the start of your application
|
|
35
|
-
createScriptsDirectory();
|
|
36
|
-
|
|
37
38
|
this.modules = await Config('modules', false, false)
|
|
38
39
|
if (!this.modules)
|
|
39
40
|
return
|
|
@@ -76,6 +77,8 @@ class CoCreateLazyLoader {
|
|
|
76
77
|
|
|
77
78
|
hosts[hostname] = organization
|
|
78
79
|
|
|
80
|
+
await this.acme.checkCertificate(hostname, organization._id)
|
|
81
|
+
|
|
79
82
|
if (valideUrl.pathname.startsWith('/webhooks/')) {
|
|
80
83
|
let name = req.url.split('/')[2]; // Assuming URL structure is /webhook/name/...
|
|
81
84
|
if (this.modules[name]) {
|
|
@@ -94,8 +97,6 @@ class CoCreateLazyLoader {
|
|
|
94
97
|
res.writeHead(400, { 'Content-Type': 'text/plain' });
|
|
95
98
|
res.end('Invalid host format');
|
|
96
99
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
100
|
})
|
|
100
101
|
|
|
101
102
|
}
|
|
@@ -188,7 +189,6 @@ class CoCreateLazyLoader {
|
|
|
188
189
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
|
-
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
function getModuleDependencies(modulePath) {
|