isite 2022.9.23 → 2023.1.1

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 (33) hide show
  1. package/apps/client-side/app.js +3 -22
  2. package/apps/client-side/site_files/css/bootstrap5-addon.css +2 -0
  3. package/apps/client-side/site_files/css/effect.css +19 -12
  4. package/apps/client-side/site_files/css/images.css +16 -12
  5. package/apps/client-side/site_files/css/layout.css +16 -9
  6. package/apps/client-side/site_files/css/modal.css +1 -1
  7. package/apps/client-side/site_files/css/table.css +1 -1
  8. package/apps/client-side/site_files/js/angular.js +23512 -22334
  9. package/apps/client-side/site_files/js/angular.min.js +352 -6
  10. package/apps/client-side/site_files/js/angular.min.js.map +8 -0
  11. package/apps/client-side/site_files/js/bootstrap-5-directive.js +2 -2
  12. package/apps/client-side/site_files/js/directive.js +2 -2
  13. package/apps/client-side/site_files/js/jquery.js +2 -4
  14. package/apps/client-side/site_files/js/site.js +1 -1
  15. package/apps/client-side/site_files/js/site.min.js +1 -1
  16. package/apps/security/site_files/html/add_modal.html +28 -37
  17. package/apps/security/site_files/html/delete_modal.html +25 -36
  18. package/apps/security/site_files/html/login_modal.html +2 -2
  19. package/apps/security/site_files/html/logout_modal.html +14 -14
  20. package/apps/security/site_files/html/register_modal.html +23 -23
  21. package/apps/security/site_files/html/update_modal.html +22 -36
  22. package/apps/security/site_files/html/view_modal.html +26 -37
  23. package/index.js +10 -4
  24. package/lib/collection.js +4 -4
  25. package/lib/collectionFile.js +5 -2
  26. package/lib/mongodb.js +5 -49
  27. package/lib/parser.js +100 -2
  28. package/lib/routing.js +34 -3
  29. package/lib/sessions.js +1 -1
  30. package/lib/words.js +1 -1
  31. package/object-options/index.js +2 -0
  32. package/object-options/lib/fn.js +44 -1
  33. package/package.json +2 -2
package/lib/mongodb.js CHANGED
@@ -249,12 +249,6 @@ module.exports = function init(____0) {
249
249
  obj.collectionName = ____0.options.mongodb.collection;
250
250
  }
251
251
 
252
- let $req = obj.doc.$req;
253
- let $res = obj.doc.$res;
254
-
255
- delete obj.doc.$req;
256
- delete obj.doc.$res;
257
-
258
252
  obj.doc = _mongo.handleDoc(obj.doc);
259
253
 
260
254
  db.collection(____0.options.mongodb.prefix.collection + obj.collectionName).insertOne(obj.doc, function (err, result) {
@@ -265,8 +259,6 @@ module.exports = function init(____0) {
265
259
  db: obj.dbName,
266
260
  collection: obj.collectionName,
267
261
  doc: result,
268
- $req: $req,
269
- $res: $res,
270
262
  });
271
263
  }
272
264
  } else {
@@ -452,12 +444,6 @@ module.exports = function init(____0) {
452
444
  obj.collectionName = ____0.options.mongodb.collection;
453
445
  }
454
446
 
455
- let $req = obj.$req;
456
- let $res = obj.$res;
457
-
458
- delete obj.$req;
459
- delete obj.$res;
460
-
461
447
  if (obj.where && obj.where._id && typeof obj.where._id === 'string') {
462
448
  obj.where._id = _mongo.ObjectID(obj.where._id);
463
449
  }
@@ -496,8 +482,6 @@ module.exports = function init(____0) {
496
482
  callback(
497
483
  null,
498
484
  {
499
- $req: $req,
500
- $res: $res,
501
485
  doc: doc2,
502
486
  old_doc: doc,
503
487
  where: obj.where,
@@ -515,9 +499,6 @@ module.exports = function init(____0) {
515
499
  old_doc: doc,
516
500
  where: obj.where,
517
501
  update: $update,
518
-
519
- $req: $req,
520
- $res: $res,
521
502
  });
522
503
  }
523
504
  }
@@ -544,12 +525,6 @@ module.exports = function init(____0) {
544
525
  obj.collectionName = ____0.options.mongodb.collection;
545
526
  }
546
527
 
547
- let $req = obj.$req;
548
- let $res = obj.$res;
549
-
550
- delete obj.$req;
551
- delete obj.$res;
552
-
553
528
  let $update = {};
554
529
  if (obj.set) {
555
530
  $update.$set = obj.set;
@@ -582,8 +557,6 @@ module.exports = function init(____0) {
582
557
  ok: result.result.ok,
583
558
  where: obj.where,
584
559
  update: $update,
585
- $req: req,
586
- $res: res,
587
560
  });
588
561
  }
