isite 2022.8.3 → 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 (53) hide show
  1. package/README.md +7 -7
  2. package/apps/client-side/app.js +255 -182
  3. package/apps/client-side/site_files/css/bootstrap5-addon.css +87 -4
  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/dropdown.css +22 -4
  7. package/apps/client-side/site_files/css/effect.css +342 -283
  8. package/apps/client-side/site_files/css/images.css +10 -7
  9. package/apps/client-side/site_files/css/layout.css +37 -44
  10. package/apps/client-side/site_files/css/modal.css +1 -1
  11. package/apps/client-side/site_files/css/normalize.css +146 -0
  12. package/apps/client-side/site_files/css/scrollbar.css +9 -5
  13. package/apps/client-side/site_files/css/table.css +3 -3
  14. package/apps/client-side/site_files/html/directive/i-button.html +5 -0
  15. package/apps/client-side/site_files/html/directive/i-checkbox.html +4 -0
  16. package/apps/client-side/site_files/html/directive/i-checklist.html +6 -0
  17. package/apps/client-side/site_files/html/directive/i-control.html +5 -0
  18. package/apps/client-side/site_files/html/directive/i-date.html +24 -0
  19. package/apps/client-side/site_files/html/directive/i-datetime.html +31 -0
  20. package/apps/client-side/site_files/html/{sub/i-file.content.html → directive/i-file.html} +3 -5
  21. package/apps/client-side/site_files/html/directive/i-image.html +7 -0
  22. package/apps/client-side/site_files/html/directive/i-list.html +20 -0
  23. package/apps/client-side/site_files/html/directive/i-radio.html +4 -0
  24. package/apps/client-side/site_files/html/directive/i-textarea.html +4 -0
  25. package/apps/client-side/site_files/html/directive/i-treenode.html +20 -0
  26. package/apps/client-side/site_files/html/directive/i-treeview.html +13 -0
  27. package/apps/client-side/site_files/html/directive/i-upload.html +5 -0
  28. package/apps/client-side/site_files/html/directive-core/i-date.html +64 -0
  29. package/apps/client-side/site_files/html/directive-core/i-list.html +22 -0
  30. package/apps/client-side/site_files/images/no.jpg +0 -0
  31. package/apps/client-side/site_files/js/bootstrap-5-directive.js +278 -998
  32. package/apps/client-side/site_files/js/bootstrap.js.map +1 -0
  33. package/apps/client-side/site_files/js/directive.js +1865 -2044
  34. package/apps/client-side/site_files/js/directive.min.js +2 -2
  35. package/apps/client-side/site_files/js/site.js +19 -3
  36. package/apps/security/site_files/html/login_modal.html +18 -26
  37. package/index.js +277 -278
  38. package/isite_files/images/no.jpg +0 -0
  39. package/lib/cookie.js +3 -5
  40. package/lib/email.js +108 -0
  41. package/lib/integrated.js +10 -26
  42. package/lib/parser.js +519 -509
  43. package/lib/routing.js +23 -15
  44. package/lib/security.js +1109 -1081
  45. package/lib/sessions.js +182 -247
  46. package/object-options/index.js +24 -4
  47. package/object-options/lib/fn.js +6 -3
  48. package/package.json +5 -3
  49. package/pull.bat +3 -0
  50. package/push.bat +2 -5
  51. package/apps/client-side/site_files/html/sub/i-date2.content.html +0 -64
  52. package/apps/client-side/site_files/html/sub/i-list.content.html +0 -31
  53. package/apps/client-side/site_files/html/sub/i-list2.content.html +0 -22
