@@ -19,10 +19,10 @@ class CoCreateLazyLoader {
19
19
}
20
20
21
21
async init ( ) {
22
- // Function to create the scripts directory if it doesn't exist
23
- async function createScriptsDirectory ( ) {
22
+ const scriptsDirectory = './scripts' ;
23
+
24
+ if ( ! await fs . access ( scriptsDirectory ) ) {
24
25
try {
25
- const scriptsDirectory = './scripts' ;
26
26
await fs . mkdir ( scriptsDirectory , { recursive : true } ) ;
27
27
console . log ( `Scripts directory created at ${ scriptsDirectory } ` ) ;
28
28
} catch ( error ) {
@@ -31,9 +31,6 @@ class CoCreateLazyLoader {
31
31
}
32
32
}
33
33
34
- // Call this function at the start of your application
35
- createScriptsDirectory ( ) ;
36
-
37
34
this . modules = await Config ( 'modules' , false , false )
38
35
if ( ! this . modules )
39
36
return
@@ -76,6 +73,7 @@ class CoCreateLazyLoader {
76
73
77
74
hosts [ hostname ] = organization
78
75
76
+ // TODO: handle ssl validation here and creation here
79
77
if ( valideUrl . pathname . startsWith ( '/webhooks/' ) ) {
80
78
let name = req . url . split ( '/' ) [ 2 ] ; // Assuming URL structure is /webhook/name/...
81
79
if ( this . modules [ name ] ) {
@@ -94,8 +92,6 @@ class CoCreateLazyLoader {
94
92
res . writeHead ( 400 , { 'Content-Type' : 'text/plain' } ) ;
95
93
res . end ( 'Invalid host format' ) ;
96
94
}
97
-
98
-
99
95
} )
100
96
101
97
}
@@ -188,7 +184,6 @@ class CoCreateLazyLoader {
188
184
189
185
}
190
186
191
-
192
187
}
193
188
194
189
function getModuleDependencies ( modulePath ) {
0 commit comments