roster-server 1.6.8 → 1.7.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.
- package/index.js +13 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -20,9 +20,11 @@ class Roster {
|
|
|
20
20
|
throw new Error('⚠️ Port 80 is reserved for ACME challenge. Please use a different port.');
|
|
21
21
|
}
|
|
22
22
|
this.port = port;
|
|
23
|
+
|
|
24
|
+
this.loadSites();
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
loadSites() {
|
|
26
28
|
// Check if wwwPath exists
|
|
27
29
|
if (!fs.existsSync(this.wwwPath)) {
|
|
28
30
|
console.warn(`⚠️ WWW path does not exist: ${this.wwwPath}`);
|
|
@@ -42,9 +44,15 @@ class Roster {
|
|
|
42
44
|
for (const indexFile of possibleIndexFiles) {
|
|
43
45
|
const indexPath = path.join(domainPath, indexFile);
|
|
44
46
|
if (fs.existsSync(indexPath)) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
try {
|
|
48
|
+
siteApp = await import(indexPath);
|
|
49
|
+
siteApp = siteApp.default || siteApp;
|
|
50
|
+
loadedFile = indexFile;
|
|
51
|
+
break;
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.warn(`⚠️ Error loading ${indexPath}:`, err.message);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
|
|
@@ -187,8 +195,7 @@ class Roster {
|
|
|
187
195
|
console.log(`✅ Manually registered site: ${domain}`);
|
|
188
196
|
}
|
|
189
197
|
|
|
190
|
-
|
|
191
|
-
await this.loadSites();
|
|
198
|
+
start() {
|
|
192
199
|
this.generateConfigJson();
|
|
193
200
|
|
|
194
201
|
const greenlock = Greenlock.init({
|