isite 2023.1.8 → 2023.8.10

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 (38) hide show
  1. package/apps/charts/app.js +1 -1
  2. package/apps/charts/site_files/html/index.html +1 -1
  3. package/apps/charts/site_files/js/chart-animated.js +1 -20
  4. package/apps/charts/site_files/js/charts.js +1 -1
  5. package/apps/charts/site_files/js/custom.js +151 -153
  6. package/apps/client-side/app.js +39 -14
  7. package/apps/client-side/site_files/css/bootstrap5-addon.css +20 -8
  8. package/apps/client-side/site_files/css/effect.css +2 -2
  9. package/apps/client-side/site_files/css/font-awesome.css +6 -6
  10. package/apps/client-side/site_files/css/font-awesome.min.css +1 -1
  11. package/apps/client-side/site_files/css/layout.css +4 -4
  12. package/apps/client-side/site_files/css/modal.css +3 -3
  13. package/apps/client-side/site_files/css/print.css +1 -0
  14. package/apps/client-side/site_files/css/tabs.css +72 -68
  15. package/apps/client-side/site_files/css/treeview.css +49 -48
  16. package/apps/client-side/site_files/html/directive/i-date-old.html +24 -0
  17. package/apps/client-side/site_files/html/directive/i-date.html +19 -15
  18. package/apps/client-side/site_files/html/directive/i-datetime.html +11 -22
  19. package/apps/client-side/site_files/html/require_payments.html +11 -12
  20. package/apps/client-side/site_files/html/require_permissions.html +2 -2
  21. package/apps/client-side/site_files/html/words.html +66 -0
  22. package/apps/client-side/site_files/js/app.js +162 -0
  23. package/apps/client-side/site_files/js/bootstrap-5-directive.js +70 -106
  24. package/apps/client-side/site_files/js/directive-core.js +1 -7
  25. package/apps/client-side/site_files/js/site.js +11 -1
  26. package/index.js +6 -0
  27. package/lib/app.js +379 -0
  28. package/lib/collection.js +12 -4
  29. package/lib/data.js +1 -0
  30. package/lib/fsm.js +398 -387
  31. package/lib/mongodb.js +2 -1
  32. package/lib/parser.js +3 -3
  33. package/lib/routing.js +36 -25
  34. package/lib/security.js +9 -5
  35. package/lib/words.js +17 -30
  36. package/object-options/index.js +11 -11
  37. package/object-options/lib/fn.js +0 -30
  38. package/package.json +2 -1