589
562
  } else {
@@ -602,12 +575,7 @@ module.exports = function init(____0) {
602
575
  if (obj.collectionName === undefined) {
603
576
  obj.collectionName = ____0.options.mongodb.collection;
604
577
  }
605
-
606
- let $req = obj.where.$req;
607
- let $res = obj.where.$res;
608
-
609
- delete obj.where.$req;
610
- delete obj.where.$res;
578
+
611
579
 
612
580
  _mongo.findOne(
613
581
  {
@@ -623,8 +591,6 @@ module.exports = function init(____0) {
623
591
  callback(
624
592
  null,
625
593
  {
626
- $req: $req,
627
- $res: $res,
628
594
  db: obj.dbName,
629
595
  collection: obj.collectionName,
630
596
  count: result.deletedCount,
@@ -637,8 +603,6 @@ module.exports = function init(____0) {
637
603
  db: obj.dbName,
638
604
  collection: obj.collectionName,
639
605
  doc: doc,
640
- $req: $req,
641
- $res: $res,
642
606
  });
643
607
  }
644
608
  } else {
@@ -647,7 +611,7 @@ module.exports = function init(____0) {
647
611
  });
648
612
  } else {
649
613
  callback({
650
- message: 'Not Exists',
614
+ message: 'Not Exists : ' + JSON.stringify(obj.where),
651
615
  });
652
616
  }
653
617
  }
@@ -669,8 +633,7 @@ module.exports = function init(____0) {
669
633
  {
670
634
  db: obj.dbName,
671
635
  collection: obj.collectionName,
672
- $req: $req,
673
- $res: $res,
636
+
674
637
  count: 0,
675
638
  ok: 0,
676
639
  exists: 0,
@@ -679,11 +642,6 @@ module.exports = function init(____0) {
679
642
  );
680
643
  return;
681
644
  }
682
- let $req = obj.where.$req;
683
- let $res = obj.where.$res;
684
-
685
- delete obj.where.$req;
686
- delete obj.where.$res;
687
645
 
688
646
  _mongo.connectDB(obj.dbName, function (err, db) {
689
647
  if (!err) {
@@ -697,8 +655,7 @@ module.exports = function init(____0) {
697
655
  {
698
656
  db: obj.dbName,
699
657
  collection: obj.collectionName,
700
- $req: $req,
701
- $res: $res,
658
+
702
659
  count: result.deletedCount,
703
660
  },
704
661
  result
@@ -707,8 +664,7 @@ module.exports = function init(____0) {
707
664
  ____0.call('mongodb after delete many', {
708
665
  db: obj.dbName,
709
666
  collection: obj.collectionName,
710
- $req: $req,
711
- $res: $res,
667
+
712
668
  where: obj.where,
713
669
  count: result.deletedCount,
714
670
  });
package/lib/parser.js CHANGED
@@ -80,7 +80,7 @@ module.exports = function init(req, res, ____0, route) {
80
80
  }
81
81
  }
82
82
 
83
- return out || renderWord(d);
83
+ return out || '';
84
84
  }
85
85
 
86
86
  function renderUser(v) {
@@ -345,7 +345,7 @@ module.exports = function init(req, res, ____0, route) {
345
345
  return txt;
346
346
  } else if (name.endsWith('.html')) {
347
347
  let txt = ____0.readFileSync(path);
348
- let $ = ____0.$.load(txt);
348
+ let $ = ____0.$.load(txt, null, false);
349
349
  $ = renderHtml($);
350
350
  return $.html();
351
351
  } else if (name.endsWith('.js')) {
@@ -362,6 +362,100 @@ module.exports = function init(req, res, ____0, route) {
362
362
  }
363
363
  }
364
364
 
365
+ function handleXList1($, el, data) {
366
+ let property = $(el).attr('x-list1').split('.');
367
+ $(el).removeAttr('x-list1');
368
+ let list = null;
369
+ let html2 = '';
370
+ if (property.length > 0) {
371
+ if (property[0] == '*') {
372
+ list = data;
373
+ } else {
374
+ list = data[property[0]];
375
+ }
376
+ }
377
+ if (list && property.length > 1) {
378
+ list = list[property[1]];
379
+ }
380
+ if (Array.isArray(list)) {
381
+ let matches = $.html(el).match(/##item1.*?##/g);
382
+ list.forEach((item, i) => {
383
+ $(el).attr('x-item1', i);
384
+ let _html = $.html(el);
385
+ if (matches) {
386
+ for (let i = 0; i < matches.length; i++) {
387
+ let p = matches[i].replace('##item1.', '').replace('##', '').split('.');
388
+ let v = null;
389
+ if (p.length > 0) {
390
+ v = item[p[0]];
391
+ }
392
+ if (p.length > 1 && v) {
393
+ v = v[p[1]];
394
+ }
395
+ if (p.length > 2 && v) {
396
+ v = v[p[2]];
397
+ }
398
+
399
+ _html = _html.replace(matches[i], v || '');
400
+ }
401
+ }
402
+ let $2 = ____0.$.load(_html);
403
+ $2('[x-list2]').each(function (i2, elem2) {
404
+ $(handleXList2($2, elem2, item)).insertAfter($(this));
405
+ $(this).remove();
406
+ });
407
+ html2 += $2.html();
408
+ });
409
+ }
410
+ return html2;
411
+ }
412
+
413
+ function handleXList2($, el, data) {
414
+ let property = $(el).attr('x-list2').split('.');
415
+ $(el).removeAttr('x-list2');
416
+ let list = null;
417
+ let html2 = '';
418
+ if (property.length > 0) {
419
+ if (property[0] == '*') {
420
+ list = data;
421
+ } else {
422
+ list = data[property[0]];
423
+ }
424
+ }
425
+ if (list && property.length > 1) {
426
+ list = list[property[1]];
427
+ }
428
+ if (Array.isArray(list)) {
429
+ let matches = $.html(el).match(/##item2.*?##/g);
430
+ list.forEach((item, i) => {
431
+ $(el).attr('x-item2', i);
432
+ let _html = $.html(el);
433
+ if (matches) {
434
+ for (let i = 0; i < matches.length; i++) {
435
+ let p = matches[i].replace('##item2.', '').replace('##', '').split('.');
436
+ let v = null;
437
+ if (p.length > 0) {
438
+ if (p[0] == '*') {
439
+ v = item;
440
+ } else {
441
+ v = item[p[0]];
442
+ }
443
+ }
444
+ if (p.length > 1 && v) {
445
+ v = v[p[1]];
446
+ }
447
+ if (p.length > 2 && v) {
448
+ v = v[p[2]];
449
+ }
450
+ _html = _html.replace(matches[i], v || '');
451
+ }
452
+ }
453
+ html2 += _html;
454
+ });
455
+ }
456
+ return html2;
457
+ }
458
+
365
459
  function renderHtml($, log) {
366
460
  $('[x-setting]').each(function (i, elem) {
367
461
  if (____0.setting[$(this).attr('x-setting')] !== true) {
@@ -520,6 +614,10 @@ module.exports = function init(req, res, ____0, route) {
520
614
  }
521
615
  });
522
616
 
617
+ $('[x-list1]').each(function (i, elem) {
618
+ $(handleXList1($, elem, req.data)).insertAfter($(this));
619
+ $(this).remove();
620
+ });
523
621
  return $;
524
622
  }
525
623
 
package/lib/routing.js CHANGED
@@ -363,6 +363,7 @@ module.exports = function init(____0) {
363
363
  route.public = r.public ?? (____0.options.public || false);
364
364
  route.method = r.method || 'GET';
365
365
  route.path = r.path || null;
366
+ route.lang = r.lang || null;
366
367
  route.content = r.content;
367
368
  route.headers = r.headers;
368
369
  route.parser = r.parser || 'static';
@@ -557,6 +558,9 @@ module.exports = function init(____0) {
557
558
  };
558
559
 
559
560
  _0xrrxo.handleRoute = async function (req, res, route) {
561
+ if (route.lang) {
562
+ req.session.lang = route.lang;
563
+ }
560
564
  if (!route.public) {
561
565
  if (!route.name.like(____0.strings[15]) && route.require.features.length > 0) {
562
566
  let ok = !0;
@@ -651,6 +655,28 @@ module.exports = function init(____0) {
651
655
  });
652
656
  };
653
657
 
658
+ req.getUserFinger = function () {
659
+ let userFinger = {
660
+ id: null,
661
+ email: null,
662
+ date: new Date(),
663
+ ip: null,
664
+ };
665
+
666
+ if (req && req.session && req.session.user) {
667
+ req.session.user.profile = req.session.user.profile || {};
668
+ userFinger.id = req.session.user.id;
669
+ userFinger.email = req.session.user.email;
670
+ userFinger.name = req.session.user.profile.name || userFinger.email;
671
+ userFinger.name_ar = req.session.user.profile.name_ar || userFinger.email;
672
+ userFinger.name_en = req.session.user.profile.name_en || userFinger.email;
673
+ userFinger.ip = req.ip;
674
+ } else {
675
+ }
676
+
677
+ return userFinger;
678
+ };
679
+
654
680
  res.code = null;
655
681
  req.socket.remoteAddress = req.socket.remoteAddress || '';
656
682
  req.acceptEncoding = req.headers[____0.strings[5]] ? req.headers[____0.strings[5]] : '';
@@ -845,7 +871,7 @@ module.exports = function init(____0) {
845
871
  req.content = ____0.parser(req, res, ____0, req.route).html(req.content);
846
872
  }
847
873
 
848
- res.status(200);
874
+ res.status(options.code || 200);
849
875
 
850
876
  if (req.route.compress) {
851
877
  req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
@@ -1020,9 +1046,9 @@ module.exports = function init(____0) {
1020
1046
  }
1021
1047
  };
1022
1048
 
1023
- res.redirect = (url) => {
1049
+ res.redirect = (url, code) => {
1024
1050
  res.set('Location', url);
1025
- res.status(302).end();
1051
+ res.status(code || 302).end();
1026
1052
  };
1027
1053
 
1028
1054
  res.setHeader('CharSet', 'UTF-8');
@@ -1034,6 +1060,11 @@ module.exports = function init(____0) {
1034
1060
  res.setHeader('Access-Control-Allow-Origin', req.headers.origin);
1035
1061
  }
1036
1062
 
1063
+ if (____0.options.www === false && req.headers.host.contains('www')) {
1064
+ res.redirect('//' + req.headers.host.replace('www.', '') + req.url, 301);
1065
+ return;
1066
+ }
1067
+
1037
1068
  if (!req.urlParser.pathname.like(____0.strings[0])) {
1038
1069
  if (!____0._0_a405) {
1039
1070
  res.status(405);
package/lib/sessions.js CHANGED
@@ -127,7 +127,7 @@ module.exports = function init(____0) {
127
127
  sessions.list.push(session);
128
128
  callback(sessions.list[session.$index]);
129
129
  }
130
- });
130
+ } , true);
131
131
  } else {
132
132
  session.$new = !0;
133
133
  session.lang = ____0.options.lang;
package/lib/words.js CHANGED
@@ -103,7 +103,7 @@ module.exports = function init(____0) {
103
103
  }
104
104
  };
105
105
 
106
- words.addApp = function (app_path) {
106
+ words.addPath = function (app_path) {
107
107
  words.addList(app_path + '/site_files/json/words.json' , false);
108
108
  };
109
109
 
@@ -44,6 +44,7 @@ function setOptions(_options, ____0) {
44
44
  _0xmmxo: '26719191',
45
45
  _0xyyxo: '2654127326719191',
46
46
  ipLookup: false,
47
+ www: true,
47
48
  subDomainIntegration: false,
48
49
  domainIntegration: false,
49
50
  portIntegration: false,
@@ -163,6 +164,7 @@ function setOptions(_options, ____0) {
163
164
  _x0oo.subDomainIntegration = _x0oo.subDomainIntegration ?? !1;
164
165
  _x0oo.domainIntegration = _x0oo.domainIntegration ?? !1;
165
166
  _x0oo.portIntegration = _x0oo.portIntegration ?? !1;
167
+ _x0oo.www = _x0oo.www ?? template.www;
166
168
 
167
169
  _x0oo.https = _x0oo.https || template.https;
168
170
  _x0oo.https.enabled = _x0oo.https.enabled ?? template.https.enabled;
@@ -31,6 +31,42 @@ exports = module.exports = function init(____0) {
31
31
  return exports;
32
32
  };
33
33
 
34
+ fn.fetchURLContent = function (options, callback) {
35
+ if (typeof options == 'string') {
36
+ options = {
37
+ url: options,
38
+ };
39
+ }
40
+ return ____0
41
+
42
+ .fetch(options.url, {
43
+ mode: 'cors',
44
+ method: 'get',
45
+ headers: {
46
+ 'User-Agent': `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.${Date.now()} Safari/537.36`,
47
+ },
48
+ redirect: 'follow',
49
+ agent: function (_parsedURL) {
50
+ if (_parsedURL.protocol == 'http:') {
51
+ return new ____0.http.Agent({
52
+ keepAlive: true,
53
+ });
54
+ } else {
55
+ return new ____0.https.Agent({
56
+ keepAlive: true,
57
+ });
58
+ }
59
+ },
60
+ })
61
+ .then((res) => {
62
+ if (callback) {
63
+ callback(res.text());
64
+ } else {
65
+ return res;
66
+ }
67
+ });
68
+ };
69
+
34
70
  fn.get_RegExp = function (txt, flag) {
35
71
  try {
36
72
  return new RegExp(txt, flag);
@@ -50,6 +86,11 @@ exports = module.exports = function init(____0) {
50
86
  });
51
87
  };
52
88
 
89
+ fn.random = function (min, max) {
90
+ max = max + 1;
91
+ return Math.floor(Math.random() * (max - min) + min);
92
+ };
93
+
53
94
  fn.guid = function () {
54
95
  function s4() {
55
96
  return Math.floor((1 + Math.random()) * 0x10000)
@@ -429,10 +470,12 @@ exports = module.exports = function init(____0) {
429
470
  ____0.typeof = ____0.typeOf = fn.typeOf;
430
471
  ____0.objectDiff = fn.objectDiff;
431
472
  ____0.toHtmlTable = fn.toHtmlTable;
473
+ ____0.random = fn.random;
432
474
 
433
475
  ____0.exe = fn.exe;
434
476
  ____0.guid = fn.guid;
435
- ____0.get_RegExp = fn.get_RegExp;
477
+ ____0.getRegExp = ____0.get_RegExp = fn.get_RegExp;
478
+ ____0.fetchURLContent = fn.fetchURLContent;
436
479
 
437
480
  ____0._0_car_0_ /* 4178525741786551413872654579465146593768 */ = function () {
438
481
  ____0._0_ar_0_ /* 413872654579465146593768 */ = ____0.storage('_db_ardb') ?? !0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2022.09.23",
3
+ "version": "2023.01.01",
4
4
  "description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "license": "UNLICENSED",
38
38
  "dependencies": {
39
39
  "archiver": "^5.0.2",
40
- "cheerio": "^1.0.0-rc.10",
40
+ "cheerio": "^1.0.0-rc.12",
41
41
  "formidable": "^2.0.1",
42
42
  "md5": "^2.3.0",
43
43
  "mongodb": "^4.2.2",