isite 2024.8.5 → 2024.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.
- package/LICENSE +21 -21
- package/README.md +1384 -1387
- package/apps/charts/site_files/html/PieChart.html +35 -35
- package/apps/charts/site_files/html/PieChart2.html +35 -35
- package/apps/charts/site_files/html/XYChart.html +42 -42
- package/apps/charts/site_files/html/column.html +60 -60
- package/apps/charts/site_files/html/gauge.html +44 -44
- package/apps/charts/site_files/html/index.html +92 -92
- package/apps/charts/site_files/html/line-graph.html +42 -42
- package/apps/charts/site_files/html/pie-chart-rounded-corners.html +38 -38
- package/apps/charts/site_files/html/simple-3D-pie-chart.html +43 -43
- package/apps/charts/site_files/js/chart-animated.js +2 -2
- package/apps/charts/site_files/json/PieChart.json +41 -41
- package/apps/charts/site_files/json/PieChart2.json +23 -23
- package/apps/charts/site_files/json/XYChart.json +74 -74
- package/apps/charts/site_files/json/bar-chart.json +99 -99
- package/apps/charts/site_files/json/column-chart.json +80 -80
- package/apps/charts/site_files/json/gauge.json +36 -36
- package/apps/charts/site_files/json/line-graph.json +1867 -1867
- package/apps/charts/site_files/json/pie-chart-rounded-corners.json +42 -42
- package/apps/charts/site_files/json/simple-3D-pie-chart.json +50 -50
- package/apps/client-side/package-lock.json +5 -5
- package/apps/client-side/package.json +21 -21
- package/apps/client-side/site_files/css/bootstrap3.css +5 -5
- package/apps/client-side/site_files/css/bootstrap4.css +6 -6
- package/apps/client-side/site_files/css/bootstrap5.css +6 -6
- package/apps/client-side/site_files/css/checkbox.css +125 -125
- package/apps/client-side/site_files/css/font-awesome.css +4616 -4616
- package/apps/client-side/site_files/css/font-awesome.min.css +4 -4
- package/apps/client-side/site_files/css/fonts.css +85 -85
- package/apps/client-side/site_files/css/help.css +51 -51
- package/apps/client-side/site_files/css/main-menu.css +66 -66
- package/apps/client-side/site_files/css/print.css +144 -144
- package/apps/client-side/site_files/css/prism.css +139 -139
- package/apps/client-side/site_files/css/progress.css +7 -7
- package/apps/client-side/site_files/css/radio.css +103 -103
- package/apps/client-side/site_files/css/scrollbar.css +13 -13
- package/apps/client-side/site_files/css/semantic.css +363 -363
- package/apps/client-side/site_files/css/table.css +87 -87
- package/apps/client-side/site_files/css/treeview.css +84 -84
- package/apps/client-side/site_files/css/ui.css +28 -28
- package/apps/client-side/site_files/css/video-js.min.css +1 -0
- package/apps/client-side/site_files/fonts/fontawesome-webfont.svg +2671 -2671
- package/apps/client-side/site_files/fonts/glyphicons-halflings-regular.svg +287 -287
- package/apps/client-side/site_files/fonts/icons.svg +684 -684
- package/apps/client-side/site_files/js/Youtube.min.js +1 -0
- package/apps/client-side/site_files/js/angular-animate.js +4179 -4179
- package/apps/client-side/site_files/js/angular.js +36599 -36599
- package/apps/client-side/site_files/js/angular.min.js +351 -351
- package/apps/client-side/site_files/js/angular.min.js.map +8 -8
- package/apps/client-side/site_files/js/barcode.js +1 -1
- package/apps/client-side/site_files/js/base64.js +319 -319
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +1456 -1456
- package/apps/client-side/site_files/js/bootstrap3.js +6 -6
- package/apps/client-side/site_files/js/bootstrap4.js +6 -6
- package/apps/client-side/site_files/js/bootstrap5.js +6 -6
- package/apps/client-side/site_files/js/custom.js +149 -149
- package/apps/client-side/site_files/js/directive.min.js +1 -1
- package/apps/client-side/site_files/js/hijri.js +965 -965
- package/apps/client-side/site_files/js/jquery.js +2 -2
- package/apps/client-side/site_files/js/moment.js +4511 -4511
- package/apps/client-side/site_files/js/prism.js +6 -6
- package/apps/client-side/site_files/js/qrcode.js +1398 -1398
- package/apps/client-side/site_files/js/semantic.js +10 -10
- package/apps/client-side/site_files/js/video.min.js +53 -0
- package/apps/client-side/site_files/js/xlsx.js +23 -23
- package/apps/client-side/site_files/semantic-themes/default/assets/fonts/brand-icons.svg +1008 -1008
- package/apps/client-side/site_files/semantic-themes/default/assets/fonts/icons.svg +1518 -1518
- package/apps/client-side/site_files/semantic-themes/default/assets/fonts/outline-icons.svg +366 -366
- package/apps/client-side/site_files/webfonts/fa-brands-400.svg +3717 -3717
- package/apps/client-side/site_files/webfonts/fa-regular-400.svg +801 -801
- package/apps/client-side/site_files/webfonts/fa-solid-900.svg +5034 -5034
- package/apps/security/README.md +12 -12
- package/apps/security/app.js +288 -288
- package/apps/security/libs/notifications.js +89 -89
- package/apps/security/site_files/html/add_modal.html +36 -36
- package/apps/security/site_files/html/content.html +36 -36
- package/apps/security/site_files/html/delete_modal.html +31 -31
- package/apps/security/site_files/html/head.html +7 -7
- package/apps/security/site_files/html/index.html +80 -80
- package/apps/security/site_files/html/login_modal.html +24 -24
- package/apps/security/site_files/html/logout_modal.html +21 -21
- package/apps/security/site_files/html/navbar.html +8 -8
- package/apps/security/site_files/html/register_modal.html +32 -32
- package/apps/security/site_files/html/update_modal.html +28 -28
- package/apps/security/site_files/html/view.html +74 -74
- package/apps/security/site_files/html/view_modal.html +32 -32
- package/apps/security/site_files/js/app.js +1 -1
- package/apps/security/site_files/js/index.js +278 -278
- package/apps/security/site_files/js/login.js +35 -35
- package/apps/security/site_files/js/logout.js +22 -22
- package/apps/security/site_files/js/navbar.js +26 -26
- package/apps/security/site_files/js/register.js +30 -30
- package/apps/security/site_files/json/permissions.json +7 -7
- package/apps/security/site_files/json/roles.json +33 -33
- package/apps/security/site_files/json/words.json +28 -28
- package/gulpfile.js +17 -17
- package/isite.postman_collection.json +7 -7
- package/isite_files/css/bootstrap.css +5 -5
- package/isite_files/css/font-awesome.css +4 -4
- package/isite_files/css/prism.css +139 -139
- package/isite_files/fonts/fontawesome-webfont.svg +2671 -2671
- package/isite_files/fonts/glyphicons-halflings-regular.svg +287 -287
- package/isite_files/html/files.html +9 -9
- package/isite_files/html/head.html +12 -12
- package/isite_files/html/index.html +30 -30
- package/isite_files/html/installing.html +27 -27
- package/isite_files/html/navbar.html +51 -51
- package/isite_files/html/routes.html +13 -13
- package/isite_files/html/sessions.html +13 -13
- package/isite_files/html/vars.html +9 -9
- package/isite_files/js/angular.js +334 -334
- package/isite_files/js/bootstrap.js +6 -6
- package/isite_files/js/custom.js +149 -149
- package/isite_files/js/jquery.js +4 -4
- package/isite_files/js/prism.js +6 -6
- package/lib/README.md +1 -1
- package/lib/collection.js +92 -41
- package/lib/cookie.js +81 -81
- package/lib/dashboard.js +189 -189
- package/lib/mongodb.js +819 -756
- package/lib/parser.js +910 -910
- package/lib/security.js +48 -57
- package/lib/session.js +153 -153
- package/object-options/index.js +3 -3
- package/object-options/lib/isite.code-workspace +10 -10
- package/package.json +58 -58
- package/ssl/create_ssl.sh +3 -3
package/README.md
CHANGED
|
@@ -1,1387 +1,1384 @@
|
|
|
1
|
-
isite now integrated with Social Browser https://social-browser.com
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
npm
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
site.loadLocalApp('
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
site.loadLocalApp('
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
site.onGET({ name:
|
|
199
|
-
site.onGET({ name: '/
|
|
200
|
-
site.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
site.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
site.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
site.onGET('
|
|
284
|
-
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
site.
|
|
304
|
-
|
|
305
|
-
});
|
|
306
|
-
site.
|
|
307
|
-
|
|
308
|
-
});
|
|
309
|
-
site.
|
|
310
|
-
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
site.
|
|
355
|
-
|
|
356
|
-
});
|
|
357
|
-
site.
|
|
358
|
-
|
|
359
|
-
});
|
|
360
|
-
site.
|
|
361
|
-
|
|
362
|
-
});
|
|
363
|
-
site.
|
|
364
|
-
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
//
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
//
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
//
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
//
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
//
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
ws.
|
|
484
|
-
ws.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
ws.
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
site.
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
site.
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
site.
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
<
|
|
615
|
-
<
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
<
|
|
636
|
-
<h2
|
|
637
|
-
<h2>
|
|
638
|
-
|
|
639
|
-
<
|
|
640
|
-
<
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
<div x-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
<div x-
|
|
647
|
-
<div x-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
<div x-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
<div x-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
<div x-feature="os.
|
|
658
|
-
<div x-feature="os.
|
|
659
|
-
|
|
660
|
-
<div x-feature="os.
|
|
661
|
-
<div x-feature="
|
|
662
|
-
<div x-feature="os.
|
|
663
|
-
|
|
664
|
-
<div x-feature="os.
|
|
665
|
-
<div x-feature="os.
|
|
666
|
-
|
|
667
|
-
<div x-feature="os.
|
|
668
|
-
|
|
669
|
-
<div x-feature="
|
|
670
|
-
<div x-feature="
|
|
671
|
-
|
|
672
|
-
<div x-feature="browser.
|
|
673
|
-
<div x-feature="browser.
|
|
674
|
-
|
|
675
|
-
<div x-feature="
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
-
|
|
686
|
-
-
|
|
687
|
-
-
|
|
688
|
-
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
$employees = site.connectCollection("employees")
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
})
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
})
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
})
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
})
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
})
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
site.
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
site.on('mongodb after insert' , (result)=>{
|
|
847
|
-
|
|
848
|
-
})
|
|
849
|
-
site.on('mongodb after
|
|
850
|
-
|
|
851
|
-
})
|
|
852
|
-
site.on('mongodb after find' , (result)=>{
|
|
853
|
-
|
|
854
|
-
})
|
|
855
|
-
site.on('mongodb after
|
|
856
|
-
|
|
857
|
-
})
|
|
858
|
-
site.on('mongodb after update' , (result)=>{
|
|
859
|
-
|
|
860
|
-
})
|
|
861
|
-
site.on('mongodb after
|
|
862
|
-
|
|
863
|
-
})
|
|
864
|
-
site.on('mongodb after delete' , (result)=>{
|
|
865
|
-
|
|
866
|
-
})
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
//
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
//
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
<
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
$
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
site.
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
-
|
|
1096
|
-
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
<
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
-
|
|
1154
|
-
|
|
1155
|
-
```
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
```
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
<
|
|
1176
|
-
<
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
```
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
```
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
site.
|
|
1309
|
-
site.
|
|
1310
|
-
|
|
1311
|
-
var
|
|
1312
|
-
var
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
site.log(
|
|
1317
|
-
site.log(
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
})
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
});
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
-
|
|
1374
|
-
-
|
|
1375
|
-
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
-
|
|
1383
|
-
-
|
|
1384
|
-
-
|
|
1385
|
-
- Github : https://github.com/absunstar
|
|
1386
|
-
- Paypal : https://paypal.me/absunstar
|
|
1387
|
-
- What's up: +966568118373
|
|
1
|
+
isite now integrated with Social Browser https://social-browser.com so your site work on Social Browser by default
|
|
2
|
+
|
|
3
|
+
## Create [ Node Js Web Site ] Supporting Many Development features
|
|
4
|
+
|
|
5
|
+
- More Secure
|
|
6
|
+
- Multi Language
|
|
7
|
+
- Custom Apps [Modules]
|
|
8
|
+
- Best Performance
|
|
9
|
+
- Less Time
|
|
10
|
+
- Less Cost
|
|
11
|
+
- Fast Development
|
|
12
|
+
|
|
13
|
+
# Features
|
|
14
|
+
|
|
15
|
+
- Auto Routes [Simple & Advanced & Custom]
|
|
16
|
+
- Auto Handle File Types Encoding [Fonts - Images - ...]
|
|
17
|
+
- Merge Multi Files Contents in One Route
|
|
18
|
+
- Auto Handle Request & Response Headers [Cookies - Parameters - params]
|
|
19
|
+
- Auto Detect & Configer User Session
|
|
20
|
+
- Built-in Security System [Users , Roles, Permissions]
|
|
21
|
+
- Easy Creating Master Pages
|
|
22
|
+
- Auto Caching All Routes & Management Site Files in Memory
|
|
23
|
+
- Fast Read Files Content [Site Folder Structure]
|
|
24
|
+
- [ Upload / Download ] Files
|
|
25
|
+
- Custom Html Attributes [Server side Tags]
|
|
26
|
+
- MongoDB Full Integration
|
|
27
|
+
- Client libraries [jquery - bootstrap - font-awesome - angular]
|
|
28
|
+
- Local Multi Charts Apps
|
|
29
|
+
- Development Helper Functions
|
|
30
|
+
- Site Dynamic Events Callback
|
|
31
|
+
- Auto WebSocket Handle
|
|
32
|
+
|
|
33
|
+
## Fast Startup
|
|
34
|
+
|
|
35
|
+
- Download Startup Template
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
git clone https://github.com/absunstar/isite-template
|
|
39
|
+
cd isite-template
|
|
40
|
+
npm i
|
|
41
|
+
npm start
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
`npm install isite`
|
|
47
|
+
|
|
48
|
+
- Works Stand-Alone or With Other Libs
|
|
49
|
+
- updated every 1 month at least ( npm i isite ) for production apps
|
|
50
|
+
|
|
51
|
+
## Using
|
|
52
|
+
|
|
53
|
+
- Fast Startup Web Server.
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
var isite = require('isite');
|
|
57
|
+
var site = isite({ port: 8080 });
|
|
58
|
+
|
|
59
|
+
site.loadLocalApp('client-side');
|
|
60
|
+
site.loadLocalApp('security');
|
|
61
|
+
|
|
62
|
+
site.run();
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- Multi port opens
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
var isite = require('isite');
|
|
69
|
+
var site = isite();
|
|
70
|
+
|
|
71
|
+
site.loadLocalApp('client-side');
|
|
72
|
+
site.loadLocalApp('security');
|
|
73
|
+
|
|
74
|
+
site.run([8080, 5555, 9090, 12345]);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- Default Options.
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
var isite = require('isite');
|
|
81
|
+
site = isite({
|
|
82
|
+
port: process.env.port || 80,
|
|
83
|
+
cwd: process.cwd(),
|
|
84
|
+
dir: process.cwd() + '/site_files',
|
|
85
|
+
upload_dir: process.cwd() + '/../uploads',
|
|
86
|
+
download_dir: process.cwd() + '/../downloads',
|
|
87
|
+
backup_dir: process.cwd() + '/../backup',
|
|
88
|
+
apps: !0,
|
|
89
|
+
apps_dir: process.cwd() + '/apps',
|
|
90
|
+
name: 'Your Site',
|
|
91
|
+
dynamic: false, // (auto set )dynamic db & prot based on folder name [ smart-Your Site-3000 ]
|
|
92
|
+
savingTime: 60 // 60 minutes then save sessions and site data,
|
|
93
|
+
log: !0,
|
|
94
|
+
lang: 'ar',
|
|
95
|
+
theme: 'default',
|
|
96
|
+
help: !0,
|
|
97
|
+
stdin: !0,
|
|
98
|
+
https: {
|
|
99
|
+
enabled: false,
|
|
100
|
+
port: null,
|
|
101
|
+
ports: [],
|
|
102
|
+
key: null // path or will use default,
|
|
103
|
+
cert: null // path or will use default,
|
|
104
|
+
},
|
|
105
|
+
mongodb: {
|
|
106
|
+
enabled: !0,
|
|
107
|
+
host: 'localhost',
|
|
108
|
+
port: '27017',
|
|
109
|
+
username: null,
|
|
110
|
+
password: null,
|
|
111
|
+
db: 'default_db',
|
|
112
|
+
collection: 'default_collection',
|
|
113
|
+
limit: 10,
|
|
114
|
+
prefix: {
|
|
115
|
+
db: '',
|
|
116
|
+
collection: '',
|
|
117
|
+
},
|
|
118
|
+
identity: {
|
|
119
|
+
enabled: !0,
|
|
120
|
+
start: 1,
|
|
121
|
+
step: 1,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
session: {
|
|
125
|
+
timeout: 60 * 24 * 30,
|
|
126
|
+
enabled: !0,
|
|
127
|
+
storage: 'file' || 'mongodb',
|
|
128
|
+
db: null,
|
|
129
|
+
collection: 'users_sessions',
|
|
130
|
+
},
|
|
131
|
+
security: {
|
|
132
|
+
enabled: !0,
|
|
133
|
+
db: null,
|
|
134
|
+
users_collection: 'users_info',
|
|
135
|
+
roles_collection: 'users_roles',
|
|
136
|
+
admin: {
|
|
137
|
+
email: 'admin@isite',
|
|
138
|
+
password: 'P@$$w0rd',
|
|
139
|
+
},
|
|
140
|
+
users: [],
|
|
141
|
+
},
|
|
142
|
+
cache: {
|
|
143
|
+
enabled: !0,
|
|
144
|
+
html: 0,
|
|
145
|
+
txt: 60 * 24 * 30,
|
|
146
|
+
js: 60 * 24 * 30,
|
|
147
|
+
css: 60 * 24 * 30,
|
|
148
|
+
fonts: 60 * 24 * 30,
|
|
149
|
+
images: 60 * 24 * 30,
|
|
150
|
+
json: 60 * 24 * 30,
|
|
151
|
+
xml: 60 * 24 * 30,
|
|
152
|
+
},
|
|
153
|
+
proto: {
|
|
154
|
+
object: !0,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
site.run();
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Site Folder Structure
|
|
162
|
+
|
|
163
|
+
- site stucture help you to manage you site easy and fast
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
- server.js - package.json - README.md -- apps -- site_files --- css - bootstrap.css - custom.css --- js - jquery.js - bootstrap.js - custom.js --- html - index.html --- fonts --- images - logo.png
|
|
167
|
+
--- json - items.json - words.json - roles.json - permissions.json --- xml - rss.xml
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- Create Folder Name "site_files"
|
|
171
|
+
- inside it create these Sub folders [ html , css , js , json , fonts , images , xml , ... ]
|
|
172
|
+
|
|
173
|
+
## Routes
|
|
174
|
+
|
|
175
|
+
- Auto Convert All Routes URL & Parameters to Lower Case
|
|
176
|
+
- Auto Manage Reponse Headers and Files Types
|
|
177
|
+
- Support Multi Files in One Route
|
|
178
|
+
- Save Route Response in Memory to Reuse for Fast Response
|
|
179
|
+
- Auto Handle URL parametes
|
|
180
|
+
- Auto Handle Body Parameters in not get header [post , put , delete , ...]
|
|
181
|
+
- Auto Handle URL params [custom parameters from url structure]
|
|
182
|
+
- Auto cache Files Content in memory
|
|
183
|
+
- support compress to remove unwanted spaces and tabs and empty lines ...etc
|
|
184
|
+
- support parser to handle custom html server side tags
|
|
185
|
+
- Call Route From Other Route [ Server Side ]
|
|
186
|
+
|
|
187
|
+
Easy and Auto Site Routing
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
/* site.dir = process.cwd() + "/site_files"
|
|
191
|
+
You Can Change This Default Value when define isite
|
|
192
|
+
or set site.dir = new path
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
site.onGET({ name: ['/', '/home', '/index'], path: site.dir + '/html/index.html' });
|
|
196
|
+
site.onGET({ name: '/css/bootstrap.css', path: site.dir + '/css/bootstrap.min.css' });
|
|
197
|
+
site.onGET({ name: '/js/jquery.js', path: site.dir + '/js/jquery.js' });
|
|
198
|
+
site.onGET({ name: '/js/bootstrap.js', path: site.dir + '/js/bootstrap.js' });
|
|
199
|
+
site.onGET({ name: '/favicon.png', path: site.dir + '/images/logo.png' });
|
|
200
|
+
site.onPOST({ name: '/api', path: site.dir + '/json/employees.json' });
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Merge Multi Files in one route
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
site.onGET({
|
|
207
|
+
name: '/css/style.css',
|
|
208
|
+
path: [site.dir + '/css/bootstrap.css', site.dir + '/css/custom.css'],
|
|
209
|
+
});
|
|
210
|
+
site.onGET({
|
|
211
|
+
name: '/js/script.js',
|
|
212
|
+
path: [site.dir + '/js/jquery.js', site.dir + '/js/bootstrap.js', site.dir + '/js/custom.js'],
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Advanced Site Routing
|
|
217
|
+
|
|
218
|
+
```js
|
|
219
|
+
site.onREQUEST('get', '/', (req, res) => {});
|
|
220
|
+
|
|
221
|
+
site.onREQUEST('get', { name: '/' }, (req, res) => {});
|
|
222
|
+
|
|
223
|
+
site.onGET('/home2', (req, res) => {
|
|
224
|
+
site.callRoute('/home', req, res);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
site.onGET({
|
|
228
|
+
name: 'api/user/add',
|
|
229
|
+
content: {
|
|
230
|
+
done: true,
|
|
231
|
+
id: 1,
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
site.onGET('/', (req, res) => {
|
|
236
|
+
site.readFile(site.dir + '/html/index.html', function (err, content, file) {
|
|
237
|
+
res.set('Content-type', 'text/html');
|
|
238
|
+
res.set('Content-size', file.stat.size);
|
|
239
|
+
res.status(200).end(content);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
site.onGET('/', (req, res) => {
|
|
244
|
+
site.html('index', function (err, content) {
|
|
245
|
+
res.set('Content-type', 'text/html');
|
|
246
|
+
res.status(200).end(content);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
site.onGET({
|
|
251
|
+
// can use [get , post , put , delete , all]
|
|
252
|
+
name: '/',
|
|
253
|
+
path: site.dir + '/html/index.html', //Required
|
|
254
|
+
parser: 'html', // default static [not paresed]
|
|
255
|
+
compress: !0, // default false
|
|
256
|
+
cache: false, // default !0
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
site.onGET({
|
|
260
|
+
name: '/',
|
|
261
|
+
callback: function (req, res) {
|
|
262
|
+
res.set('Content-type', 'text/html');
|
|
263
|
+
site.html('index', function (err, content) {
|
|
264
|
+
res.status(200).end(content);
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Auto Route All Files in Folder
|
|
271
|
+
|
|
272
|
+
```js
|
|
273
|
+
site.onGET({ name: '/js', path: site.dir + '/js' });
|
|
274
|
+
site.onGET({ name: '/css', path: site.dir + '/css' });
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Custom Route - Using \* [any letters]
|
|
278
|
+
|
|
279
|
+
```js
|
|
280
|
+
site.onGET('/post/*', function (req, res) {
|
|
281
|
+
res.end('Any Route like /post/11212154545 ');
|
|
282
|
+
});
|
|
283
|
+
site.onGET('*', function (req, res) {
|
|
284
|
+
res.end('Any Route Requested Not Handled Before This Code');
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Request Parameters [GET , POST | PUT | Delete] Restful API
|
|
289
|
+
|
|
290
|
+
```js
|
|
291
|
+
// read query parameter lower case
|
|
292
|
+
site.onGET('/api', function (req, res) {
|
|
293
|
+
res.end('GET | name : ' + req.query.name);
|
|
294
|
+
});
|
|
295
|
+
// read query parameter default case as requested
|
|
296
|
+
site.onGET('/api', function (req, res) {
|
|
297
|
+
res.end('GET | name : ' + req.queryRaw.name);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
site.onPOST('/api', function (req, res) {
|
|
301
|
+
res.end('POST | id : ' + req.body.id + ' , Name : ' + req.body.name);
|
|
302
|
+
});
|
|
303
|
+
site.onPUT('/api', function (req, res) {
|
|
304
|
+
res.end('PUT | id : ' + req.body.id + ' , Name : ' + req.body.name);
|
|
305
|
+
});
|
|
306
|
+
site.onDELETE('/api', function (req, res) {
|
|
307
|
+
res.end('Delete | id : ' + req.body.id);
|
|
308
|
+
});
|
|
309
|
+
site.onALL('/api', function (req, res) {
|
|
310
|
+
res.end('Any Request Routing Type Not Handled Yet : ' + req.method);
|
|
311
|
+
});
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Dynamic Parameters
|
|
315
|
+
|
|
316
|
+
```js
|
|
317
|
+
// read params lower case
|
|
318
|
+
site.onGET('/post/:id/category/:cat_id', function (req, res) {
|
|
319
|
+
res.end('GET | Id : ' + req.params.id + ', catId : ' + req.params.cat_id);
|
|
320
|
+
});
|
|
321
|
+
// read params default case as requested
|
|
322
|
+
site.onGET('/post/:id/category/:cat_id', function (req, res) {
|
|
323
|
+
res.end('GET | Id : ' + req.paramsRaw.id + ', catId : ' + req.paramsRaw.cat_id);
|
|
324
|
+
});
|
|
325
|
+
//example : /post/AbCdEf/category/DDDDD
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
MVC Custom Route
|
|
329
|
+
|
|
330
|
+
```js
|
|
331
|
+
site.onGET('/:controller/:Action/:Arg1', function (req, res) {
|
|
332
|
+
res.end(
|
|
333
|
+
'GET | Controller : ' +
|
|
334
|
+
req.params.controller +
|
|
335
|
+
', Action : ' +
|
|
336
|
+
req.params.Action /* Normal case*/ +
|
|
337
|
+
', action : ' +
|
|
338
|
+
req.params.action /* lower case*/ +
|
|
339
|
+
', Arg 1 : ' +
|
|
340
|
+
req.params.Arg1 /* Normal case*/ +
|
|
341
|
+
', arg 1 : ' +
|
|
342
|
+
req.params.arg1 /* lower case*/
|
|
343
|
+
);
|
|
344
|
+
});
|
|
345
|
+
//example : /facebook/post/xxxxxxxxxx
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
- To Easy Read File Contents From "site_files" Folder
|
|
349
|
+
|
|
350
|
+
```js
|
|
351
|
+
site.html('index', function (err, content) {
|
|
352
|
+
site.log(content);
|
|
353
|
+
});
|
|
354
|
+
site.css('bootstrap', function (err, content) {
|
|
355
|
+
site.log(content);
|
|
356
|
+
});
|
|
357
|
+
site.js('jquery', function (err, content) {
|
|
358
|
+
site.log(content);
|
|
359
|
+
});
|
|
360
|
+
site.json('items', function (err, content) {
|
|
361
|
+
site.log(content);
|
|
362
|
+
});
|
|
363
|
+
site.xml('rss', function (err, content) {
|
|
364
|
+
site.log(content);
|
|
365
|
+
});
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
- Custom Read Files
|
|
369
|
+
|
|
370
|
+
- Read From Local File in First Time and save in memory
|
|
371
|
+
- next time Read Will be From Memory
|
|
372
|
+
|
|
373
|
+
```js
|
|
374
|
+
//read file with custom header
|
|
375
|
+
site.onGET("/rss", function(req, res) {
|
|
376
|
+
site.readFile(__dirname + "/site_files/xml/rss.xml", function(err, content , file) {
|
|
377
|
+
res.set("content-type" , "text/xml")
|
|
378
|
+
res.set("content-size" , file.stat.size)
|
|
379
|
+
res.status(200).end(content) // or res.end(content)
|
|
380
|
+
})
|
|
381
|
+
})
|
|
382
|
+
// or [ if file in site_files/xml folder]
|
|
383
|
+
site.onGET("/rss", function(req, res) {
|
|
384
|
+
site.xml("rss", function(err, content , file) {
|
|
385
|
+
res.set("content-type" , "text/xml")
|
|
386
|
+
res.set("content-size" , file.stat.size)
|
|
387
|
+
res.status(200).end(content)
|
|
388
|
+
})
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
// Read and Merge multi files with custom header
|
|
392
|
+
site.onGET("/", function(req, res) {
|
|
393
|
+
site.readFiles(
|
|
394
|
+
[
|
|
395
|
+
__dirname + "/site_files/html/head.html",
|
|
396
|
+
__dirname + "/site_files/html/content.html",
|
|
397
|
+
__dirname + "/site_files/html/footer.html"
|
|
398
|
+
],
|
|
399
|
+
function(err, content) {
|
|
400
|
+
res.writeHead(200, { "content-type": "text/html" });
|
|
401
|
+
res.end(content);
|
|
402
|
+
})
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
// Check if File Exits
|
|
406
|
+
site.isFileExists(path , (yes)=>{
|
|
407
|
+
if(yes){
|
|
408
|
+
// ...
|
|
409
|
+
}
|
|
410
|
+
})
|
|
411
|
+
// or
|
|
412
|
+
let yes = site.isFileExistsSync(path)
|
|
413
|
+
if(yes){
|
|
414
|
+
// ...
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// Get File Info
|
|
418
|
+
site.fileStat(path , (err , stats)=>{
|
|
419
|
+
console.log(stats)
|
|
420
|
+
})
|
|
421
|
+
// or
|
|
422
|
+
let stats = site.fileStatSync(path)
|
|
423
|
+
|
|
424
|
+
// Write Data to File
|
|
425
|
+
site.writeFile(path , data , err =>{
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
// Delete File
|
|
429
|
+
site.removeFile(path , err =>{
|
|
430
|
+
|
|
431
|
+
}) // or site.deleteFile
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
// Create New Dir
|
|
435
|
+
site.createDir(path , (err , path)=>{
|
|
436
|
+
if(!err){
|
|
437
|
+
// ...
|
|
438
|
+
}
|
|
439
|
+
}) // or site.makeDir
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## WebSocket
|
|
444
|
+
|
|
445
|
+
- Server Side
|
|
446
|
+
|
|
447
|
+
```js
|
|
448
|
+
site.onWS('/chat', (client) => {
|
|
449
|
+
client.onMessage = function (message) {
|
|
450
|
+
console.log(message);
|
|
451
|
+
if (message.type === 'connected') {
|
|
452
|
+
client.send({ type: 'ready' });
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
console.log('New Client ...' + client.ip);
|
|
456
|
+
});
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
- Client Side
|
|
460
|
+
|
|
461
|
+
```html
|
|
462
|
+
<script src="/x-js/all.js"></script>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
```js
|
|
466
|
+
site.ws('ws://localhost/chat', (server) => {
|
|
467
|
+
window.server = server;
|
|
468
|
+
server.onOpen = () => {
|
|
469
|
+
server.send({ type: 'accessToken', content: '##session.accessToken##' });
|
|
470
|
+
};
|
|
471
|
+
server.onMessage = (msg) => {
|
|
472
|
+
console.log(msg);
|
|
473
|
+
};
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// or
|
|
477
|
+
|
|
478
|
+
var ws = new WebSocket('ws://localhost/chat');
|
|
479
|
+
|
|
480
|
+
ws.onerror = function (error) {};
|
|
481
|
+
ws.onclose = function () {};
|
|
482
|
+
|
|
483
|
+
ws.onopen = function () {
|
|
484
|
+
ws.send(JSON.stringify({ type: 'connect' }));
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
ws.onmessage = function (msg) {
|
|
488
|
+
msg = JSON.parse(msg.data);
|
|
489
|
+
if (msg.type === 'ready') {
|
|
490
|
+
ws.send(JSON.stringify({ type: 'ready' }));
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## Cookies
|
|
496
|
+
|
|
497
|
+
- Cookie is Client Side Data Per User
|
|
498
|
+
- Cookie is Enabled by Default
|
|
499
|
+
- Support Multi Keys
|
|
500
|
+
|
|
501
|
+
```js
|
|
502
|
+
site.onGET('/testSetCookie', function (req, res) {
|
|
503
|
+
res.cookie('name', req.query.name);
|
|
504
|
+
res.cookie('ip', req.ip);
|
|
505
|
+
res.cookie('more', 'any data');
|
|
506
|
+
res.end('cookie set');
|
|
507
|
+
}); //example : /testSetCookie?name=amr
|
|
508
|
+
|
|
509
|
+
site.onGET('/testGetCookie', function (req, res) {
|
|
510
|
+
res.end('name from cookie : ' + req.cookie('name'));
|
|
511
|
+
}); //example : /testGetCookie
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## Sessions
|
|
515
|
+
|
|
516
|
+
- Session is Server Side Data Per User
|
|
517
|
+
- Every User has Unique Access Token
|
|
518
|
+
- Session Management Automatic
|
|
519
|
+
- Session Store in Database by Default
|
|
520
|
+
|
|
521
|
+
```js
|
|
522
|
+
site.onGET('/testSetSession', function (req, res) {
|
|
523
|
+
req.session.user_name = req.query.user_name;
|
|
524
|
+
res.session.ip = req.ip;
|
|
525
|
+
res.session.more = 'any data';
|
|
526
|
+
site.saveSession(res.session);
|
|
527
|
+
res.end('Session Set ok !! ');
|
|
528
|
+
}); //example : /testSetSession?user_name=absunstar
|
|
529
|
+
|
|
530
|
+
site.onGET('/testGetSession', function (req, res) {
|
|
531
|
+
res.end('User Name from session : ' + req.session.user_name);
|
|
532
|
+
}); //example : /testGetSession
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
## Custom App
|
|
536
|
+
|
|
537
|
+
- Custom App Help you to Easy Management Site Life-Cycle
|
|
538
|
+
- Easy Register & Integrated
|
|
539
|
+
- Best Solution when work with Team
|
|
540
|
+
|
|
541
|
+
### How to make it
|
|
542
|
+
|
|
543
|
+
- Create your app folder in global apps folder
|
|
544
|
+
- Add app.js file with this code
|
|
545
|
+
|
|
546
|
+
```js
|
|
547
|
+
module.exports = function (site) {
|
|
548
|
+
// write here your custom code
|
|
549
|
+
};
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
- App Will Be Auto Register And Integerated With Your Site
|
|
553
|
+
|
|
554
|
+
### add App From github
|
|
555
|
+
|
|
556
|
+
- Add Apps from github to Your Site
|
|
557
|
+
|
|
558
|
+
```sh
|
|
559
|
+
cd apps
|
|
560
|
+
git clone https://github.com/absunstar/isite-client
|
|
561
|
+
git clone https://github.com/absunstar/isite-security
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### add App From Local Path
|
|
565
|
+
|
|
566
|
+
```js
|
|
567
|
+
site.importApp(FOLDER_PATH);
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
## Master Pages
|
|
571
|
+
|
|
572
|
+
- Master Page put content between header and footer
|
|
573
|
+
- Master Page help you to not repate you code
|
|
574
|
+
- Master Page make site layout look good with less code
|
|
575
|
+
- Master Page has tow parts header and footer
|
|
576
|
+
|
|
577
|
+
```js
|
|
578
|
+
site.addMasterPage({
|
|
579
|
+
name: 'masterPage1',
|
|
580
|
+
header: site.dir + '/html/header.html',
|
|
581
|
+
footer: site.dir + '/html/footer.html',
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
site.addMasterPage({
|
|
585
|
+
name: 'masterPage2',
|
|
586
|
+
header: site.dir + '/html/header2.html',
|
|
587
|
+
footer: site.dir + '/html/footer2.html',
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
site.onGET({
|
|
591
|
+
name: '/ContactUs',
|
|
592
|
+
masterPage: 'masterPage1',
|
|
593
|
+
path: site.dir + '/html/contact.html',
|
|
594
|
+
parser: 'html',
|
|
595
|
+
});
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
## HTML Server Tags & Attributes
|
|
599
|
+
|
|
600
|
+
- html server tags is html tags run in server side
|
|
601
|
+
- html server tags make html structure easy management
|
|
602
|
+
- html server tags is the next generation of html
|
|
603
|
+
|
|
604
|
+
Add Custom Html Content
|
|
605
|
+
|
|
606
|
+
```js
|
|
607
|
+
site.onGET({ name: '/', path: site.dir + '/html/index.html', parser: 'html' });
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
```html
|
|
611
|
+
<style x-import="page2.css"></style>
|
|
612
|
+
<div x-import="navbar.html"></div>
|
|
613
|
+
<div class="container">
|
|
614
|
+
<h2>Page Heading 2</h2>
|
|
615
|
+
<p x-import="info.html"></p>
|
|
616
|
+
</div>
|
|
617
|
+
<script x-import="custom.js"></script>
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
- Pages "navbar.html" & "info.html" Must Be In HTML Site Folder ['/site_files/html/']
|
|
621
|
+
- Style "page2.css" Must Be In HTML Site Folder ['/site_files/css/']
|
|
622
|
+
- Script "custom.js" Must Be In HTML Site Folder ['/site_files/js/']
|
|
623
|
+
|
|
624
|
+
Dynamic Varibles Sets
|
|
625
|
+
|
|
626
|
+
```js
|
|
627
|
+
site.var('siteName', 'First Site With Isite Library ');
|
|
628
|
+
site.var('siteBrand', 'XSite');
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
```html
|
|
632
|
+
<title>##var.siteName##</title>
|
|
633
|
+
<h2>##var.siteBrand##</h2>
|
|
634
|
+
<h2>Lang : ##session.lang## , Theme : ##session.theme##</h2>
|
|
635
|
+
<h2>query name : ##query.name## , query age : ##query.age##</h2>
|
|
636
|
+
<h2>data name : ##data.name## , data age : ##data.age##</h2>
|
|
637
|
+
<h2>param category : ##params.category## , param post : ##params.post##</h2>
|
|
638
|
+
|
|
639
|
+
<div x-lang="ar">Show if Site Language is Arabic</div>
|
|
640
|
+
<div x-lang="en">Show if Site Language is English</div>
|
|
641
|
+
// auto detect user session language
|
|
642
|
+
|
|
643
|
+
<div x-permission="admin">Only Admi Users Can Show This Content</div>
|
|
644
|
+
<div x-permission="accounting">Only Accounting Users Can Show This Content</div>
|
|
645
|
+
|
|
646
|
+
<div x-feature="login">Only Login Users Can Show This Content</div>
|
|
647
|
+
<div x-feature="!login">Only Not Login Users Can Show This Content</div>
|
|
648
|
+
// auto detect user login status
|
|
649
|
+
|
|
650
|
+
<div x-features="os.mobile || os.android">Only Users From Mobile or Android Can Show This Content</div>
|
|
651
|
+
<div x-features="os.mobile && os.android">Only Users From Mobile and Android Can Show This Content</div>
|
|
652
|
+
// Using || , && to Multi Features
|
|
653
|
+
|
|
654
|
+
<div x-feature="os.mobile">Only Users From Mobile Can Show This Content</div>
|
|
655
|
+
<div x-feature="os.desktop">Only Users From Mobile Can Show This Content</div>
|
|
656
|
+
|
|
657
|
+
<div x-feature="os.windows">Only Users From Windows Can Show This Content</div>
|
|
658
|
+
<div x-feature="!os.windows">Only Users From Not Windows Can Show This Content</div>
|
|
659
|
+
<div x-feature="os.windowsxp">Only Users From Windows XP Can Show This Content</div>
|
|
660
|
+
<div x-feature="os.windows7">Only Users From Windows 7 Can Show This Content</div>
|
|
661
|
+
<div x-feature="os.windows8">Only Users From Windows 8 Can Show This Content</div>
|
|
662
|
+
<div x-feature="os.windows10">Only Users From Windows 10 Can Show This Content</div>
|
|
663
|
+
|
|
664
|
+
<div x-feature="os.linux">Only Users From Linux Systems Can Show This Content</div>
|
|
665
|
+
<div x-feature="os.mac">Only Users From Mac Systems Can Show This Content</div>
|
|
666
|
+
<div x-feature="os.android">Only Users From Android Systems Can Show This Content</div>
|
|
667
|
+
<div x-feature="os.unknown">Only Users From unknown Systems Can Show This Content</div>
|
|
668
|
+
|
|
669
|
+
<div x-feature="browser.edge">Only Users From Edge Browser Can Show This Content</div>
|
|
670
|
+
<div x-feature="browser.firefox">Only Users From FireFox Browser Can Show This Content</div>
|
|
671
|
+
<div x-feature="browser.chrome">Only Users From Chrome Browser Can Show This Content</div>
|
|
672
|
+
<div x-feature="browser.opera">Only Users From Opera Browser Can Show This Content</div>
|
|
673
|
+
<div x-feature="browser.unknown">Only Users From unknown Browser Can Show This Content</div>
|
|
674
|
+
|
|
675
|
+
<div x-feature="ip.xxx.xxx.xxx.xxx">Only Users From IP xxx.xxx.xxx.xxx Can Show This Content</div>
|
|
676
|
+
|
|
677
|
+
//auto detect user browser
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
## MongoDB Integration
|
|
681
|
+
|
|
682
|
+
- Auto Add [ id ] as auto increment number [Like SQL]
|
|
683
|
+
- Handle [ _id ] Data Type
|
|
684
|
+
- Manage Closed Connections and Timeout
|
|
685
|
+
- Manage Multi Connections
|
|
686
|
+
- Manage Bulk [ Inserts & Updates & Deletes ]
|
|
687
|
+
- Global Database Events
|
|
688
|
+
- User Friendly Coding
|
|
689
|
+
|
|
690
|
+
```js
|
|
691
|
+
|
|
692
|
+
// use connect collection [ Best Way For Security ]
|
|
693
|
+
|
|
694
|
+
$employees = site.connectCollection("employees")
|
|
695
|
+
|
|
696
|
+
// with database
|
|
697
|
+
$employees = site.connectCollection("employees" , "company")
|
|
698
|
+
//or
|
|
699
|
+
$employees = site.connectCollection({collection : "employees" , db : "company")
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
// insert one doc [ can use also [add , addOne , insert , insertOne]]
|
|
703
|
+
$employees.insertOne({name : 'amr' , salary : 50000} , (err , doc)=>{
|
|
704
|
+
site.log(doc) // doc after inserted
|
|
705
|
+
})
|
|
706
|
+
|
|
707
|
+
// insert Many Docs [ can use also [ addMany , addAll , insertMany , insertAll]]
|
|
708
|
+
$employee.insertMany([{name : 'a'} , {name : 'b'}] , (err , docs)=>{
|
|
709
|
+
site.log(docs , 'docs')
|
|
710
|
+
})
|
|
711
|
+
|
|
712
|
+
// select one doc [ can use also [ get , getOne , find , findOne , select , selectOne ]]
|
|
713
|
+
$employees.findOne({where:{id : 5} , select:{salary:1}} , (err , doc)=>{
|
|
714
|
+
site.log(doc)
|
|
715
|
+
})
|
|
716
|
+
//or
|
|
717
|
+
$employees.findOne({ id : 5 } , (err , doc)=>{
|
|
718
|
+
site.log(doc)
|
|
719
|
+
})
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
// select Multi docs [ can use also [getAll , getMany , findAll , findMany , selectAll , selectMany ]]
|
|
723
|
+
$employees.findMany({
|
|
724
|
+
where:{name : /a/i} ,
|
|
725
|
+
select:{name: 1 , salary:1} ,
|
|
726
|
+
limit : 50 ,
|
|
727
|
+
skip : 10 ,
|
|
728
|
+
sort:{salary : -1}
|
|
729
|
+
} , (err , docs , count)=>{
|
|
730
|
+
site.log(docs)
|
|
731
|
+
}
|
|
732
|
+
)
|
|
733
|
+
|
|
734
|
+
// Update One Doc [ can use [ updateOne , update , editOne , edit]]
|
|
735
|
+
$employees.updateOne({
|
|
736
|
+
where:{_id : 'df54fdt8h3n48ykd136vg'} ,
|
|
737
|
+
set:{salary: 30000}} , (err , result)=>{
|
|
738
|
+
site.log(result)
|
|
739
|
+
})
|
|
740
|
+
// or [ auto update by _id ]
|
|
741
|
+
$employees.updateOne({_id : 'df54fdt8h3n48ykd136vg' , salary : 5000} , (err , result)=>{
|
|
742
|
+
site.log(result)
|
|
743
|
+
})
|
|
744
|
+
|
|
745
|
+
// Update Many Docs [ can use [ updateAll , updateMany , editAll , editMany]]
|
|
746
|
+
$employees.updateMany({
|
|
747
|
+
where:{name : /a/i} ,
|
|
748
|
+
set:{salary: 30000}} , (err , result)=>{
|
|
749
|
+
site.log(result)
|
|
750
|
+
})
|
|
751
|
+
|
|
752
|
+
// Delete One Doc [ can use [ deleteOne , delete , removeOne , remove]]
|
|
753
|
+
$employees.deleteOne({where:{ _id : 'df54fdt8h3n48ykd136vg'}} , (err , result)=>{
|
|
754
|
+
site.log(result)
|
|
755
|
+
})
|
|
756
|
+
// or [ auto delete by _id]
|
|
757
|
+
$employees.deleteOne('df54fdt8h3n48ykd136vg', (err , result)=>{
|
|
758
|
+
site.log(result)
|
|
759
|
+
})
|
|
760
|
+
// or
|
|
761
|
+
$employees.deleteOne({name : /a/i} , (err , result)=>{
|
|
762
|
+
site.log(result)
|
|
763
|
+
})
|
|
764
|
+
|
|
765
|
+
// Delete Many Docs [ can use [ deleteAll , deleteManye , removeAll , removeMany ]]
|
|
766
|
+
$employees.deleteMany({where:{name : /a/i}} , (err , result)=>{
|
|
767
|
+
site.log(result)
|
|
768
|
+
})
|
|
769
|
+
// or
|
|
770
|
+
$employees.deleteMany({name : /a/i} , (err , result)=>{
|
|
771
|
+
site.log(result)
|
|
772
|
+
})
|
|
773
|
+
|
|
774
|
+
// Import Object Data From Json File
|
|
775
|
+
$employees.import(FILE_PATH , (result)=>{
|
|
776
|
+
|
|
777
|
+
})
|
|
778
|
+
|
|
779
|
+
// Import Array Data From Json File
|
|
780
|
+
$employees.import(FILE_PATH , (result)=>{
|
|
781
|
+
|
|
782
|
+
})
|
|
783
|
+
|
|
784
|
+
// Export Object Data From Json File
|
|
785
|
+
$employees.export( OPTONS , FILE_PATH , (err , docs)=>{
|
|
786
|
+
|
|
787
|
+
})
|
|
788
|
+
// Export 10 employees that salary more than 1000
|
|
789
|
+
$employees.export({limit : 10 , where : {salary : {$gt : 1000}}} , FILE_PATH , (err , docs)=>{
|
|
790
|
+
|
|
791
|
+
})
|
|
792
|
+
|
|
793
|
+
// Remove duplicate data [ can use [deleteDuplicate , removeDuplicate]]
|
|
794
|
+
$employees.deleteDuplicate('name' , (err , result)=>{
|
|
795
|
+
|
|
796
|
+
})
|
|
797
|
+
// Remove Duplicate [ name and mobile ] Employee
|
|
798
|
+
$employees.deleteDuplicate({name : 1 , mobile : 1} , (err , result)=>{
|
|
799
|
+
|
|
800
|
+
})
|
|
801
|
+
// Remove Duplicate [ profile.name ] Employee
|
|
802
|
+
$employees.deleteDuplicate({'profile.name' : 1 } , (err , result)=>{
|
|
803
|
+
|
|
804
|
+
})
|
|
805
|
+
|
|
806
|
+
// Create Index Field
|
|
807
|
+
$employees.createIndex({name : 1} , {unique} , (err , result)=>{
|
|
808
|
+
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// Create Unique Field
|
|
812
|
+
$employees.createUnique({name : 1} , (err , result)=>{
|
|
813
|
+
|
|
814
|
+
}
|
|
815
|
+
// Create Unique Fields
|
|
816
|
+
$employees.createUnique({user_name : 1 , user_password : 1} , (err , result)=>{
|
|
817
|
+
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// backup database
|
|
821
|
+
site.backupDB() // backup current database to current backup folder
|
|
822
|
+
site.backupDB({db:'' , path : ''})
|
|
823
|
+
|
|
824
|
+
// restore database
|
|
825
|
+
site.restoreDB() // restore current database from current backup folder
|
|
826
|
+
site.restoreDB({db:'' , path : ''})
|
|
827
|
+
|
|
828
|
+
// API to download backup db
|
|
829
|
+
site.onGET('db', (req, res) => {
|
|
830
|
+
site.backupDB(null, (err, options) => {
|
|
831
|
+
if (!err) {
|
|
832
|
+
res.download(options.path);
|
|
833
|
+
} else {
|
|
834
|
+
res.json(err);
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
//==================================================================
|
|
840
|
+
// Global Database Events
|
|
841
|
+
// from here you can catch all transactions
|
|
842
|
+
|
|
843
|
+
site.on('mongodb after insert' , (result)=>{
|
|
844
|
+
|
|
845
|
+
})
|
|
846
|
+
site.on('mongodb after insert many' , (result)=>{
|
|
847
|
+
|
|
848
|
+
})
|
|
849
|
+
site.on('mongodb after find' , (result)=>{
|
|
850
|
+
|
|
851
|
+
})
|
|
852
|
+
site.on('mongodb after find many' , (result)=>{
|
|
853
|
+
|
|
854
|
+
})
|
|
855
|
+
site.on('mongodb after update' , (result)=>{
|
|
856
|
+
|
|
857
|
+
})
|
|
858
|
+
site.on('mongodb after update many' , (result)=>{
|
|
859
|
+
|
|
860
|
+
})
|
|
861
|
+
site.on('mongodb after delete' , (result)=>{
|
|
862
|
+
|
|
863
|
+
})
|
|
864
|
+
site.on('mongodb after delete many' , (result)=>{
|
|
865
|
+
|
|
866
|
+
})
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
// ==================================================================
|
|
870
|
+
// Low Level Access Database Functions [ For Advanced Work ]
|
|
871
|
+
|
|
872
|
+
// Insert One Doc
|
|
873
|
+
site.mongodb.insertOne({
|
|
874
|
+
dbName: 'company',
|
|
875
|
+
collectionName: 'employess',
|
|
876
|
+
doc:{name:'amr',salary:35000}
|
|
877
|
+
}, function (err, docInserted) {
|
|
878
|
+
if (err) {
|
|
879
|
+
site.log(err.message)
|
|
880
|
+
} else {
|
|
881
|
+
site.log(docInserted)
|
|
882
|
+
}
|
|
883
|
+
} , /* default waiting Sync or !0 for Async*/)
|
|
884
|
+
|
|
885
|
+
// Insert Many Docs
|
|
886
|
+
site.mongodb.insertMany({
|
|
887
|
+
dbName: 'company',
|
|
888
|
+
collectionName: 'employess',
|
|
889
|
+
docs:[
|
|
890
|
+
{name:'amr',salary:35000} ,
|
|
891
|
+
{name:'Gomana',salary:9000} ,
|
|
892
|
+
{name:'Maryem',salary:7000}
|
|
893
|
+
]
|
|
894
|
+
}, function (err, result) {
|
|
895
|
+
if (err) {
|
|
896
|
+
site.log(err.message)
|
|
897
|
+
} else {
|
|
898
|
+
site.log(result)
|
|
899
|
+
}
|
|
900
|
+
}/* default waiting Sync or !0 for Async*/)
|
|
901
|
+
|
|
902
|
+
// Find One Doc
|
|
903
|
+
site.mongodb.findOne({
|
|
904
|
+
dbName: 'company',
|
|
905
|
+
collectionName: 'employees',
|
|
906
|
+
where:{},
|
|
907
|
+
select : {}
|
|
908
|
+
}, function (err, doc) {
|
|
909
|
+
if (err) {
|
|
910
|
+
site.log(err.message)
|
|
911
|
+
} else {
|
|
912
|
+
site.log(doc)
|
|
913
|
+
}
|
|
914
|
+
}/* default waiting Sync or !0 for Async*/)
|
|
915
|
+
|
|
916
|
+
// Find Many Docs
|
|
917
|
+
site.mongodb.findMany({
|
|
918
|
+
dbName: 'company',
|
|
919
|
+
collectionName: 'employees',
|
|
920
|
+
where:{},
|
|
921
|
+
select : {}
|
|
922
|
+
}, function (err, docs , count) {
|
|
923
|
+
if (err) {
|
|
924
|
+
site.log(err.message)
|
|
925
|
+
} else {
|
|
926
|
+
site.log(docs)
|
|
927
|
+
}
|
|
928
|
+
}/* default waiting Sync or !0 for Async*/)
|
|
929
|
+
|
|
930
|
+
//Update One Doc
|
|
931
|
+
site.mongodb.updateOne({
|
|
932
|
+
dbName: 'company',
|
|
933
|
+
collectionName: 'employees',
|
|
934
|
+
where:{salary:7000},
|
|
935
|
+
set : {name:'New MARYEM'}
|
|
936
|
+
}, function (err, result) {
|
|
937
|
+
if (err) {
|
|
938
|
+
site.log(err.message)
|
|
939
|
+
} else {
|
|
940
|
+
site.log(result)
|
|
941
|
+
}
|
|
942
|
+
}/* default waiting Sync or !0 for Async*/)
|
|
943
|
+
|
|
944
|
+
// Update Many Docs
|
|
945
|
+
site.mongodb.updateMany({
|
|
946
|
+
dbName: 'company',
|
|
947
|
+
collectionName: 'employees',
|
|
948
|
+
where:{salary:9000},
|
|
949
|
+
set : {salary:9000 * .10}
|
|
950
|
+
}, function (err, result) {
|
|
951
|
+
if (err) {
|
|
952
|
+
site.log(err.message)
|
|
953
|
+
} else {
|
|
954
|
+
site.log(result)
|
|
955
|
+
}
|
|
956
|
+
}/* default waiting Sync or !0 for Async*/)
|
|
957
|
+
|
|
958
|
+
// Delete One Doc
|
|
959
|
+
site.mongodb.deleteOne({
|
|
960
|
+
dbName: 'company',
|
|
961
|
+
collectionName: 'employess',
|
|
962
|
+
where:{_id: new site.mongodb.ObjectID('df54fdt8h3n48ykd136vg')}
|
|
963
|
+
}, function (err, result) {
|
|
964
|
+
if (err) {
|
|
965
|
+
site.log(err.message)
|
|
966
|
+
} else {
|
|
967
|
+
site.log(result)
|
|
968
|
+
}
|
|
969
|
+
}/* default waiting Sync or !0 for Async*/)
|
|
970
|
+
// Delete Many Docs
|
|
971
|
+
site.mongodb.deleteMany({
|
|
972
|
+
dbName: 'company',
|
|
973
|
+
collectionName: 'employess',
|
|
974
|
+
where:{name : /a/}
|
|
975
|
+
}, function (err, result) {
|
|
976
|
+
if (err) {
|
|
977
|
+
site.log(err.message)
|
|
978
|
+
} else {
|
|
979
|
+
site.log(result)
|
|
980
|
+
}
|
|
981
|
+
}/* default waiting Sync or !0 for Async*/)
|
|
982
|
+
|
|
983
|
+
// ==================================================================
|
|
984
|
+
// Mongodb Native Client Provider
|
|
985
|
+
|
|
986
|
+
site.mongodb.client // = require("mongodb").MongoClient
|
|
987
|
+
|
|
988
|
+
// Create a database called "mydb":
|
|
989
|
+
|
|
990
|
+
var url = "mongodb://localhost:27017/mydb";
|
|
991
|
+
|
|
992
|
+
site.mongodb.client.connect(url, function(err, db) {
|
|
993
|
+
if (err) throw err;
|
|
994
|
+
console.log("Database created!");
|
|
995
|
+
db.close();
|
|
996
|
+
});
|
|
997
|
+
|
|
998
|
+
// all code can be found in offical mongodb site or w3schools
|
|
999
|
+
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
## Upload File
|
|
1003
|
+
|
|
1004
|
+
- upload File using HTML
|
|
1005
|
+
|
|
1006
|
+
```html
|
|
1007
|
+
<form action="uploadFile" method="post" enctype="multipart/form-data">
|
|
1008
|
+
<input type="file" name="fileToUpload" /><br />
|
|
1009
|
+
<input type="submit" />
|
|
1010
|
+
</form>
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
- Upload File Using Angular js
|
|
1014
|
+
|
|
1015
|
+
```html
|
|
1016
|
+
<form class="form">
|
|
1017
|
+
<label>Select File To Upload</label>
|
|
1018
|
+
<input type="file" name="fileToUpload" onchange="angular.element(this).scope().uploadFile(this.files)" />
|
|
1019
|
+
<p>{{uploadStatus}}</p>
|
|
1020
|
+
</form>
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
```js
|
|
1024
|
+
$scope.uploadFile = function (files) {
|
|
1025
|
+
var fd = new FormData();
|
|
1026
|
+
fd.append('fileToUpload', files[0]);
|
|
1027
|
+
$http
|
|
1028
|
+
.post('/uploadFile', fd, {
|
|
1029
|
+
withCredentials: !0,
|
|
1030
|
+
headers: {
|
|
1031
|
+
'Content-Type': undefined,
|
|
1032
|
+
},
|
|
1033
|
+
uploadEventHandlers: {
|
|
1034
|
+
progress: function (e) {
|
|
1035
|
+
$scope.uploadStatus = 'Uploading : ' + Math.round((e.loaded * 100) / e.total) + ' %';
|
|
1036
|
+
if (e.loaded == e.total) {
|
|
1037
|
+
$scope.uploadStatus = '100%';
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
},
|
|
1041
|
+
transformRequest: angular.identity,
|
|
1042
|
+
})
|
|
1043
|
+
.then(
|
|
1044
|
+
function (res) {
|
|
1045
|
+
if (res.data && res.data.done) {
|
|
1046
|
+
$scope.uploadStatus = 'File Uploaded';
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
function (error) {
|
|
1050
|
+
$scope.uploadStatus = error;
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
1053
|
+
};
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
- Recive Uploading File from [html , angular , jquery , ...]
|
|
1057
|
+
|
|
1058
|
+
```js
|
|
1059
|
+
site.onPOST('uploadFile', (req, res) => {
|
|
1060
|
+
var response = { done: !0 };
|
|
1061
|
+
var file = req.files.fileToUpload;
|
|
1062
|
+
var newpath = site.dir + '/../../uploads/' + file.originalFilename;
|
|
1063
|
+
site.mv(file.filepath, newpath, function (err) {
|
|
1064
|
+
if (err) {
|
|
1065
|
+
response.error = err;
|
|
1066
|
+
response.done = false;
|
|
1067
|
+
}
|
|
1068
|
+
res.end(JSON.stringify(response));
|
|
1069
|
+
});
|
|
1070
|
+
});
|
|
1071
|
+
```
|
|
1072
|
+
|
|
1073
|
+
## Download File
|
|
1074
|
+
|
|
1075
|
+
- download any file from server
|
|
1076
|
+
- auto handle file content and size
|
|
1077
|
+
- force client browser to download file
|
|
1078
|
+
|
|
1079
|
+
```js
|
|
1080
|
+
// download any file
|
|
1081
|
+
site.onGET('/files/file1.zip', (req, res) => {
|
|
1082
|
+
res.download(site.dir + '/downloads/file1.zip');
|
|
1083
|
+
});
|
|
1084
|
+
//download and change file name
|
|
1085
|
+
site.onGET('/files/file1.zip', (req, res) => {
|
|
1086
|
+
res.download(site.dir + '/downloads/file1.zip', 'info.zip');
|
|
1087
|
+
});
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
## Multi Languages
|
|
1091
|
+
|
|
1092
|
+
- Can Add Any Custom Language You Want
|
|
1093
|
+
- Can Change Default Language on Site Options
|
|
1094
|
+
- Stores Words in Diffrent Language in words json file
|
|
1095
|
+
- Auto Detect Words.json
|
|
1096
|
+
- Folder Structure Like This
|
|
1097
|
+
|
|
1098
|
+
```html
|
|
1099
|
+
- apps - server.js - package.json - README.md -- site_files --- json - words.json
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
- Words Json File Structure Like This
|
|
1103
|
+
|
|
1104
|
+
```json
|
|
1105
|
+
[
|
|
1106
|
+
{ "name": "user_name", "en": "User Name", "ar": "أسم المستخدم" },
|
|
1107
|
+
{ "name": "user_email", "en": "Email", "ar": "البريد الالكترونى" },
|
|
1108
|
+
{ "name": "user_password", "en": "Password", "ar": "كلمة المرور" }
|
|
1109
|
+
]
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
- Use in html Like This
|
|
1113
|
+
|
|
1114
|
+
```html
|
|
1115
|
+
<form>
|
|
1116
|
+
<label> ##word.user_name## </label>
|
|
1117
|
+
<input />
|
|
1118
|
+
<br />
|
|
1119
|
+
|
|
1120
|
+
<label> ##word.user_email## </label>
|
|
1121
|
+
<input />
|
|
1122
|
+
<br />
|
|
1123
|
+
|
|
1124
|
+
<label> ##word.user_password## </label>
|
|
1125
|
+
<input />
|
|
1126
|
+
<br />
|
|
1127
|
+
</form>
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
- Cahnge Site Language
|
|
1131
|
+
|
|
1132
|
+
```js
|
|
1133
|
+
$scope.changeLang = function (lang = 'EN', langDir = 'ltr') {
|
|
1134
|
+
$http({
|
|
1135
|
+
method: 'POST',
|
|
1136
|
+
url: '/x-language/change',
|
|
1137
|
+
data: { name: lang, dir: langDir },
|
|
1138
|
+
}).then(function (response) {
|
|
1139
|
+
if (response.data.done) {
|
|
1140
|
+
window.location.reload(!0);
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
};
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
```html
|
|
1147
|
+
<a ng-click="changeLang('ar')"> Change To Arabic </a> <a ng-click="changeLang('en')"> Change To English </a>
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
- Show Content Depended on Language
|
|
1151
|
+
|
|
1152
|
+
```html
|
|
1153
|
+
<div x-lang="ar">This Content Will Display When Site Language is Arabic</div>
|
|
1154
|
+
<div x-lang="en">This Content Will Display When Site Language is English</div>
|
|
1155
|
+
```
|
|
1156
|
+
|
|
1157
|
+
## Client libraries
|
|
1158
|
+
|
|
1159
|
+
- install Custom App From https://github.com/absunstar/isite-client
|
|
1160
|
+
|
|
1161
|
+
```sh
|
|
1162
|
+
cd apps
|
|
1163
|
+
git clone https://github.com/absunstar/isite-client
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
- no need to install any client library
|
|
1167
|
+
- no need to install any fonts
|
|
1168
|
+
- no need to manage library routes
|
|
1169
|
+
- just use it
|
|
1170
|
+
|
|
1171
|
+
```html
|
|
1172
|
+
<link rel="stylesheet" href="/x-css/bootstrap3.css" />
|
|
1173
|
+
<link rel="stylesheet" href="/x-css/font-awesome.css" />
|
|
1174
|
+
|
|
1175
|
+
<script src="/x-js/jquery.js"></script>
|
|
1176
|
+
<script src="/x-js/bootstrap3.js"></script>
|
|
1177
|
+
<script src="/x-js/angular.js"></script>
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1180
|
+
## Charts
|
|
1181
|
+
|
|
1182
|
+
- Server Side
|
|
1183
|
+
|
|
1184
|
+
```js
|
|
1185
|
+
site.loadLocalApp('charts');
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
- Client Site
|
|
1189
|
+
|
|
1190
|
+
```html
|
|
1191
|
+
<div id="chart1"></div>
|
|
1192
|
+
<script src="/js/charts.js"></script>
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
```js
|
|
1196
|
+
var data = [
|
|
1197
|
+
{
|
|
1198
|
+
item: 'item 1',
|
|
1199
|
+
count: 500,
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
item: 'item 2',
|
|
1203
|
+
count: 200,
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
item: 'item 3',
|
|
1207
|
+
count: 700,
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
item: 'item 4',
|
|
1211
|
+
count: 300,
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
item: 'item 5',
|
|
1215
|
+
count: 800,
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
item: 'item 6',
|
|
1219
|
+
count: 60,
|
|
1220
|
+
},
|
|
1221
|
+
];
|
|
1222
|
+
|
|
1223
|
+
site.create_chart({
|
|
1224
|
+
type: 'xy',
|
|
1225
|
+
x: 'item',
|
|
1226
|
+
y: 'count',
|
|
1227
|
+
data: data,
|
|
1228
|
+
selector: '#chart1',
|
|
1229
|
+
});
|
|
1230
|
+
```
|
|
1231
|
+
|
|
1232
|
+
## Security
|
|
1233
|
+
|
|
1234
|
+
- Bulit-in Users Management System
|
|
1235
|
+
- Auto Detect Users Sessions & Permissions
|
|
1236
|
+
- install Custom Security App From https://github.com/absunstar/isite-security
|
|
1237
|
+
|
|
1238
|
+
```sh
|
|
1239
|
+
cd apps
|
|
1240
|
+
git clone https://github.com/absunstar/isite-security
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
- Manage users From This Route [ /security ]
|
|
1244
|
+
|
|
1245
|
+
## Helper Functions
|
|
1246
|
+
|
|
1247
|
+
```js
|
|
1248
|
+
site.onGET('/', (req, res) => {
|
|
1249
|
+
res.render('index.html', { name: 'amr', age: '36' }, { compress: !0, cache: false, parser: 'html css js' });
|
|
1250
|
+
res.render('custom.css', { 'font-size': '18px' }, { parser: 'css' });
|
|
1251
|
+
res.render('custom.js', { 'allow-ads': !0 }, { parser: 'js' });
|
|
1252
|
+
res.code = 301; // set response code to 301
|
|
1253
|
+
res.status(301); // set response code if not set to 301 and return response object
|
|
1254
|
+
res.set('Content-Type', 'text/plain'); // add response header
|
|
1255
|
+
res.remove('Content-Type'); // remove response header
|
|
1256
|
+
res.delete('Content-Type'); // remove response header
|
|
1257
|
+
res.redirect('/URL', 302); // Any URL
|
|
1258
|
+
res.send('HTML CONTENT'); // Any HTML Content or object
|
|
1259
|
+
res.send(obj); // Any HTML Content or object
|
|
1260
|
+
res.htmlContent('HTML CONTENT'); // Any HTML Content
|
|
1261
|
+
res.html('index'); // like res.render
|
|
1262
|
+
res.css('bootstrap'); // css file name
|
|
1263
|
+
res.js('jquery'); // js file name
|
|
1264
|
+
res.json('items'); // json file name or object
|
|
1265
|
+
res.json(obj); // json file name or object
|
|
1266
|
+
|
|
1267
|
+
if (req.hasFeature('browser.chrome')) {
|
|
1268
|
+
}
|
|
1269
|
+
if (req.hasFeature('browser.firefox')) {
|
|
1270
|
+
}
|
|
1271
|
+
if (req.hasFeature('browser.edge')) {
|
|
1272
|
+
}
|
|
1273
|
+
if (req.hasFeature('browser.opera')) {
|
|
1274
|
+
}
|
|
1275
|
+
if (req.hasFeature('browser.ucbrowser')) {
|
|
1276
|
+
}
|
|
1277
|
+
if (req.hasFeature('browser.baidu')) {
|
|
1278
|
+
}
|
|
1279
|
+
if (req.hasFeature('browser.chromium')) {
|
|
1280
|
+
}
|
|
1281
|
+
if (req.hasFeature('browser.unknown')) {
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
if (req.hasFeature('os.windows')) {
|
|
1285
|
+
}
|
|
1286
|
+
if (req.hasFeature('os.linux')) {
|
|
1287
|
+
}
|
|
1288
|
+
if (req.hasFeature('os.mac')) {
|
|
1289
|
+
}
|
|
1290
|
+
if (req.hasFeature('os.android')) {
|
|
1291
|
+
}
|
|
1292
|
+
if (req.hasFeature('os.unknown')) {
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
req.ip; // user ip
|
|
1296
|
+
req.port; // user port
|
|
1297
|
+
req.ip2; // server ip
|
|
1298
|
+
req.port2; // server port
|
|
1299
|
+
req.features; // array of user info [os , browser]
|
|
1300
|
+
});
|
|
1301
|
+
|
|
1302
|
+
var person = { name: 'amr', email: 'absunstar' };
|
|
1303
|
+
var person2 = site.copy(person);
|
|
1304
|
+
person2.name = 'Abd Allah';
|
|
1305
|
+
site.log(person);
|
|
1306
|
+
site.log(person2);
|
|
1307
|
+
|
|
1308
|
+
var hash = site.md5('this content will be hashed as md5');
|
|
1309
|
+
var base64 = site.toBase64('this content will be encript as base64 string');
|
|
1310
|
+
var normal = site.fromBase64(base64);
|
|
1311
|
+
var jsonString = site.toJson(person);
|
|
1312
|
+
var jsonObj = site.fromJson(jsonString);
|
|
1313
|
+
site.log(hash);
|
|
1314
|
+
site.log(base64);
|
|
1315
|
+
site.log(normal);
|
|
1316
|
+
site.log(jsonString);
|
|
1317
|
+
site.log(jsonObj);
|
|
1318
|
+
|
|
1319
|
+
var name = 'absunstar';
|
|
1320
|
+
if (name.like('*sun*')) {
|
|
1321
|
+
site.log('yes');
|
|
1322
|
+
}
|
|
1323
|
+
```
|
|
1324
|
+
|
|
1325
|
+
## Events
|
|
1326
|
+
|
|
1327
|
+
- Events Are Global Actions Across Site
|
|
1328
|
+
|
|
1329
|
+
```js
|
|
1330
|
+
site.on('event name', function (obj) {
|
|
1331
|
+
console.log('name : ' + obj.name);
|
|
1332
|
+
});
|
|
1333
|
+
|
|
1334
|
+
site.on('event name 2', function (list) {
|
|
1335
|
+
console.log('name : ' + list[0].name);
|
|
1336
|
+
console.log('name : ' + list[1].name);
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
site.on('event name 3', function (obj, callback) {
|
|
1340
|
+
console.log('try long code : ' + obj.name);
|
|
1341
|
+
setTimeout(function () {
|
|
1342
|
+
callback();
|
|
1343
|
+
}, 3000);
|
|
1344
|
+
});
|
|
1345
|
+
|
|
1346
|
+
site.on('sync event name 1', function (obj, callback, next) {
|
|
1347
|
+
console.log('name : ' + obj.name);
|
|
1348
|
+
next(); // to run next event
|
|
1349
|
+
});
|
|
1350
|
+
site.on('sync event name 2', function (obj, callback, next) {
|
|
1351
|
+
console.log('name : ' + obj.name);
|
|
1352
|
+
next(); // to run next event
|
|
1353
|
+
});
|
|
1354
|
+
site.call('event name', { name: 'x1' });
|
|
1355
|
+
site.call('event name 2', [{ name: 'n1' }, { name: 'n2' }]);
|
|
1356
|
+
site.call('event name 3', { name: 'some long code' }, () => {
|
|
1357
|
+
console.log('after excute some long code');
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
site.quee('sync event name 1', { name: 'x1' });
|
|
1361
|
+
site.quee('sync event name 2', { name: 'x2' });
|
|
1362
|
+
```
|
|
1363
|
+
|
|
1364
|
+
## Must Update
|
|
1365
|
+
|
|
1366
|
+
- You Must Update This Lib Every Month ( npm i isite )
|
|
1367
|
+
|
|
1368
|
+
## Hints
|
|
1369
|
+
|
|
1370
|
+
- This Framework Make Security and Safty in the First Place
|
|
1371
|
+
- This Framework From Developer to Developers
|
|
1372
|
+
- This Framework Free for Education and Supported For Ever
|
|
1373
|
+
- This Framework Upgraded Arround the Clock
|
|
1374
|
+
- This Framework Development by One Developer
|
|
1375
|
+
- For Producation Contract what's up (+966568118373)
|
|
1376
|
+
|
|
1377
|
+
# Contact Me
|
|
1378
|
+
|
|
1379
|
+
- Patreon : https://www.patreon.com/next_corporation
|
|
1380
|
+
- Email : Absunstar@gmail.com
|
|
1381
|
+
- Linkedin : https://www.linkedin.com/in/absunstar
|
|
1382
|
+
- Github : https://github.com/absunstar
|
|
1383
|
+
- Paypal : https://paypal.me/absunstar
|
|
1384
|
+
- What's up: +966568118373
|