isite 2022.8.5 → 2022.8.6

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 (39) hide show
  1. package/README.md +7 -7
  2. package/apps/client-side/app.js +251 -185
  3. package/apps/client-side/site_files/css/bootstrap5-addon.css +32 -5
  4. package/apps/client-side/site_files/css/bootstrap5.css +1 -1
  5. package/apps/client-side/site_files/css/bootstrap5.css.map +1 -0
  6. package/apps/client-side/site_files/css/effect.css +136 -77
  7. package/apps/client-side/site_files/css/layout.css +37 -44
  8. package/apps/client-side/site_files/css/modal.css +1 -1
  9. package/apps/client-side/site_files/css/normalize.css +146 -0
  10. package/apps/client-side/site_files/css/scrollbar.css +9 -5
  11. package/apps/client-side/site_files/html/directive/i-button.html +5 -0
  12. package/apps/client-side/site_files/html/directive/i-checkbox.html +4 -0
  13. package/apps/client-side/site_files/html/directive/i-checklist.html +6 -0
  14. package/apps/client-side/site_files/html/directive/i-control.html +5 -0
  15. package/apps/client-side/site_files/html/directive/i-date.html +21 -16
  16. package/apps/client-side/site_files/html/directive/i-datetime.html +31 -0
  17. package/apps/client-side/site_files/html/directive/i-file.html +3 -5
  18. package/apps/client-side/site_files/html/directive/i-list.html +2 -2
  19. package/apps/client-side/site_files/html/directive/i-radio.html +4 -0
  20. package/apps/client-side/site_files/html/directive/i-textarea.html +4 -0
  21. package/apps/client-side/site_files/html/directive/i-treenode.html +20 -0
  22. package/apps/client-side/site_files/html/directive/i-treeview.html +13 -0
  23. package/apps/client-side/site_files/html/directive/i-upload.html +5 -0
  24. package/apps/client-side/site_files/html/directive-core/i-date.html +64 -0
  25. package/apps/client-side/site_files/html/directive-core/i-list.html +22 -0
  26. package/apps/client-side/site_files/js/bootstrap-5-directive.js +226 -234
  27. package/apps/client-side/site_files/js/bootstrap.js.map +1 -0
  28. package/apps/client-side/site_files/js/directive.js +1865 -2044
  29. package/apps/client-side/site_files/js/directive.min.js +2 -2
  30. package/apps/client-side/site_files/js/site.js +1 -1
  31. package/apps/security/site_files/html/login_modal.html +18 -26
  32. package/index.js +2 -5
  33. package/lib/parser.js +519 -509
  34. package/lib/routing.js +21 -15
  35. package/lib/sessions.js +182 -247
  36. package/object-options/index.js +6 -4
  37. package/package.json +3 -2
  38. package/pull.bat +3 -0
  39. package/push.bat +2 -5
package/lib/routing.js CHANGED
@@ -354,7 +354,7 @@ module.exports = function init(____0) {
354
354
  permissions: [],
355
355
  };
356
356
  } else {
357
- route.require = ____0.options.requires;
357
+ route.require = ____0.options.require;
358
358
  route.default = ____0.options.defaults;
359
359
  }
360
360
  } else {
@@ -381,9 +381,9 @@ module.exports = function init(____0) {
381
381
  permissions: [],
382
382
  };
383
383
  } else {
384
- route.require = r.require ?? ____0.options.requires;
385
- route.require.features = route.require.features ?? ____0.options.requires.features;
386
- route.require.permissions = route.require.permissions ?? ____0.options.requires.permissions;
384
+ route.require = r.require ?? ____0.options.require;
385
+ route.require.features = route.require.features ?? ____0.options.require.features;
386
+ route.require.permissions = route.require.permissions ?? ____0.options.require.permissions;
387
387
 
388
388
  route.default = r.default ?? ____0.options.defaults;
389
389
  route.default.features = route.default.features ?? ____0.options.defaults.features;
@@ -595,24 +595,30 @@ module.exports = function init(____0) {
595
595
  }
596
596
  });
