isite 2025.1.15 → 2025.1.17
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 +3 -3
- package/lib/routing.js +22 -15
- package/lib/ws.js +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -329,7 +329,7 @@ module.exports = function init(options) {
|
|
|
329
329
|
}
|
|
330
330
|
};
|
|
331
331
|
____0.importApp = function (app_path, name2) {
|
|
332
|
-
____0.log('=== Importing App : ' + app_path);
|
|
332
|
+
____0.log('\n=== Importing App : ' + app_path);
|
|
333
333
|
if (____0.isFileExistsSync(app_path + '/site_files/json/words.json')) {
|
|
334
334
|
____0.words.addFile(app_path + '/site_files/json/words.json');
|
|
335
335
|
}
|
|
@@ -372,10 +372,10 @@ module.exports = function init(options) {
|
|
|
372
372
|
|
|
373
373
|
if (____0.options.apps === !0) {
|
|
374
374
|
if (____0.isFileExistsSync(____0.options.apps_dir) && ____0.fs.lstatSync(____0.options.apps_dir).isDirectory()) {
|
|
375
|
-
____0.log('=== Auto Loading Default Apps ===');
|
|
375
|
+
____0.log('\n=== Auto Loading Default Apps ===');
|
|
376
376
|
____0.fs.readdirSync(____0.options.apps_dir).forEach((file) => {
|
|
377
377
|
if (____0.fs.lstatSync(____0.options.apps_dir + '/' + file).isDirectory()) {
|
|
378
|
-
____0.
|
|
378
|
+
____0.loadApp(file);
|
|
379
379
|
}
|
|
380
380
|
});
|
|
381
381
|
}
|
package/lib/routing.js
CHANGED
|
@@ -226,7 +226,6 @@ module.exports = function init(____0) {
|
|
|
226
226
|
res.status(200);
|
|
227
227
|
_0xrrxo.endResponse(req, res);
|
|
228
228
|
}
|
|
229
|
-
|
|
230
229
|
if (typeof route.path == 'string') {
|
|
231
230
|
____0.readFile(route.path, function (err, file) {
|
|
232
231
|
if (!err) {
|
|
@@ -261,7 +260,7 @@ module.exports = function init(____0) {
|
|
|
261
260
|
return;
|
|
262
261
|
}
|
|
263
262
|
});
|
|
264
|
-
} else if (
|
|
263
|
+
} else if (Array.isArray(route.path)) {
|
|
265
264
|
____0.readFiles(route.path, function (err, data) {
|
|
266
265
|
if (!err) {
|
|
267
266
|
if (____0.options.help) {
|
|
@@ -1417,7 +1416,7 @@ module.exports = function init(____0) {
|
|
|
1417
1416
|
};
|
|
1418
1417
|
____0.servers = [];
|
|
1419
1418
|
____0.server = null;
|
|
1420
|
-
|
|
1419
|
+
____0.serverCount = 0;
|
|
1421
1420
|
_0xrrxo.start = function (_ports, callback) {
|
|
1422
1421
|
____0.startTime = Date.now();
|
|
1423
1422
|
____0.ws.wsSupport();
|
|
@@ -1433,14 +1432,15 @@ module.exports = function init(____0) {
|
|
|
1433
1432
|
|
|
1434
1433
|
const ports = [];
|
|
1435
1434
|
|
|
1436
|
-
if (
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1435
|
+
if (ports.length === 0) {
|
|
1436
|
+
if (typeof _ports === 'number') {
|
|
1437
|
+
ports.some((p0) => p0 == _ports) || ports.push(_ports);
|
|
1438
|
+
} else if (Array.isArray(_ports)) {
|
|
1439
|
+
_ports.forEach((p) => {
|
|
1440
|
+
ports.some((p0) => p0 == p) || ports.push(p);
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1442
1443
|
}
|
|
1443
|
-
|
|
1444
1444
|
if (ports.length === 0) {
|
|
1445
1445
|
if (typeof ____0.options.port === 'number') {
|
|
1446
1446
|
ports.some((p0) => p0 == ____0.options.port) || ports.push(____0.options.port);
|
|
@@ -1475,12 +1475,14 @@ module.exports = function init(____0) {
|
|
|
1475
1475
|
server.maxHeadersCount = 0;
|
|
1476
1476
|
server.timeout = 1000 * ____0.options.responseTimeout;
|
|
1477
1477
|
server.on('error', (e) => {
|
|
1478
|
+
____0.serverCount++;
|
|
1478
1479
|
if (e.code === 'EADDRINUSE') {
|
|
1479
1480
|
____0.log('Address in use, Closing Server : ' + p);
|
|
1480
1481
|
server.close();
|
|
1481
1482
|
}
|
|
1482
1483
|
});
|
|
1483
1484
|
server.listen(p, function () {
|
|
1485
|
+
____0.serverCount++;
|
|
1484
1486
|
if (!____0.server) {
|
|
1485
1487
|
____0.server = server;
|
|
1486
1488
|
}
|
|
@@ -1488,11 +1490,6 @@ module.exports = function init(____0) {
|
|
|
1488
1490
|
____0.log('\n-----------------------------------------');
|
|
1489
1491
|
____0.log(` ( ${____0.options.name} ) Running on : http://${____0.options.hostname}:${p} `);
|
|
1490
1492
|
____0.log('-----------------------------------------\n');
|
|
1491
|
-
|
|
1492
|
-
if (callback) {
|
|
1493
|
-
callback(____0.servers);
|
|
1494
|
-
}
|
|
1495
|
-
____0.call(____0.strings[9]);
|
|
1496
1493
|
});
|
|
1497
1494
|
}
|
|
1498
1495
|
} catch (error) {
|
|
@@ -1529,6 +1526,16 @@ module.exports = function init(____0) {
|
|
|
1529
1526
|
}
|
|
1530
1527
|
}
|
|
1531
1528
|
|
|
1529
|
+
____0.readyInterval = setInterval(() => {
|
|
1530
|
+
if (____0.serverCount == ports.length) {
|
|
1531
|
+
clearInterval(____0.readyInterval);
|
|
1532
|
+
____0.call(____0.strings[9]);
|
|
1533
|
+
if (callback) {
|
|
1534
|
+
callback(____0.servers);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}, 100);
|
|
1538
|
+
|
|
1532
1539
|
return ____0.server;
|
|
1533
1540
|
};
|
|
1534
1541
|
|
package/lib/ws.js
CHANGED
|
@@ -59,6 +59,7 @@ module.exports = function init(____0) {
|
|
|
59
59
|
}, 1000 * 30);
|
|
60
60
|
|
|
61
61
|
____0.on(____0.strings[9], () => {
|
|
62
|
+
console.log('\n Server Ready \n')
|
|
62
63
|
____0.servers.forEach((server) => {
|
|
63
64
|
server.on('upgrade', function upgrade(request, socket, head) {
|
|
64
65
|
let pathname = ____0.url.parse(request.url).pathname;
|