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.
Files changed (2) hide show
  1. package/index.js +13 -6
  2. 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
- async loadSites() {
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
- siteApp = await import(indexPath);
46
- loadedFile = indexFile;
47
- break;
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
- async start() {
191
- await this.loadSites();
198
+ start() {
192
199
  this.generateConfigJson();
193
200
 
194
201
  const greenlock = Greenlock.init({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roster-server",
3
- "version": "1.6.8",
3
+ "version": "1.7.0",
4
4
  "description": "👾 RosterServer - A domain host router to host multiple HTTPS.",
5
5
  "main": "index.js",
6
6
  "scripts": {