597
597
  if (!ok) {
598
- res.status(401);
598
+
599
599
  if (route.name.contains(____0.strings[16])) {
600
+ res.status(401);
600
601
  return res.json({
601
602
  done: !1,
602
603
  error: ____0.strings[14],
603
604
  permissions: route.require.permissions,
604
605
  });
605
606
  } else {
606
- return res.render(
607
- ____0.strings[12],
608
- {
609
- permissions: route.require.permissions.join(','),
610
- html: `${____0.strings[14]} : ${route.require.permissions.join(',')}`,
611
- },
612
- {
613
- parser: ____0.strings[17],
614
- }
615
- );
607
+ if (route.require.permissions.includes('login')) {
608
+ return res.redirect(____0.options.security.login_url);
609
+ } else {
610
+ res.status(401);
611
+ return res.render(
612
+ ____0.strings[12],
613
+ {
614
+ permissions: route.require.permissions.join(','),
615
+ html: `${____0.strings[14]} : ${route.require.permissions.join(',')}`,
616
+ },
617
+ {
618
+ parser: ____0.strings[17],
619
+ }
620
+ );
621
+ }
616
622
  }
617
623
  }
618
624
  }
package/lib/sessions.js CHANGED
@@ -1,272 +1,207 @@
1
1
  module.exports = function init(____0) {
2
- const sessions = function () {};
3
- sessions.list = [];
4
- let $sessions = {};
5
-
6
- if (____0.options.mongodb.enabled) {
7
- $sessions = ____0.connectCollection({
8
- db: ____0.options.session.db,
9
- collection: ____0.options.session.collection,
10
- });
11
- }
12
-
13
- ____0.on('[session][update]', (session) => {
14
- sessions.list.forEach((s) => {
15
- if (s.accessToken == session.accessToken) {
16
- for (let key in session) {
17
- if (session.hasOwnProperty(key) && key !== 'accessToken') {
18
- key = key.toLowerCase();
19
- for (let i = 0; i < s.data.length; i++) {
20
- let obj = s.data[i];
21
- if (obj.key === key) {
22
- s.data[i] = {
23
- key: key,
24
- value: session[key],
25
- };
26
- }
27
- }
28
- s.data.push({
29
- key: key,
30
- value: session[key],
31
- });
32
- }
33
- }
34
- }
35
- });
36
- });
37
- ____0.on('[session][delete]', (session) => {
38
- sessions.list.forEach((s, i) => {
39
- if (s.accessToken == session.accessToken) {
40
- sessions.list.splice(i, 1);
41
- }
42
- });
43
- });
44
- ____0.on('[session][user][update]', (user) => {
45
- sessions.list.forEach((s) => {
46
- if (s.user && s.user.id == user.id) {
47
- s.user = user;
48
- }
49
- });
50
- });
51
-
52
- sessions.loadAll = function (callback) {
53
- callback =
54
- callback ||
55
- function (err, docs) {
56
- if (!err && docs) {
57
- sessions.list = docs;
58
- }
59
- };
60
-
61
- if (____0.options.session.storage !== 'mongodb' || ____0.options.mongodb.enabled === !1) {
62
- callback(
63
- {
64
- message: 'storage not monodb',
65
- },
66
- null,
67
- );
68
-
69
- return;
70
- }
71
-
72
- $sessions.findMany(
73
- {
74
- where: {},
75
- select: {},
76
- limit: 100000,
77
- },
78
- function (err, docs) {
79
- callback(err, docs);
80
- },
81
- );
82
- };
83
-
84
- ____0.getSession = sessions.attach = function (session, callback) {
85
- callback = callback || function () {};
86
- session.$exists = !1;
87
-
88
- if (session.accessToken) {
89
- sessions.list.forEach((s, i) => {
90
- if (s.accessToken && s.accessToken == session.accessToken) {
91
- session.$exists = !0;
92
- session.$index = i;
93
- }
94
- });
2
+ const sessions = function () {};
3
+ sessions.list = [];
4
+ sessions.path = ____0.path.resolve(____0.cwd + '/' + ____0.options.name + '_' + 'sessions.db');
5
+ sessions.$collection = ____0.connectCollection({ collection: ____0.options.session.collection, db: ____0.options.session.db });
6
+
7
+ sessions.loadAll = function (callback) {
8
+ callback =
9
+ callback ||
10
+ function (err, docs) {
11
+ if (!err && docs) {
12
+ sessions.list = docs;
95
13
  }
96
-
97
- if (!session.$exists) {
98
- session.$new = !0;
99
- session.lang = ____0.options.lang;
100
- session.theme = ____0.options.theme;
101
- session.data = [];
102
- session.ip_info = session.ip_info || {};
103
- session.requestesCount = 1;
104
- session.createdTime = new Date().getTime();
105
- session.$index = sessions.list.length;
106
- sessions.list.push(session);
14
+ };
15
+ if (____0.options.session.storage === 'mongodb') {
16
+ sessions.$collection.findAll({}, (err, docs) => {
17
+ callback(err, docs);
18
+ });
19
+ } else {
20
+ let ss = ____0.readFileSync(sessions.path);
21
+ if (ss) {
22
+ try {
23
+ ss = JSON.parse(ss);
24
+ callback(null, ss);
25
+ console.log(' ... sessions Loaded From ...' + sessions.path);
26
+ } catch (err) {
27
+ console.log(err.message);
107
28
  }
29
+ }
30
+ }
108
31
 
109
- callback(sessions.list[session.$index]);
110
- return sessions.list[session.$index];
111
- };
112
-
113
- ____0.saveSession = sessions.save = function (session, callback) {
114
- callback = callback || function () {};
115
- session.$exists = !1;
32
+ return;
33
+ };
116
34
 
117
- if (session.$index && sessions.list[session.$index]) {
118
- sessions.list[session.$index] = { ...sessions.list[session.$index], ...session };
119
- callback(sessions.list[session.$index]);
120
- return sessions.list[session.$index];
121
- } else {
122
- sessions.list.forEach((s, i) => {
123
- if (session.$exists) {
124
- return;
125
- }
126
- if (s.accessToken == session.accessToken) {
127
- sessions.list[i] = { ...sessions.list[i], ...session };
128
- session.$exists = !0;
129
- session.$index = i;
130
- callback(sessions.list[session.$index]);
131
- return sessions.list[session.$index];
132
- }
133
- });
35
+ sessions.saveAll = function (callback) {
36
+ callback =
37
+ callback ||
38
+ function (err) {
39
+ if (err) {
40
+ console.log(err.message);
134
41
  }
135
- return sessions.list[session.$index];
136
- };
42
+ };
137
43
 
138
- ____0.on('[any][saving data]', function () {
139
- sessions.saveAll();
44
+ if (____0.options.session.timeout === 0 || !____0.options.session.enabled) {
45
+ callback({
46
+ message: 'Timout is Zero or not Enabled , Sessions Will Not Saved',
47
+ });
48
+ return;
49
+ }
50
+
51
+ sessions.list.forEach((s, i) => {
52
+ let online = new Date().getTime() - s.createdTime;
53
+ let timeout = 1000 * 60 * ____0.options.session.timeout;
54
+ if (online > timeout) {
55
+ sessions.list.splice(i, 1);
56
+ }
140
57
  });
58
+ if (____0.options.session.storage === 'mongodb') {
59
+ sessions.$collection.deleteAll({}, (err, docs) => {
60
+ sessions.$collection.insertAll(sessions.list, (err, docs) => {
61
+ callback(err, docs);
62
+ });
63
+ });
64
+ } else {
65
+ ____0.writeFile(sessions.path, JSON.stringify(sessions.list), () => {
66
+ callback(null, sessions.list);
67
+ console.log(' ... sessions Saved to ...' + sessions.path);
68
+ });
69
+ }
141
70
 
142
- sessions.busy = !1;
71
+ return;
72
+ };
143
73
 
144
- function loadAllSessions() {
145
- sessions.busy = !0;
74
+ sessions.loadAll();
146
75
 
147
- if (____0.options.session.storage !== 'mongodb' || !____0.options.mongodb.enabled) {
148
- sessions.busy = !1;
149
- return;
150
- }
76
+ ____0.getSession = sessions.attach = function (session, callback) {
77
+ callback = callback || function () {};
78
+ session.$exists = !1;
151
79
 
152
- sessions.loadAll((err, docs) => {
153
- sessions.busy = !1;
154
- if (!err) {
155
- sessions.list = docs;
156
- } else {
157
- console.log(err);
158
- setTimeout(() => {
159
- loadAllSessions();
160
- }, 250);
161
- }
162
- });
80
+ if (session.accessToken) {
81
+ sessions.list.forEach((s, i) => {
82
+ if (s.accessToken && s.accessToken == session.accessToken) {
83
+ session.$exists = !0;
84
+ session.$index = i;
85
+ }
86
+ });
163
87
  }
164
88
 
165
- sessions.saveAll = function (callback) {
166
- callback =
167
- callback ||
168
- function (err) {
169
- if (err) {
170
- console.log(err.message);
171
- }
172
- };
89
+ if (!session.$exists) {
90
+ session.$new = !0;
91
+ session.lang = ____0.options.lang;
92
+ session.theme = ____0.options.theme;
93
+ session.data = [];
94
+ session.ip_info = session.ip_info || {};
95
+ session.requestesCount = 1;
96
+ session.createdTime = new Date().getTime();
97
+ session.$index = sessions.list.length;
98
+ sessions.list.push(session);
99
+ }
173
100
 
174
- if (____0.options.session.timeout === 0) {
175
- callback({
176
- message: 'Timout is Zero And Sessions Will Not Saved In DB ',
177
- });
178
- return;
101
+ callback(sessions.list[session.$index]);
102
+ return sessions.list[session.$index];
103
+ };
104
+
105
+ ____0.saveSession = sessions.save = function (session, callback) {
106
+ callback = callback || function () {};
107
+ session.$exists = !1;
108
+
109
+ if (session.$index && sessions.list[session.$index]) {
110
+ sessions.list[session.$index] = { ...sessions.list[session.$index], ...session };
111
+ callback(sessions.list[session.$index]);
112
+ return sessions.list[session.$index];
113
+ } else {
114
+ sessions.list.forEach((s, i) => {
115
+ if (session.$exists) {
116
+ return;
179
117
  }
180
-
181
- sessions.list.forEach((s, i) => {
182
- let online = new Date().getTime() - s.createdTime;
183
- let timeout = 1000 * 60 * ____0.options.session.timeout;
184
- if (online > timeout) {
185
- sessions.list.splice(i, 1);
186
- }
187
- });
188
-
189
- if (____0.options.session.storage !== 'mongodb' || ____0.options.mongodb.enabled === !1) {
190
- callback(
191
- {
192
- message: 'Storage Not MongoDB || Not Enabled',
193
- },
194
- null,
195
- );
196
-
197
- return;
118
+ if (s.accessToken == session.accessToken) {
119
+ sessions.list[i] = { ...sessions.list[i], ...session };
120
+ session.$exists = !0;
121
+ session.$index = i;
122
+ callback(sessions.list[session.$index]);
123
+ return sessions.list[session.$index];
198
124
  }
199
-
200
- if (sessions.busy === !0) {
201
- ____0.log('Sessions is Busy');
202
- callback(
203
- {
204
- message: 'Sessions is Busy',
205
- },
206
- null,
207
- );
208
- return;
125
+ });
126
+ }
127
+ return sessions.list[session.$index];
128
+ };
129
+
130
+ ____0.on('[session][update]', (session) => {
131
+ sessions.list.forEach((s) => {
132
+ if (s.accessToken == session.accessToken) {
133
+ for (let key in session) {
134
+ if (session.hasOwnProperty(key) && key !== 'accessToken') {
135
+ key = key.toLowerCase();
136
+ for (let i = 0; i < s.data.length; i++) {
137
+ let obj = s.data[i];
138
+ if (obj.key === key) {
139
+ s.data[i] = {
140
+ key: key,
141
+ value: session[key],
142
+ };
143
+ }
144
+ }
145
+ s.data.push({
146
+ key: key,
147
+ value: session[key],
148
+ });
149
+ }
209
150
  }
210
-
211
- sessions.busy = !0;
212
-
213
- $sessions.deleteMany(
214
- {
215
- where: {},
216
- },
217
- function (err, result) {
218
- if (sessions.list.length === 0) {
219
- callback(
220
- {
221
- message: 'sessions is empty',
222
- },
223
- null,
224
- );
225
- sessions.busy = !1;
226
- return;
227
- }
228
-
229
- $sessions.insertMany(sessions.list, function (err, docs) {
230
- callback(err, docs);
231
- sessions.busy = !1;
232
- });
233
- },
234
- );
235
- };
236
-
237
- loadAllSessions();
238
-
239
- ____0.onPOST('/x-language/change', (req, res) => {
240
- req.session.lang = req.data.name;
241
- ____0.saveSession(req.session);
242
- res.json({
243
- done: true,
244
- lang: req.data.name,
245
- });
151
+ }
152
+ });
153
+ });
154
+ ____0.on('[session][delete]', (session) => {
155
+ sessions.list.forEach((s, i) => {
156
+ if (s.accessToken == session.accessToken) {
157
+ sessions.list.splice(i, 1);
158
+ }
159
+ });
160
+ });
161
+ ____0.on('[session][user][update]', (user) => {
162
+ sessions.list.forEach((s) => {
163
+ if (s.user && s.user.id == user.id) {
164
+ s.user = user;
165
+ }
246
166
  });
167
+ });
168
+
169
+ ____0.on('[any][saving data]', function () {
170
+ sessions.saveAll();
171
+ });
172
+
173
+ ____0.onPOST({ name: '/x-language/change', public: true }, (req, res) => {
174
+ req.session.lang = req.data.name;
175
+ ____0.saveSession(req.session);
176
+ res.json({
177
+ done: true,
178
+ lang: req.data.name,
179
+ });
180
+ });
247
181
 
248
- ____0.get('x-api/sessions', (req, res) => {
249
- res.json({
250
- done: !0,
251
- list: sessions.list,
252
- });
182
+ ____0.onPOST('x-api/sessions', (req, res) => {
183
+ res.json({
184
+ done: !0,
185
+ list: sessions.list,
253
186
  });
187
+ });
254
188
 
255
- ____0.get('x-api/sessions/save', (req, res) => {
256
- sessions.saveAll();
257
- res.json({
258
- done: !0,
259
- });
189
+ ____0.onPOST('x-api/sessions/save', (req, res) => {
190
+ sessions.saveAll();
191
+ res.json({
192
+ done: !0,
260
193
  });
261
- ____0.get('x-api/sessions/delete', (req, res) => {
262
- sessions.list = [];
263
- sessions.saveAll((err, docs) => {
264
- res.json({
265
- err: err,
266
- docs: docs,
267
- done: !0,
268
- });
269
- });
194
+ });
195
+ ____0.onPOST('x-api/sessions/delete', (req, res) => {
196
+ sessions.list = [];
197
+ sessions.saveAll((err, docs) => {
198
+ res.json({
199
+ err: err,
200
+ docs: docs,
201
+ done: !0,
202
+ });
270
203
  });
271
- return sessions;
204
+ });
205
+
206
+ return sessions;
272
207
  };
@@ -96,6 +96,7 @@ function setOptions(_options, ____0) {
96
96
  },
97
97
  security: {
98
98
  enabled: !0,
99
+ login_url : '/login',
99
100
  db: null,
100
101
  users_collection: 'users_info',
101
102
  roles_collection: 'users_roles',
@@ -118,7 +119,7 @@ function setOptions(_options, ____0) {
118
119
  object: !1,
119
120
  array: !0,
120
121
  },
121
- requires: {
122
+ require: {
122
123
  features: [____0._x0f1xo('4159236947792757465382744578276241387191')],
123
124
  permissions: [],
124
125
  },
@@ -202,6 +203,7 @@ function setOptions(_options, ____0) {
202
203
 
203
204
  _x0oo.security = _x0oo.security || template.security;
204
205
  _x0oo.security.enabled = _x0oo.security.enabled ?? template.security.enabled;
206
+ _x0oo.security.login_url = _x0oo.security.login_url || template.security.login_url;
205
207
  _x0oo.security.db = _x0oo.security.db || _x0oo.mongodb.db;
206
208
  _x0oo.security.users_collection = _x0oo.security.users_collection || template.security.users_collection;
207
209
  _x0oo.security.roles_collection = _x0oo.security.roles_collection || template.security.roles_collection;
@@ -225,9 +227,9 @@ function setOptions(_options, ____0) {
225
227
  _x0oo.cache.images = _x0oo.cache.images ?? template.cache.images;
226
228
  _x0oo.cache.txt = _x0oo.cache.txt ?? template.cache.txt;
227
229
 
228
- _x0oo.requires = _x0oo.requires || template.requires;
229
- _x0oo.requires.features = _x0oo.requires.features ?? template.requires.features;
230
- _x0oo.requires.permissions = _x0oo.requires.permissions ?? template.requires.permissions;
230
+ _x0oo.require = _x0oo.require || template.require;
231
+ _x0oo.require.features = _x0oo.require.features ?? template.require.features;
232
+ _x0oo.require.permissions = _x0oo.require.permissions ?? template.require.permissions;
231
233
 
232
234
  _x0oo.defaults = _x0oo.defaults || template.defaults;
233
235
  _x0oo.defaults.features = _x0oo.defaults.features ?? template.defaults.features;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2022.08.05",
3
+ "version": "2022.08.06",
4
4
  "description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -44,8 +44,9 @@
44
44
  "mv": "^2.1.1",
45
45
  "node-fetch": "^2.6.1",
46
46
  "nodemailer": "^6.7.8",
47
+ "pdf-lib": "^1.17.1",
47
48
  "utf8": "^3.0.0",
48
49
  "ws": "^8.2.3",
49
- "xlsx": "^0.17.4"
50
+ "xlsx": "^0.17.5"
50
51
  }
51
52
  }
package/pull.bat ADDED
@@ -0,0 +1,3 @@
1
+ git add *
2
+ git commit -m "tmp"
3
+ git pull
package/push.bat CHANGED
@@ -1,6 +1,3 @@
1
- ECHO OFF
2
1
  git add *
3
- git commit -m "02-02-2022"
4
- git push origin HEAD:master
5
- @echo "Push Done"
6
- PAUSE
2
+ git commit -m "update"
3
+ git push