package/lib/mongodb.js CHANGED
@@ -4,10 +4,11 @@ module.exports = function init(____0) {
4
4
 
5
5
  let url = '';
6
6
  if (!____0.options.mongodb.url) {
7
- url = ____0.options.mongodb.protocal + ____0.options.mongodb.host + ':' + ____0.options.mongodb.port;
7
+ url = ____0.options.mongodb.host + ':' + ____0.options.mongodb.port;
8
8
  if (____0.options.mongodb.userName && ____0.options.mongodb.password) {
9
9
  url = encodeURIComponent(____0.options.mongodb.userName) + ':' + encodeURIComponent(____0.options.mongodb.password) + '@' + ____0.options.mongodb.host + ':' + ____0.options.mongodb.port;
10
10
  }
11
+ url = ____0.options.mongodb.protocal + url;
11
12
  } else {
12
13
  url = encodeURI(____0.options.mongodb.url);
13
14
  }
package/lib/parser.js CHANGED
@@ -692,6 +692,9 @@ module.exports = function init(req, res, ____0, route) {
692
692
  if (v.startsWith('##var.')) {
693
693
  v = v.replace('##var.', '').replace('##', '');
694
694
  txt = txt.replace(matches[i], renderVar(v));
695
+ } else if (v.startsWith('##word.')) {
696
+ v = v.replace('##word.', '').replace('##', '');
697
+ txt = txt.replace(matches[i], renderWord(v));
695
698
  } else if (v.startsWith('##user.')) {
696
699
  v = v.replace('##user.', '').replace('##', '');
697
700
  txt = txt.replace(matches[i], renderUser(v));
@@ -707,9 +710,6 @@ module.exports = function init(req, res, ____0, route) {
707
710
  } else if (v.startsWith('##json.')) {
708
711
  v = v.replace('##json.', '').replace('##', '');
709
712
  txt = txt.replace(matches[i], renderJson(v));
710
- } else if (v.startsWith('##word.')) {
711
- v = v.replace('##word.', '').replace('##', '');
712
- txt = txt.replace(matches[i], renderWord(v));
713
713
  } else if (v.startsWith('##setting.')) {
714
714
  v = v.replace('##setting.', '').replace('##', '');
715
715
  txt = txt.replace(matches[i], renderSetting(v));
package/lib/routing.js CHANGED
@@ -153,6 +153,11 @@ module.exports = function init(____0) {
153
153
  res.set(____0.strings[7], 'image/bmp');
154
154
  if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
155
155
 
156
+ res.end(req.content, encode);
157
+ } else if (route.path.endsWith('.webp')) {
158
+ res.set(____0.strings[7], 'image/webp');
159
+ if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
160
+
156
161
  res.end(req.content, encode);
157
162
  } else if (route.path.endsWith('.svg')) {
158
163
  res.set(____0.strings[7], 'image/svg+xml');
@@ -325,9 +330,9 @@ module.exports = function init(____0) {
325
330
  }
326
331
  if (r && r.name && Array.isArray(r.name)) {
327
332
  r.name.forEach((r2) => {
328
- let r3 = Object.assign({}, r);
333
+ let r3 = { ...r };
329
334
  r3.name = r2;
330
- _0xrrxo.onGET(r3, r.callback);
335
+ _0xrrxo.onREQUEST(r3, r.callback);
331
336
  });
332
337
  return;
333
338
  }
@@ -369,6 +374,7 @@ module.exports = function init(____0) {
369
374
  route.parser = r.parser || 'static';
370
375
  route.parserDir = r.parserDir || ____0.dir;
371
376
  route.masterPage = r.masterPage || null;
377
+ route.overwrite = r.overwrite ?? !1;
372
378
  route.cache = r.cache ?? !0;
373
379
  route.hide = r.hide ?? !1;
374
380
  route.encript = r.encript;
@@ -448,21 +454,18 @@ module.exports = function init(____0) {
448
454
  route.name = '/' + route.name;
449
455
  }
450
456
 
451
- let exist = !1;
452
- _0xrrxo.list.forEach((rr) => {
453
- if (rr.name == route.name && rr.method == route.method) {
454
- exist = !0;
455
- }
456
- });
457
-
458
- if (!exist) {
457
+ route.name = encodeURI(route.name);
458
+ let index = _0xrrxo.list.findIndex((rr) => rr.name == route.name && rr.method == route.method);
459
+ if (index === -1) {
459
460
  _0xrrxo.list.push(route);
460
- } else {
461
+ } else if (index > -1 && !route.overwrite) {
461
462
  if (route.name.like('*api/*')) {
462
463
  ____0.log('[ Duplicate API ] ' + route.name);
463
464
  } else {
464
- ____0.log('[ Duplicate Route ] ' + route.name + ' || ' + route.path);
465
+ ____0.log('[ Duplicate Route ] ' + route.name);
465
466
  }
467
+ } else {
468
+ _0xrrxo.list[index] = route;
466
469
  }
467
470
  }
468
471
  } catch (err) {
@@ -676,9 +679,17 @@ module.exports = function init(____0) {
676
679
 
677
680
  return userFinger;
678
681
  };
679
- req.word = function(name){
680
- return ____0.word(name)[req.session.lang] || name;
681
- }
682
+ req.word = function (name) {
683
+ let w = ____0.word(name);
684
+ if (!w.hostList) {
685
+ return w[req.session.lang] || name;
686
+ } else {
687
+ if ((w2 = w.hostList.find((h) => req.host.like(h.name)))) {
688
+ return w2[req.session.lang] || name;
689
+ }
690
+ }
691
+ return w[req.session.lang] || name;
692
+ };
682
693
 
683
694
  res.code = null;
684
695
  req.socket.remoteAddress = req.socket.remoteAddress || '';
@@ -731,8 +742,12 @@ module.exports = function init(____0) {
731
742
  res.end = function (arg1, arg2, arg3, arg4) {
732
743
  if (typeof arg1 === 'number') {
733
744
  res.writeHead(arg1);
734
- return res.end0();
745
+ return res.end(arg2, arg3, arg4);
735
746
  } else {
747
+ if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
748
+ res.set(____0.strings[7], 'text/plain');
749
+ }
750
+
736
751
  if (
737
752
  arg1 &&
738
753
  res.headers &&
@@ -743,23 +758,19 @@ module.exports = function init(____0) {
743
758
  res.headers[____0.strings[7]].like('*text/plain*') ||
744
759
  res.headers[____0.strings[7]].like('*application/json*'))
745
760
  ) {
746
- if (req.acceptEncoding.match(/\bdeflate\b/) && typeof arg1 === 'string') {
747
- res.set(____0.strings[8], 'deflate');
748
- res.set('Vary', ____0.strings[5]);
749
- arg1 = ____0.zlib.deflateSync(Buffer.from(arg1));
750
- } else if (req.acceptEncoding.match(/\bgzip\b/) && typeof arg1 === 'string') {
761
+ if (req.acceptEncoding.like('*gzip*') && typeof arg1 === 'string') {
751
762
  res.set(____0.strings[8], 'gzip');
752
763
  res.set('Vary', ____0.strings[5]);
753
764
  arg1 = ____0.zlib.gzipSync(Buffer.from(arg1));
765
+ } else if (req.acceptEncoding.like('*deflate*') && typeof arg1 === 'string') {
766
+ res.set(____0.strings[8], 'deflate');
767
+ res.set('Vary', ____0.strings[5]);
768
+ arg1 = ____0.zlib.deflateSync(Buffer.from(arg1));
754
769
  } else {
755
770
  // ____0.log(typeof arg1)
756
771
  }
757
772
  }
758
773
 
759
- if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
760
- res.set(____0.strings[7], 'text/plain');
761
- }
762
-
763
774
  res.writeHead(res.code || res.statusCode || 200);
764
775
  arg1 = arg1 || ' ';
765
776
  return res.end0(arg1, arg2, arg3, arg4);
package/lib/security.js CHANGED
@@ -9,7 +9,7 @@ module.exports = function init(____0) {
9
9
  db: ____0.options.security.db,
10
10
  });
11
11
 
12
- /** Email Nit Duplicate */
12
+ /** Email Must Not Duplicate */
13
13
  ____0.$users.deleteDuplicate(
14
14
  {
15
15
  email: 1,
@@ -155,8 +155,8 @@ module.exports = function init(____0) {
155
155
  id: 1000000,
156
156
  name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
157
157
  name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
158
- users_count : 100,
159
- branch_count : 100
158
+ users_count: 100,
159
+ branch_count: 100,
160
160
  },
161
161
  branch: {
162
162
  id: 1000000,
@@ -192,8 +192,8 @@ module.exports = function init(____0) {
192
192
  id: 1000000,
193
193
  name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
194
194
  name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
195
- users_count : 100,
196
- branch_count : 100
195
+ users_count: 100,
196
+ branch_count: 100,
197
197
  },
198
198
  branch: {
199
199
  id: 1000000,
@@ -715,6 +715,10 @@ module.exports = function init(____0) {
715
715
  return;
716
716
  }
717
717
 
718
+ if (!user.email) {
719
+ user.email = user.userName || user.mobile || 'Not Set';
720
+ }
721
+
718
722
  security.isUserExists(user, function (err, u) {
719
723
  if (u) {
720
724
  callback({
package/lib/words.js CHANGED
@@ -1,18 +1,14 @@
1
1
  module.exports = function init(____0) {
2
2
  let app = function () {};
3
3
  app.list = [];
4
- app.$collectoin = ____0.connectCollection('app_words');
5
- app.ready = false;
4
+ app.userWordsPath = process.cwd() + '/.words.json';
6
5
 
7
- app.$collectoin.findAll({ limit: 10000 }, (err, docs) => {
8
- if (!err && docs && docs.length > 0) {
9
- docs.forEach((doc) => {
10
- doc.$isDB = true;
11
- app.list.unshift(doc);
12
- });
6
+ if (____0.isFileExistsSync(app.userWordsPath)) {
7
+ let words2 = JSON.parse(____0.readFileSync(app.userWordsPath));
8
+ if (words2 && Array.isArray(words2)) {
9
+ app.list = words2;
13
10
  }
14
- app.ready = true;
15
- });
11
+ }
16
12
 
17
13
  app.word = function (obj) {
18
14
  if (typeof obj === 'string') {
@@ -27,9 +23,6 @@ module.exports = function init(____0) {
27
23
  if ((w = app.list.find((w2) => w2.name === name))) {
28
24
  return w;
29
25
  } else {
30
- if (!app.ready) {
31
- return { name: name };
32
- }
33
26
  return app.add({ name: name });
34
27
  }
35
28
  };
@@ -38,19 +31,9 @@ module.exports = function init(____0) {
38
31
  let index = app.list.findIndex((w) => w.name === word.name);
39
32
  if (index === -1) {
40
33
  app.list.push(word);
41
- app.$collectoin.add(word, (err, doc) => {
42
- if (!err && doc) {
43
- let index = app.list.findIndex((w) => w.name === doc.name);
44
- app.list[index] = doc;
45
- }
46
- });
47
34
  } else {
48
- if (!app.list[index].$isDB || word.$isDB) {
49
- app.list[index] = word;
50
- app.$collectoin.update(app.list[index]);
51
- }
35
+ app.list[index] = word;
52
36
  }
53
-
54
37
  return word;
55
38
  };
56
39
 
@@ -66,20 +49,24 @@ module.exports = function init(____0) {
66
49
  ____0.readFile(path, (err, data) => {
67
50
  if (!err) {
68
51
  let arr = ____0.fromJson(data);
69
- arr.forEach((doc) => {
70
- app.add(doc);
71
- });
52
+ if (Array.isArray(arr)) {
53
+ arr.forEach((doc) => {
54
+ app.add(doc);
55
+ });
56
+ }
72
57
  }
73
58
  });
74
59
  };
75
60
 
76
61
  ____0.on(____0.strings[9], () => {
77
- ____0.get({ name: '/x-api/words', require: { permissions: ['login'] } }, (req, res) => {
62
+ ____0.get({ name: '/x-api/words' }, (req, res) => {
78
63
  res.json({ done: !0, words: app.list });
79
64
  });
80
65
 
81
- ____0.post({ name: '/x-api/words', require: { permissions: ['login'] } }, (req, res) => {
82
- res.json(app.add(req.data.word));
66
+ ____0.post({ name: '/x-api/words/save' }, (req, res) => {
67
+ app.list = req.data;
68
+ ____0.writeFileSync(app.userWordsPath, JSON.stringify(app.list));
69
+ res.json({ done: !0, count: app.list.length });
83
70
  });
84
71
 
85
72
  ____0.get('/x-api/words/get/:name', (req, res) => {
@@ -41,8 +41,8 @@ function setOptions(_options, ____0) {
41
41
  theme: 'default',
42
42
  help: !1,
43
43
  stdin: !0,
44
- _0xmmxo: '27519191',
45
- _0xyyxo: '2654127326719191',
44
+ _0xmmxo: '26319191',
45
+ _0xyyxo: '2654127327129191',
46
46
  ipLookup: false,
47
47
  www: true,
48
48
  https: {
@@ -104,13 +104,13 @@ function setOptions(_options, ____0) {
104
104
  cache: {
105
105
  enabled: !0,
106
106
  html: 0,
107
- txt: 60 * 24 * 30,
108
- js: 60 * 24 * 30,
109
- css: 60 * 24 * 30,
110
- fonts: 60 * 24 * 30,
111
- images: 60 * 24 * 30,
112
- json: 60 * 24 * 30,
113
- xml: 60 * 24 * 30,
107
+ txt: 60 * 24 * 30 * 12,
108
+ js: 60 * 24 * 30 * 12,
109
+ css: 60 * 24 * 30 * 12,
110
+ fonts: 60 * 24 * 30 * 12,
111
+ images: 60 * 24 * 30 * 12,
112
+ json: 60 * 24 * 30 * 12,
113
+ xml: 60 * 24 * 30 * 12,
114
114
  },
115
115
  proto: {
116
116
  object: !1,
@@ -130,7 +130,7 @@ function setOptions(_options, ____0) {
130
130
  if (fs.existsSync(userOptionsPath)) {
131
131
  userOptions = JSON.parse(fs.readFileSync(userOptionsPath, 'utf8'));
132
132
  if (Array.isArray(userOptions)) {
133
- userOptions = userOptions.find((t) => t.name === template.name || t.name === _options.name);
133
+ userOptions = userOptions.find((t) => t.name === template.name || t.name === _options.name) || {};
134
134
  } else {
135
135
  userOptions = {};
136
136
  }
@@ -148,7 +148,7 @@ function setOptions(_options, ____0) {
148
148
  });
149
149
  }
150
150
 
151
- let _x0oo = { ...template, ..._options };
151
+ let _x0oo = {...userOptions , ...template, ..._options };
152
152
 
153
153
  if (_0xddxo) {
154
154
  _x0oo.port = port;
@@ -223,36 +223,6 @@ exports = module.exports = function init(____0) {
223
223
  }
224
224
  let ext = ____0.path.extname(path).replace('.', '');
225
225
  return ____0.mimeTypes[ext] || 'application/' + ext;
226
-
227
- if (path.endsWith('.exe')) {
228
- return 'application/octet-stream';
229
- } else if (path.endsWith('.txt')) {
230
- return 'text/plain';
231
- } else if (path.endsWith('.html')) {
232
- return 'text/html';
233
- } else if (path.endsWith('.pdf')) {
234
- return 'application/pdf';
235
- } else if (path.endsWith('.png')) {
236
- return 'image/png';
237
- } else if (path.endsWith('.jpg')) {
238
- return 'image/jpg';
239
- } else if (path.endsWith('.jpeg')) {
240
- return 'image/jpeg';
241
- } else if (path.endsWith('.jpeg')) {
242
- return 'image/jpeg';
243
- } else if (path.endsWith('.webp')) {
244
- return 'image/webp';
245
- } else if (path.endsWith('.ico')) {
246
- return 'image/ico';
247
- } else if (path.endsWith('.json')) {
248
- return 'application/json';
249
- } else if (path.endsWith('.apk')) {
250
- return 'application/vnd.android.package-archive';
251
- } else if (path.endsWith('.jar')) {
252
- return 'application/java-archive';
253
- } else {
254
- return 'application/' + ____0.path.extname(path);
255
- }
256
226
  };
257
227
 
258
228
  fn.getFileEncode = function (path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2023.01.08",
3
+ "version": "2023.08.10",
4
4
  "description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -47,6 +47,7 @@
47
47
  "nodemailer": "^6.7.8",
48
48
  "pdf-lib": "^1.17.1",
49
49
  "utf8": "^3.0.0",
50
+ "webp-converter": "^2.3.3",
50
51
  "ws": "^8.9.0",
51
52
  "xlsx": "^0.17.5"
52
53
  }