package/lib/parser.js CHANGED
@@ -1,586 +1,596 @@
1
1
  module.exports = function init(req, res, ____0, route) {
2
- req.features = req.features || [];
2
+ req.features = req.features || [];
3
3
 
4
- let parser = {};
4
+ let parser = {};
5
5
 
6
- function renderVar(v) {
7
- if (v && v == '*') {
8
- return JSON.stringify(____0.var);
9
- }
10
- return ____0.var(v);
6
+ function renderVar(v) {
7
+ if (v && v == '*') {
8
+ return JSON.stringify(____0.var);
11
9
  }
12
-
13
- function renderParam(v) {
14
- if (typeof req.paramsRaw[v] !== undefined) {
15
- if (v && v == '*') {
16
- return JSON.stringify(req.paramsRaw);
17
- }
18
- return req.paramsRaw[v];
19
- }
20
-
21
- return ' ';
10
+ return ____0.var(v);
11
+ }
12
+
13
+ function renderParam(v) {
14
+ if (typeof req.paramsRaw[v] !== undefined) {
15
+ if (v && v == '*') {
16
+ return JSON.stringify(req.paramsRaw);
17
+ }
18
+ return req.paramsRaw[v];
22
19
  }
23
20
 
24
- function renderQuery(v) {
25
- if (typeof req.queryRaw[v] !== undefined) {
26
- if (v && v == '*') {
27
- return JSON.stringify(req.queryRaw);
28
- }
29
- return req.queryRaw[v];
30
- }
31
- return ' ';
21
+ return ' ';
22
+ }
23
+
24
+ function renderQuery(v) {
25
+ if (typeof req.queryRaw[v] !== undefined) {
26
+ if (v && v == '*') {
27
+ return JSON.stringify(req.queryRaw);
28
+ }
29
+ return req.queryRaw[v];
32
30
  }
31
+ return ' ';
32
+ }
33
33
 
34
- function renderData(d) {
35
- let out = null;
34
+ function renderData(d) {
35
+ let out = null;
36
36
 
37
- if (d && d == '*') {
38
- out = JSON.stringify(req.data);
39
- } else if (d) {
40
- v = d.split('.');
37
+ if (d && d == '*') {
38
+ out = JSON.stringify(req.data);
39
+ } else if (d) {
40
+ v = d.split('.');
41
41
 
42
- if (v.length > 0) {
43
- out = req.data[v[0]];
44
- }
42
+ if (v.length > 0) {
43
+ out = req.data[v[0]];
44
+ }
45
45
 
46
- if (v.length > 1 && out) {
47
- out = out[v[1]];
48
- }
46
+ if (v.length > 1 && out) {
47
+ out = out[v[1]];
48
+ }
49
49
 
50
- if (v.length > 2 && out) {
51
- out = out[v[2]];
52
- }
50
+ if (v.length > 2 && out) {
51
+ out = out[v[2]];
52
+ }
53
53
 
54
- if (v.length > 3 && out) {
55
- out = out[v[3]];
56
- }
54
+ if (v.length > 3 && out) {
55
+ out = out[v[3]];
56
+ }
57
57
 
58
- if (v.length > 4 && out) {
59
- out = out[v[4]];
60
- }
58
+ if (v.length > 4 && out) {
59
+ out = out[v[4]];
60
+ }
61
61
 
62
- if (v.length > 5 && out) {
63
- out = out[v[5]];
64
- }
65
- }
66
- if (out && typeof out == 'object') {
67
- out = JSON.stringify(out);
68
- }
69
- return out || renderWord(d);
62
+ if (v.length > 5 && out) {
63
+ out = out[v[5]];
64
+ }
70
65
  }
71
-
72
- function renderUser(v) {
73
- let user = req.session.user;
74
- if (user) {
75
- if (v && v == '*') {
76
- return JSON.stringify(user);
77
- } else if (v == 'email') {
78
- return user.email;
79
- } else if (v == 'name') {
80
- if (user.profile) {
81
- return user.profile.name || user.email;
82
- }
83
- return user.email;
84
- } else if (v == 'id') {
85
- return user.id;
86
- } else if (v == '_id') {
87
- return user._id;
88
- } else {
89
- let out = '';
90
- if (v) {
91
- v = v.split('.');
92
-
93
- if (v.length > 0) {
94
- out = user[v[0]];
95
- }
96
-
97
- if (v.length > 1 && out) {
98
- out = out[v[1]];
99
- }
100
-
101
- if (v.length > 2 && out) {
102
- out = out[v[2]];
103
- }
104
-
105
- if (v.length > 3 && out) {
106
- out = out[v[3]];
107
- }
108
-
109
- if (v.length > 4 && out) {
110
- out = out[v[4]];
111
- }
112
-
113
- if (v.length > 5 && out) {
114
- out = out[v[5]];
115
- }
116
- }
117
-
118
- if (typeof out === 'object') {
119
- out = ____0.toJson(out);
120
- }
121
-
122
- return out;
123
- }
124
- }
125
-
126
- return '';
66
+ if (out && typeof out == 'object') {
67
+ out = JSON.stringify(out);
127
68
  }
128
-
129
- function render_site(v) {
130
- if (v && v == '*') {
131
- return JSON.stringify(____0);
69
+ return out || renderWord(d);
70
+ }
71
+
72
+ function renderUser(v) {
73
+ let user = req.session.user;
74
+ if (user) {
75
+ if (v && v == '*') {
76
+ return JSON.stringify(user);
77
+ } else if (v == 'email') {
78
+ return user.email;
79
+ } else if (v == 'name') {
80
+ if (user.profile) {
81
+ return user.profile.name || user.email;
132
82
  }
83
+ return user.email;
84
+ } else if (v == 'id') {
85
+ return user.id;
86
+ } else if (v == '_id') {
87
+ return user._id;
88
+ } else {
133
89
  let out = '';
134
90
  if (v) {
135
- v = v.split('.');
91
+ v = v.split('.');
136
92
 
137
- if (v.length > 0) {
138
- out = ____0[v[0]];
139
- }
93
+ if (v.length > 0) {
94
+ out = user[v[0]];
95
+ }
140
96
 
141
- if (v.length > 1 && out) {
142
- out = out[v[1]];
143
- }
97
+ if (v.length > 1 && out) {
98
+ out = out[v[1]];
99
+ }
144
100
 
145
- if (v.length > 2 && out) {
146
- out = out[v[2]];
147
- }
101
+ if (v.length > 2 && out) {
102
+ out = out[v[2]];
103
+ }
148
104
 
149
- if (v.length > 3 && out) {
150
- out = out[v[3]];
151
- }
105
+ if (v.length > 3 && out) {
106
+ out = out[v[3]];
107
+ }
152
108
 
153
- if (v.length > 4 && out) {
154
- out = out[v[4]];
155
- }
109
+ if (v.length > 4 && out) {
110
+ out = out[v[4]];
111
+ }
156
112
 
157
- if (v.length > 5 && out) {
158
- out = out[v[5]];
159
- }
113
+ if (v.length > 5 && out) {
114
+ out = out[v[5]];
115
+ }
160
116
  }
161
117
 
162
118
  if (typeof out === 'object') {
163
- out = ____0.toJson(out);
119
+ out = ____0.toJson(out);
164
120
  }
165
121
 
166
122
  return out;
123
+ }
167
124
  }
168
125
 
169
- function render_req(v) {
170
- if (v && v == '*') {
171
- return JSON.stringify(req);
172
- }
173
- let out = '';
174
- if (v) {
175
- v = v.split('.');
126
+ return '';
127
+ }
176
128
 
177
- if (v.length > 0) {
178
- out = req[v[0]];
179
- }
129
+ function render_site(v) {
130
+ if (v && v == '*') {
131
+ return JSON.stringify(____0);
132
+ }
133
+ let out = '';
134
+ if (v) {
135
+ v = v.split('.');
180
136
 
181
- if (v.length > 1 && out) {
182
- out = out[v[1]];
183
- }
137
+ if (v.length > 0) {
138
+ out = ____0[v[0]];
139
+ }
184
140
 
185
- if (v.length > 2 && out) {
186
- out = out[v[2]];
187
- }
141
+ if (v.length > 1 && out) {
142
+ out = out[v[1]];
143
+ }
188
144
 
189
- if (v.length > 3 && out) {
190
- out = out[v[3]];
191
- }
145
+ if (v.length > 2 && out) {
146
+ out = out[v[2]];
147
+ }
192
148
 
193
- if (v.length > 4 && out) {
194
- out = out[v[4]];
195
- }
149
+ if (v.length > 3 && out) {
150
+ out = out[v[3]];
151
+ }
196
152
 
197
- if (v.length > 5 && out) {
198
- out = out[v[5]];
199
- }
200
- }
153
+ if (v.length > 4 && out) {
154
+ out = out[v[4]];
155
+ }
201
156
 
202
- if (typeof out === 'object') {
203
- out = ____0.toJson(out);
204
- }
205
-
206
- return out;
157
+ if (v.length > 5 && out) {
158
+ out = out[v[5]];
159
+ }
207
160
  }
208
161
 
209
- function renderSession(v) {
210
- if (v && v == '*') {
211
- return JSON.stringify({
212
- accessToken: req.session.accessToken,
213
- createdTime: req.session.createdTime,
214
- modifiedTime: req.session.modifiedTime,
215
- data: req.session.data,
216
- ip: req.session.ip,
217
- requestesCount: req.session.requestesCount,
218
- busy: req.session.$busy,
219
- ip_info: req.session.ip_info,
220
- });
221
- }
222
- if (v == 'lang') {
223
- return req.session.lang;
224
- } else if (v == 'theme') {
225
- return req.session.theme;
226
- } else {
227
- v = v.split('.');
228
- if (v.length === 1) {
229
- return req.session[v[0]];
230
- }
231
- if (v.length === 2) {
232
- let s1 = req.session[v[0]];
233
- if (s1) {
234
- return s1[v[1]];
235
- } else {
236
- return '';
237
- }
238
- }
239
- }
162
+ if (typeof out === 'object') {
163
+ out = ____0.toJson(out);
240
164
  }
241
165
 
242
- function renderJson(name) {
243
- return ____0.readFileSync(route.parserDir + '/json/' + name + '.json');
244
- }
166
+ return out;
167
+ }
245
168
 
246
- function renderWord(name) {
247
- let w = ____0.word(name);
248
- if (w.done) {
249
- return w[req.session.lang] || name;
250
- } else {
251
- return name;
252
- }
169
+ function render_req(v) {
170
+ if (!v) {
171
+ return '';
253
172
  }
254
-
255
- function renderSetting(v) {
256
- if (v && v == '*') {
257
- return JSON.stringify(____0.setting.list);
258
- }
259
- return ____0.setting.get(v).value;
173
+ let hide = false;
174
+ let out = '';
175
+ if (v.indexOf('#') == 0) {
176
+ v = v.replace('#', '');
177
+ hide = true;
178
+ }
179
+ if (v == '*') {
180
+ out = JSON.stringify(req);
181
+ } else {
182
+ v = v.split('.');
183
+
184
+ if (v.length > 0) {
185
+ out = req[v[0]];
186
+ }
187
+
188
+ if (v.length > 1 && out) {
189
+ out = out[v[1]];
190
+ }
191
+
192
+ if (v.length > 2 && out) {
193
+ out = out[v[2]];
194
+ }
195
+
196
+ if (v.length > 3 && out) {
197
+ out = out[v[3]];
198
+ }
199
+
200
+ if (v.length > 4 && out) {
201
+ out = out[v[4]];
202
+ }
203
+
204
+ if (v.length > 5 && out) {
205
+ out = out[v[5]];
206
+ }
260
207
  }
261
208
 
262
- function getContent(name) {
263
- let path = null;
264
-
265
- if (!path || !____0.isFileExistsSync(path)) {
266
- let arr = name.split('/');
267
- if (arr.length === 1) {
268
- path = ____0.path.join(____0.path.dirname(route.parserDir), 'site_files', ____0.path.extname(arr[0]).replace('.', ''), arr[0]);
269
- } else if (arr.length === 2) {
270
- path = ____0.path.join(____0.path.dirname(route.parserDir), 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[0], arr[1]);
271
- } else if (arr.length === 3) {
272
- path = ____0.path.join(____0.path.dirname(route.parserDir), 'site_files', ____0.path.extname(arr[2]).replace('.', ''), arr[0], arr[1], arr[2]);
273
- }
274
- }
275
-
276
- if (!____0.isFileExistsSync(path)) {
277
- let arr = name.split('/');
278
- if (arr.length === 2) {
279
- path = ____0.path.join(____0.path.dirname(route.parserDir), 'apps', arr[0], 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[1]);
280
- } else if (arr.length === 3) {
281
- path = ____0.path.join(____0.path.dirname(route.parserDir), 'apps', arr[0], 'site_files', ____0.path.extname(arr[2]).replace('.', ''), arr[1], arr[2]);
282
- }
283
- }
284
-
285
- if (!____0.isFileExistsSync(path)) {
286
- let arr = name.split('/');
287
- if (arr.length > 1) {
288
- ____0.apps.forEach((ap) => {
289
- if (arr.length === 2 && ap.name == arr[0]) {
290
- path = ____0.path.join(ap.path, 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[1]);
291
- } else if (arr.length === 2 && ap.name2 == arr[0]) {
292
- path = ____0.path.join(ap.path, 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[1]);
293
- } else if (arr.length === 3 && ap.name == arr[0]) {
294
- path = ____0.path.join(ap.path, 'site_files', ____0.path.extname(arr[2]).replace('.', ''), arr[1], arr[2]);
295
- }
296
- });
297
- }
298
- }
299
-
300
- if (!____0.isFileExistsSync(path)) {
301
- ____0.log(path, 'PATH NOT EXISTS parser.getContent()');
302
- return '';
303
- }
304
-
305
- if (name.endsWith('.content.html')) {
306
- let txt = ____0.readFileSync(path);
307
- return txt;
308
- } else if (name.endsWith('.html')) {
309
- let txt = ____0.readFileSync(path);
310
- let $ = ____0.$.load(txt);
311
- $ = renderHtml($);
312
- return $.html();
313
- } else if (name.endsWith('.js')) {
314
- let txt = ____0.readFileSync(path);
315
- txt = parser.js(txt);
316
- return txt;
317
- } else if (name.endsWith('.css')) {
318
- let txt = ____0.readFileSync(path);
319
- txt = parser.css(txt);
320
- return txt;
209
+ if (hide) {
210
+ out = ____0.hide(out);
211
+ } else {
212
+ if (typeof out === 'object') {
213
+ out = ____0.toJson(out);
214
+ }
215
+ }
216
+ return out;
217
+ }
218
+
219
+ function renderSession(v) {
220
+ if (v && v == '*') {
221
+ return JSON.stringify({
222
+ accessToken: req.session.accessToken,
223
+ createdTime: req.session.createdTime,
224
+ modifiedTime: req.session.modifiedTime,
225
+ data: req.session.data,
226
+ ip: req.session.ip,
227
+ requestesCount: req.session.requestesCount,
228
+ busy: req.session.$busy,
229
+ ip_info: req.session.ip_info,
230
+ });
231
+ }
232
+ if (v == 'lang') {
233
+ return req.session.lang;
234
+ } else if (v == 'theme') {
235
+ return req.session.theme;
236
+ } else {
237
+ v = v.split('.');
238
+ if (v.length === 1) {
239
+ return req.session[v[0]];
240
+ }
241
+ if (v.length === 2) {
242
+ let s1 = req.session[v[0]];
243
+ if (s1) {
244
+ return s1[v[1]];
321
245
  } else {
322
- let txt = ____0.readFileSync(path);
323
- return txt;
246
+ return '';
324
247
  }
248
+ }
325
249
  }
250
+ }
251
+
252
+ function renderJson(name) {
253
+ return ____0.readFileSync(route.parserDir + '/json/' + name + '.json');
254
+ }
255
+
256
+ function renderWord(name) {
257
+ let w = ____0.word(name);
258
+ if (w.done) {
259
+ return w[req.session.lang] || name;
260
+ } else {
261
+ return name;
262
+ }
263
+ }
326
264
 
327
- function renderHtml($, log) {
328
- $('[x-setting]').each(function (i, elem) {
329
- if (!____0.setting.get($(this).attr('x-setting')).value) {
330
- $(this).remove();
331
- }
332
- });
333
-
334
- $('[x-permission]').each(function (i, elem) {
335
- if (!____0.security.isUserHasPermission(req, res, $(this).attr('x-permission'))) {
336
- $(this).remove();
337
- }
338
- });
339
-
340
- $('[x-role]').each(function (i, elem) {
341
- if (!____0.security.isUserHasRole(req, res, $(this).attr('x-role'))) {
342
- $(this).remove();
343
- }
344
- });
265
+ function renderSetting(v) {
266
+ if (v && v == '*') {
267
+ return JSON.stringify(____0.setting.list);
268
+ }
269
+ return ____0.setting.get(v).value;
270
+ }
271
+
272
+ function getContent(name) {
273
+ let path = null;
274
+
275
+ if (!path || !____0.isFileExistsSync(path)) {
276
+ let arr = name.split('/');
277
+ if (arr.length === 1) {
278
+ path = ____0.path.join(____0.path.dirname(route.parserDir), 'site_files', ____0.path.extname(arr[0]).replace('.', ''), arr[0]);
279
+ } else if (arr.length === 2) {
280
+ path = ____0.path.join(____0.path.dirname(route.parserDir), 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[0], arr[1]);
281
+ } else if (arr.length === 3) {
282
+ path = ____0.path.join(____0.path.dirname(route.parserDir), 'site_files', ____0.path.extname(arr[2]).replace('.', ''), arr[0], arr[1], arr[2]);
283
+ }
284
+ }
345
285
 
346
- $('[x-permissions]').each(function (i, elem) {
347
- if (!____0.security.isUserHasPermissions(req, res, $(this).attr('x-permissions'))) {
348
- $(this).remove();
349
- }
350
- });
286
+ if (!____0.isFileExistsSync(path)) {
287
+ let arr = name.split('/');
288
+ if (arr.length === 2) {
289
+ path = ____0.path.join(____0.path.dirname(route.parserDir), 'apps', arr[0], 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[1]);
290
+ } else if (arr.length === 3) {
291
+ path = ____0.path.join(____0.path.dirname(route.parserDir), 'apps', arr[0], 'site_files', ____0.path.extname(arr[2]).replace('.', ''), arr[1], arr[2]);
292
+ }
293
+ }
351
294
 
352
- $('[x-roles]').each(function (i, elem) {
353
- if (!____0.security.isUserHasRoles(req, res, $(this).attr('x-roles'))) {
354
- $(this).remove();
355
- }
295
+ if (!____0.isFileExistsSync(path)) {
296
+ let arr = name.split('/');
297
+ if (arr.length > 1) {
298
+ ____0.apps.forEach((ap) => {
299
+ if (arr.length === 2 && ap.name == arr[0]) {
300
+ path = ____0.path.join(ap.path, 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[1]);
301
+ } else if (arr.length === 2 && ap.name2 == arr[0]) {
302
+ path = ____0.path.join(ap.path, 'site_files', ____0.path.extname(arr[1]).replace('.', ''), arr[1]);
303
+ } else if (arr.length === 3 && ap.name == arr[0]) {
304
+ path = ____0.path.join(ap.path, 'site_files', ____0.path.extname(arr[2]).replace('.', ''), arr[1], arr[2]);
305
+ }
356
306
  });
307
+ }
308
+ }
357
309
 
358
- $('[x-lang]').each(function (i, elem) {
359
- if ($(this).attr('x-lang') !== req.session.lang) {
360
- $(this).remove();
361
- }
362
- });
310
+ if (!____0.isFileExistsSync(path)) {
311
+ ____0.log(path, 'PATH NOT EXISTS parser.getContent()');
312
+ return '';
313
+ }
363
314
 
364
- $('[x-feature]').each(function (i, elem) {
365
- let f = $(this).attr('x-feature');
366
- let not = !1;
367
- if (f.startsWith('!')) {
368
- f = f.replace('!', '');
369
- not = !0;
370
- }
371
- if (!req.features.some((ff) => ff.like(f)) && !not) {
372
- $(this).remove();
373
- }
374
- if (req.features.some((ff) => ff.like(f)) && not) {
375
- $(this).remove();
376
- }
315
+ if (name.endsWith('.content.html')) {
316
+ let txt = ____0.readFileSync(path);
317
+ return txt;
318
+ } else if (name.endsWith('.html')) {
319
+ let txt = ____0.readFileSync(path);
320
+ let $ = ____0.$.load(txt);
321
+ $ = renderHtml($);
322
+ return $.html();
323
+ } else if (name.endsWith('.js')) {
324
+ let txt = ____0.readFileSync(path);
325
+ txt = parser.js(txt);
326
+ return txt;
327
+ } else if (name.endsWith('.css')) {
328
+ let txt = ____0.readFileSync(path);
329
+ txt = parser.css(txt);
330
+ return txt;
331
+ } else {
332
+ let txt = ____0.readFileSync(path);
333
+ return txt;
334
+ }
335
+ }
336
+
337
+ function renderHtml($, log) {
338
+ $('[x-setting]').each(function (i, elem) {
339
+ if (!____0.setting.get($(this).attr('x-setting')).value) {
340
+ $(this).remove();
341
+ }
342
+ });
343
+
344
+ $('[x-permission]').each(function (i, elem) {
345
+ if (!____0.security.isUserHasPermission(req, res, $(this).attr('x-permission'))) {
346
+ $(this).remove();
347
+ }
348
+ });
349
+
350
+ $('[x-role]').each(function (i, elem) {
351
+ if (!____0.security.isUserHasRole(req, res, $(this).attr('x-role'))) {
352
+ $(this).remove();
353
+ }
354
+ });
355
+
356
+ $('[x-permissions]').each(function (i, elem) {
357
+ if (!____0.security.isUserHasPermissions(req, res, $(this).attr('x-permissions'))) {
358
+ $(this).remove();
359
+ }
360
+ });
361
+
362
+ $('[x-roles]').each(function (i, elem) {
363
+ if (!____0.security.isUserHasRoles(req, res, $(this).attr('x-roles'))) {
364
+ $(this).remove();
365
+ }
366
+ });
367
+
368
+ $('[x-lang]').each(function (i, elem) {
369
+ if ($(this).attr('x-lang') !== req.session.lang) {
370
+ $(this).remove();
371
+ }
372
+ });
373
+
374
+ $('[x-feature]').each(function (i, elem) {
375
+ let f = $(this).attr('x-feature');
376
+ let not = !1;
377
+ if (f.startsWith('!')) {
378
+ f = f.replace('!', '');
379
+ not = !0;
380
+ }
381
+ if (!req.features.some((ff) => ff.like(f)) && !not) {
382
+ $(this).remove();
383
+ }
384
+ if (req.features.some((ff) => ff.like(f)) && not) {
385
+ $(this).remove();
386
+ }
387
+ });
388
+
389
+ $('[x-features]').each(function (i, elem) {
390
+ let fs = $(this).attr('x-features');
391
+ if (fs.indexOf('||') > -1) {
392
+ let del = !0;
393
+ fs.split('||').forEach((f) => {
394
+ f = f.trim();
395
+ let not = !1;
396
+ if (f.startsWith('!')) {
397
+ f = f.replace('!', '');
398
+ not = !0;
399
+ }
400
+ if (req.features.some((ff) => ff.like(f)) && !not) {
401
+ del = !1;
402
+ }
403
+ if (!req.features.some((ff) => ff.like(f)) && not) {
404
+ del = !1;
405
+ }
377
406
  });
378
407
 
379
- $('[x-features]').each(function (i, elem) {
380
- let fs = $(this).attr('x-features');
381
- if (fs.indexOf('||') > -1) {
382
- let del = !0;
383
- fs.split('||').forEach((f) => {
384
- f = f.trim();
385
- let not = !1;
386
- if (f.startsWith('!')) {
387
- f = f.replace('!', '');
388
- not = !0;
389
- }
390
- if (req.features.some((ff) => ff.like(f)) && !not) {
391
- del = !1;
392
- }
393
- if (!req.features.some((ff) => ff.like(f)) && not) {
394
- del = !1;
395
- }
396
- });
397
-
398
- if (del) {
399
- $(this).remove();
400
- }
401
- } else if (fs.indexOf('&&') > -1) {
402
- let ok_list = [];
403
- fs.split('&&').forEach((f) => {
404
- f = f.trim();
405
- let d = !0;
406
- if (f.startsWith('!')) {
407
- f = f.replace('!', '');
408
- d = !1;
409
- }
410
- if (!req.features.some((ff) => ff.like(f)) && !d) {
411
- ok_list.push({});
412
- }
413
- if (req.features.some((ff) => ff.like(f)) && d) {
414
- ok_list.push({});
415
- }
416
- });
417
- if (ok_list.length !== fs.split('&&').length) {
418
- $(this).remove();
419
- }
420
- } else {
421
- f = fs.trim();
422
- let d = !0;
423
- if (f.startsWith('!')) {
424
- f = f.replace('!', '');
425
- d = !1;
426
- }
427
- if (!req.features.some((ff) => ff.like(f)) && d) {
428
- $(this).remove();
429
- }
430
- if (req.features.some((ff) => ff.like(f)) && !d) {
431
- $(this).remove();
432
- }
433
- }
408
+ if (del) {
409
+ $(this).remove();
410
+ }
411
+ } else if (fs.indexOf('&&') > -1) {
412
+ let ok_list = [];
413
+ fs.split('&&').forEach((f) => {
414
+ f = f.trim();
415
+ let d = !0;
416
+ if (f.startsWith('!')) {
417
+ f = f.replace('!', '');
418
+ d = !1;
419
+ }
420
+ if (!req.features.some((ff) => ff.like(f)) && !d) {
421
+ ok_list.push({});
422
+ }
423
+ if (req.features.some((ff) => ff.like(f)) && d) {
424
+ ok_list.push({});
425
+ }
434
426
  });
435
-
436
- if (route.parser.like('*css*')) {
437
- $('style').each(function (i, elem) {
438
- $(this).html(parser.css($(this).html()));
439
- });
427
+ if (ok_list.length !== fs.split('&&').length) {
428
+ $(this).remove();
440
429
  }
441
-
442
- if (route.parser.like('*js*')) {
443
- $('script').each(function (i, elem) {
444
- $(this).html(parser.js($(this).html()));
445
- });
430
+ } else {
431
+ f = fs.trim();
432
+ let d = !0;
433
+ if (f.startsWith('!')) {
434
+ f = f.replace('!', '');
435
+ d = !1;
446
436
  }
437
+ if (!req.features.some((ff) => ff.like(f)) && d) {
438
+ $(this).remove();
439
+ }
440
+ if (req.features.some((ff) => ff.like(f)) && !d) {
441
+ $(this).remove();
442
+ }
443
+ }
444
+ });
447
445
 
448
- $($('[x-import]').get().reverse()).each(function (i, elem) {
449
- let file = $(this).attr('x-import');
450
- $(this).removeAttr('x-import');
451
- $(this).attr('x-server', 'x-import');
452
- if (file.endsWith('.html')) {
453
- $(this).html(getContent(file) + $(this).html());
454
- } else if (file.endsWith('.css')) {
455
- $(this).text(getContent(file) + $(this).html());
456
- } else {
457
- $(this).text(getContent(file) + $(this).text());
458
- }
459
- });
460
-
461
- $($('[x-append]').get().reverse()).each(function (i, elem) {
462
- let file = $(this).attr('x-append');
463
- $(this).removeAttr('x-append');
464
- $(this).attr('x-server', 'x-append');
465
- if (file.endsWith('.html')) {
466
- $(this).html($(this).html() + getContent(file));
467
- } else if (file.endsWith('.css')) {
468
- $(this).text($(this).html() + getContent(file));
469
- } else {
470
- $(this).text($(this).text() + getContent(file));
471
- }
472
- });
473
-
474
- $($('[x-replace]').get().reverse()).each(function (i, elem) {
475
- let file = $(this).attr('x-replace');
476
- $(this).removeAttr('x-replace');
477
- $(this).attr('x-server', 'x-replace');
478
- if (file.endsWith('.html')) {
479
- $(this).html(getContent(file));
480
- } else {
481
- $(this).text(getContent(file));
482
- }
483
- });
446
+ if (route.parser.like('*css*')) {
447
+ $('style').each(function (i, elem) {
448
+ $(this).html(parser.css($(this).html()));
449
+ });
450
+ }
484
451
 
485
- return $;
452
+ if (route.parser.like('*js*')) {
453
+ $('script').each(function (i, elem) {
454
+ $(this).html(parser.js($(this).html()));
455
+ });
486
456
  }
487
457
 
488
- parser.handleMatches = function (txt) {
489
- let matches = txt.match(/##.*?##/g);
490
- if (matches) {
491
- for (let i = 0; i < matches.length; i++) {
492
- let v = matches[i];
493
-
494
- if (v.startsWith('##var.')) {
495
- v = v.replace('##var.', '').replace('##', '');
496
- txt = txt.replace(matches[i], renderVar(v));
497
- } else if (v.startsWith('##user.')) {
498
- v = v.replace('##user.', '').replace('##', '');
499
- txt = txt.replace(matches[i], renderUser(v));
500
- } else if (v.startsWith('##site.')) {
501
- v = v.replace('##site.', '').replace('##', '');
502
- txt = txt.replace(matches[i], render_site(v));
503
- } else if (v.startsWith('##req.')) {
504
- v = v.replace('##req.', '').replace('##', '');
505
- txt = txt.replace(matches[i], render_req(v));
506
- } else if (v.startsWith('##session.')) {
507
- v = v.replace('##session.', '').replace('##', '');
508
- txt = txt.replace(matches[i], renderSession(v));
509
- } else if (v.startsWith('##json.')) {
510
- v = v.replace('##json.', '').replace('##', '');
511
- txt = txt.replace(matches[i], renderJson(v));
512
- } else if (v.startsWith('##word.')) {
513
- v = v.replace('##word.', '').replace('##', '');
514
- txt = txt.replace(matches[i], renderWord(v));
515
- } else if (v.startsWith('##setting.')) {
516
- v = v.replace('##setting.', '').replace('##', '');
517
- txt = txt.replace(matches[i], renderSetting(v));
518
- } else if (v.startsWith('##params.')) {
519
- v = v.replace('##params.', '').replace('##', '');
520
- txt = txt.replace(matches[i], renderParam(v));
521
- } else if (v.startsWith('##query.')) {
522
- v = v.replace('##query.', '').replace('##', '');
523
- txt = txt.replace(matches[i], renderQuery(v));
524
- } else if (v.startsWith('##data.')) {
525
- v = v.replace('##data.', '').replace('##', '');
526
- txt = txt.replace(matches[i], renderData(v));
527
- } else {
528
- }
529
- }
530
- }
531
- return txt;
532
- };
533
-
534
- parser.html = function (content) {
535
- let $ = ____0.$.load(content);
536
- $ = renderHtml($);
537
- txt = parser.handleMatches($.html());
538
- return txt;
539
- };
540
-
541
- parser.js = function (content) {
542
- let matches = content.match(/\/\*##.*?\*\//g);
543
- if (matches) {
544
- for (let i = 0; i < matches.length; i++) {
545
- let v = matches[i];
546
- v = v.replace('/*##', '').replace('*/', '');
547
- content = content.replace(matches[i], getContent(v));
548
- }
458
+ $($('[x-import]').get().reverse()).each(function (i, elem) {
459
+ let file = $(this).attr('x-import');
460
+ $(this).removeAttr('x-import');
461
+ $(this).attr('x-server', 'x-import');
462
+ if (file.endsWith('.html')) {
463
+ $(this).html(getContent(file) + $(this).html());
464
+ } else if (file.endsWith('.css')) {
465
+ $(this).text(getContent(file) + $(this).html());
466
+ } else {
467
+ $(this).text(getContent(file) + $(this).text());
468
+ }
469
+ });
470
+
471
+ $($('[x-append]').get().reverse()).each(function (i, elem) {
472
+ let file = $(this).attr('x-append');
473
+ $(this).removeAttr('x-append');
474
+ $(this).attr('x-server', 'x-append');
475
+ if (file.endsWith('.html')) {
476
+ $(this).html($(this).html() + getContent(file));
477
+ } else if (file.endsWith('.css')) {
478
+ $(this).text($(this).html() + getContent(file));
479
+ } else {
480
+ $(this).text($(this).text() + getContent(file));
481
+ }
482
+ });
483
+
484
+ $($('[x-replace]').get().reverse()).each(function (i, elem) {
485
+ let file = $(this).attr('x-replace');
486
+ $(this).removeAttr('x-replace');
487
+ $(this).attr('x-server', 'x-replace');
488
+ if (file.endsWith('.html')) {
489
+ $(this).html(getContent(file));
490
+ } else {
491
+ $(this).text(getContent(file));
492
+ }
493
+ });
494
+
495
+ return $;
496
+ }
497
+
498
+ parser.handleMatches = function (txt) {
499
+ let matches = txt.match(/##.*?##/g);
500
+ if (matches) {
501
+ for (let i = 0; i < matches.length; i++) {
502
+ let v = matches[i];
503
+
504
+ if (v.startsWith('##var.')) {
505
+ v = v.replace('##var.', '').replace('##', '');
506
+ txt = txt.replace(matches[i], renderVar(v));
507
+ } else if (v.startsWith('##user.')) {
508
+ v = v.replace('##user.', '').replace('##', '');
509
+ txt = txt.replace(matches[i], renderUser(v));
510
+ } else if (v.startsWith('##site.')) {
511
+ v = v.replace('##site.', '').replace('##', '');
512
+ txt = txt.replace(matches[i], render_site(v));
513
+ } else if (v.startsWith('##req.')) {
514
+ v = v.replace('##req.', '').replace('##', '');
515
+ txt = txt.replace(matches[i], render_req(v));
516
+ } else if (v.startsWith('##session.')) {
517
+ v = v.replace('##session.', '').replace('##', '');
518
+ txt = txt.replace(matches[i], renderSession(v));
519
+ } else if (v.startsWith('##json.')) {
520
+ v = v.replace('##json.', '').replace('##', '');
521
+ txt = txt.replace(matches[i], renderJson(v));
522
+ } else if (v.startsWith('##word.')) {
523
+ v = v.replace('##word.', '').replace('##', '');
524
+ txt = txt.replace(matches[i], renderWord(v));
525
+ } else if (v.startsWith('##setting.')) {
526
+ v = v.replace('##setting.', '').replace('##', '');
527
+ txt = txt.replace(matches[i], renderSetting(v));
528
+ } else if (v.startsWith('##params.')) {
529
+ v = v.replace('##params.', '').replace('##', '');
530
+ txt = txt.replace(matches[i], renderParam(v));
531
+ } else if (v.startsWith('##query.')) {
532
+ v = v.replace('##query.', '').replace('##', '');
533
+ txt = txt.replace(matches[i], renderQuery(v));
534
+ } else if (v.startsWith('##data.')) {
535
+ v = v.replace('##data.', '').replace('##', '');
536
+ txt = txt.replace(matches[i], renderData(v));
537
+ } else {
549
538
  }
550
- content = parser.handleMatches(content);
551
- return content;
552
- };
539
+ }
540
+ }
541
+ return txt;
542
+ };
543
+
544
+ parser.html = function (content) {
545
+ let $ = ____0.$.load(content);
546
+ $ = renderHtml($);
547
+ txt = parser.handleMatches($.html());
548
+ return txt;
549
+ };
550
+
551
+ parser.js = function (content) {
552
+ let matches = content.match(/\/\*##.*?\*\//g);
553
+ if (matches) {
554
+ for (let i = 0; i < matches.length; i++) {
555
+ let v = matches[i];
556
+ v = v.replace('/*##', '').replace('*/', '');
557
+ content = content.replace(matches[i], getContent(v));
558
+ }
559
+ }
560
+ content = parser.handleMatches(content);
561
+ return content;
562
+ };
553
563
 
554
- parser.css = function (content) {
555
- content = parser.handleMatches(content);
564
+ parser.css = function (content) {
565
+ content = parser.handleMatches(content);
556
566
 
557
- let matches = content.match(/var\(---.*?\)/g);
558
- if (matches) {
559
- for (let i = 0; i < matches.length; i++) {
560
- let v = matches[i];
567
+ let matches = content.match(/var\(---.*?\)/g);
568
+ if (matches) {
569
+ for (let i = 0; i < matches.length; i++) {
570
+ let v = matches[i];
561
571
 
562
- v = v.replace('var(---', '').replace(')', '');
563
- content = content.replace(matches[i], renderVar(v));
564
- }
565
- }
572
+ v = v.replace('var(---', '').replace(')', '');
573
+ content = content.replace(matches[i], renderVar(v));
574
+ }
575
+ }
566
576
 
567
- let matches2 = content.match(/word\(---.*?\)/g);
568
- if (matches2) {
569
- for (let i = 0; i < matches2.length; i++) {
570
- let v = matches2[i];
577
+ let matches2 = content.match(/word\(---.*?\)/g);
578
+ if (matches2) {
579
+ for (let i = 0; i < matches2.length; i++) {
580
+ let v = matches2[i];
571
581
 
572
- v = v.replace('word(---', '').replace(')', '');
573
- content = content.replace(matches2[i], renderWord(v));
574
- }
575
- }
582
+ v = v.replace('word(---', '').replace(')', '');
583
+ content = content.replace(matches2[i], renderWord(v));
584
+ }
585
+ }
576
586
 
577
- return content;
578
- };
587
+ return content;
588
+ };
579
589
 
580
- parser.json = function (content) {
581
- return content;
582
- };
590
+ parser.json = function (content) {
591
+ return content;
592
+ };
583
593
 
584
- parser.renderHtml = renderHtml;
585
- return parser;
594
+ parser.renderHtml = renderHtml;
595
+ return parser;
586
596
  };