isite 2025.1.12 → 2025.1.15

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/lib/parser.js CHANGED
@@ -811,6 +811,7 @@ module.exports = function init(req, res, ____0, route) {
811
811
 
812
812
  parser.handleMatches = function (txt) {
813
813
  let matches = txt.match(/##.*?##/g);
814
+ let handled = false;
814
815
  if (matches) {
815
816
  for (let i = 0; i < matches.length; i++) {
816
817
  let v = matches[i];
@@ -818,40 +819,54 @@ module.exports = function init(req, res, ____0, route) {
818
819
  if (v.startsWith('##var.')) {
819
820
  v = v.replace('##var.', '').replace('##', '');
820
821
  txt = txt.replace(matches[i], renderVar(v));
822
+ handled = true;
821
823
  } else if (v.startsWith('##user.')) {
822
824
  v = v.replace('##user.', '').replace('##', '');
823
825
  txt = txt.replace(matches[i], renderUser(v));
826
+ handled = true;
824
827
  } else if (v.startsWith('##site.')) {
825
828
  v = v.replace('##site.', '').replace('##', '');
826
829
  txt = txt.replace(matches[i], render_site(v));
830
+ handled = true;
827
831
  } else if (v.startsWith('##req.')) {
828
832
  v = v.replace('##req.', '').replace('##', '');
829
833
  txt = txt.replace(matches[i], renderRequest(v));
834
+ handled = true;
830
835
  } else if (v.startsWith('##session.')) {
831
836
  v = v.replace('##session.', '').replace('##', '');
832
837
  txt = txt.replace(matches[i], renderSession(v));
838
+ handled = true;
833
839
  } else if (v.startsWith('##json.')) {
834
840
  v = v.replace('##json.', '').replace('##', '');
835
841
  txt = txt.replace(matches[i], renderJson(v));
842
+ handled = true;
836
843
  } else if (v.startsWith('##setting.')) {
837
844
  v = v.replace('##setting.', '').replace('##', '');
838
845
  txt = txt.replace(matches[i], renderSetting(v));
846
+ handled = true;
839
847
  } else if (v.startsWith('##params.')) {
840
848
  v = v.replace('##params.', '').replace('##', '');
841
849
  txt = txt.replace(matches[i], renderParam(v));
850
+ handled = true;
842
851
  } else if (v.startsWith('##query.')) {
843
852
  v = v.replace('##query.', '').replace('##', '');
844
853
  txt = txt.replace(matches[i], renderQuery(v));
854
+ handled = true;
845
855
  } else if (v.startsWith('##data.')) {
846
856
  v = v.replace('##data.', '').replace('##', '');
847
857
  txt = txt.replace(matches[i], renderData(v));
858
+ handled = true;
848
859
  } else if (v.startsWith('##word.')) {
849
860
  v = v.replace('##word.', '').replace('##', '');
850
861
  txt = txt.replace(matches[i], renderWord(v));
862
+ handled = true;
851
863
  } else {
852
864
  }
853
865
  }
854
866
  }
867
+ if (handled) {
868
+ txt = parser.handleMatches(txt);
869
+ }
855
870
  return txt;
856
871
  };
857
872
 
package/lib/routing.js CHANGED
@@ -469,19 +469,17 @@ module.exports = function init(____0) {
469
469
  try {
470
470
  route.name = arr.join('/');
471
471
  if (typeof route.path == 'string' && ____0.fs.lstatSync(route.path).isDirectory()) {
472
- ____0.fs.readdir(route.path, (err, files) => {
473
- files.forEach((file) => {
474
- let r2 = { ...route };
475
- if (route.name.endsWith('/')) {
476
- r2.name = route.name + file;
477
- } else {
478
- r2.name = route.name + '/' + file;
479
- }
472
+ ____0.fs.readdirSync(route.path).forEach((file) => {
473
+ let r2 = { ...route };
474
+ if (route.name.endsWith('/')) {
475
+ r2.name = route.name + file;
476
+ } else {
477
+ r2.name = route.name + '/' + file;
478
+ }
480
479
 
481
- r2.path = route.path + '/' + file;
482
- r2.is_dynamic = !0;
483
- _0xrrxo.add(r2);
484
- });
480
+ r2.path = route.path + '/' + file;
481
+ r2.is_dynamic = !0;
482
+ _0xrrxo.add(r2);
485
483
  });
486
484
  } else {
487
485
  if (!route.name.startsWith('/')) {
@@ -1422,8 +1420,11 @@ module.exports = function init(____0) {
1422
1420
 
1423
1421
  _0xrrxo.start = function (_ports, callback) {
1424
1422
  ____0.startTime = Date.now();
1425
-
1426
1423
  ____0.ws.wsSupport();
1424
+ if (typeof _ports === 'function') {
1425
+ callback = callback || _ports;
1426
+ _ports = null;
1427
+ }
1427
1428
 
1428
1429
  ____0.https.globalAgent.options = {
1429
1430
  key: ____0.fs.readFileSync(____0.options.https.key || __dirname + '/../ssl/key.pem'),
@@ -1432,14 +1433,12 @@ module.exports = function init(____0) {
1432
1433
 
1433
1434
  const ports = [];
1434
1435
 
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
- }
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
+ });
1443
1442
  }
1444
1443
 
1445
1444
  if (ports.length === 0) {
@@ -1484,17 +1483,16 @@ module.exports = function init(____0) {
1484
1483
  server.listen(p, function () {
1485
1484
  if (!____0.server) {
1486
1485
  ____0.server = server;
1487
- setTimeout(() => {
1488
- if (callback) {
1489
- callback(____0.servers);
1490
- }
1491
- ____0.call(____0.strings[9]);
1492
- }, 1000 * 5);
1493
1486
  }
1494
1487
  ____0.servers.push(server);
1495
1488
  ____0.log('\n-----------------------------------------');
1496
1489
  ____0.log(` ( ${____0.options.name} ) Running on : http://${____0.options.hostname}:${p} `);
1497
1490
  ____0.log('-----------------------------------------\n');
1491
+
1492
+ if (callback) {
1493
+ callback(____0.servers);
1494
+ }
1495
+ ____0.call(____0.strings[9]);
1498
1496
  });
1499
1497
  }
1500
1498
  } catch (error) {