isite 2022.8.4 → 2022.8.7

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