isite 2024.9.1 → 2024.9.2
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/apps/client-side/site_files/css/bootstrap5-addon.css +3 -0
- package/apps/client-side/site_files/css/dropdown.css +1 -1
- package/apps/client-side/site_files/css/theme.css +1 -1
- package/apps/client-side/site_files/css/theme_dark.css +1 -1
- package/apps/client-side/site_files/css/theme_paper.css +1 -1
- package/apps/client-side/site_files/html/directive/i-list.html +1 -1
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +8 -0
- package/apps/client-side/site_files/js/site.js +5 -1
- package/apps/security/app.js +181 -175
- package/apps/security/site_files/js/login.js +33 -33
- package/index.js +2 -5
- package/lib/collection.js +1 -0
- package/lib/collectionFile.js +3 -2
- package/lib/mongodb.js +2 -2
- package/lib/parser.js +3 -0
- package/lib/routing.js +14 -12
- package/lib/security.js +3 -38
- package/lib/ws.js +30 -12
- package/lib/wsClient.js +7 -3
- package/package.json +2 -2
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/* Change color of dropdown links on hover */
|
|
54
|
-
.dropdown-content .dropdown-item:hover {
|
|
54
|
+
.dropdown-content .dropdown-item:hover , .dropdown-content .dropdown-item.selected {
|
|
55
55
|
background-color: #4CAF50;
|
|
56
56
|
--color: #ffffff;
|
|
57
57
|
padding-right: 20px !important;
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
--fieldset-border: none;
|
|
137
137
|
--fieldset-border-radius : 10px;
|
|
138
138
|
--fieldset-background: #e9ecef;
|
|
139
|
-
--fieldset-margin:
|
|
139
|
+
--fieldset-margin : 1% !important;
|
|
140
140
|
--fieldset-padding: 5px;
|
|
141
141
|
--legend-color: #5a5a5a;
|
|
142
142
|
--legend-text-shadow: none;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div class="dropdown-item row" ng-repeat="item in items | filter:$filter" ng-click="updateModel(item)">
|
|
15
|
+
<div ng-class="{'selected':item.$selected}" class="dropdown-item row" ng-repeat="item in items | filter:$filter" ng-click="updateModel(item)">
|
|
16
16
|
<p>{{getValue(item)}}</p>
|
|
17
17
|
<p class="small" ng-show="display2">{{getValue2(item)}}</p>
|
|
18
18
|
</div>
|
|
@@ -453,6 +453,7 @@ app.directive('iList', [
|
|
|
453
453
|
|
|
454
454
|
if (items) {
|
|
455
455
|
items.forEach((item) => {
|
|
456
|
+
item.$selected = false;
|
|
456
457
|
if ($scope.display2) {
|
|
457
458
|
let val = $scope.getValue(item);
|
|
458
459
|
if (val) {
|
|
@@ -469,6 +470,7 @@ app.directive('iList', [
|
|
|
469
470
|
if (items && $scope.ngModel) {
|
|
470
471
|
items.forEach((item) => {
|
|
471
472
|
if (isite.getValue(item, $scope.primary) == isite.getValue($scope.ngModel, $scope.primary)) {
|
|
473
|
+
item.$selected = true;
|
|
472
474
|
$scope.ngModel = item;
|
|
473
475
|
if ($scope.display2) {
|
|
474
476
|
let val = $scope.getValue(item);
|
|
@@ -482,6 +484,8 @@ app.directive('iList', [
|
|
|
482
484
|
}
|
|
483
485
|
|
|
484
486
|
input.val(item.$display);
|
|
487
|
+
} else {
|
|
488
|
+
item.$selected = false;
|
|
485
489
|
}
|
|
486
490
|
});
|
|
487
491
|
}
|
|
@@ -518,6 +522,10 @@ app.directive('iList', [
|
|
|
518
522
|
|
|
519
523
|
$scope.updateModel = function (item) {
|
|
520
524
|
if (item) {
|
|
525
|
+
$scope.items.forEach((_item) => {
|
|
526
|
+
_item.$selected = false;
|
|
527
|
+
});
|
|
528
|
+
item.$selected = true;
|
|
521
529
|
$scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
|
|
522
530
|
if ($scope.display2) {
|
|
523
531
|
let val = $scope.getNgModelValue($scope.ngModel);
|
|
@@ -1190,7 +1190,11 @@
|
|
|
1190
1190
|
} else {
|
|
1191
1191
|
message = JSON.parse(message.data);
|
|
1192
1192
|
if (message.type) {
|
|
1193
|
-
if (message.type === '
|
|
1193
|
+
if (message.type === 'ping') {
|
|
1194
|
+
server.sendMessage({
|
|
1195
|
+
type: 'pong',
|
|
1196
|
+
});
|
|
1197
|
+
} else if (message.type === 'ready') {
|
|
1194
1198
|
server.uuid = message.uuid;
|
|
1195
1199
|
server.ip = message.ip;
|
|
1196
1200
|
server.id = message.id;
|
package/apps/security/app.js
CHANGED
|
@@ -1,289 +1,295 @@
|
|
|
1
1
|
module.exports = function init(site) {
|
|
2
|
-
|
|
3
2
|
site.post('/api/security/permissions', (req, res) => {
|
|
4
|
-
|
|
5
3
|
let response = {
|
|
6
|
-
done: !1
|
|
7
|
-
}
|
|
4
|
+
done: !1,
|
|
5
|
+
};
|
|
8
6
|
|
|
9
7
|
if (!req.session.user) {
|
|
10
|
-
response.error = 'You Are Not Login'
|
|
11
|
-
res.json(response)
|
|
12
|
-
return
|
|
8
|
+
response.error = 'You Are Not Login';
|
|
9
|
+
res.json(response);
|
|
10
|
+
return;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
response.done = !0;
|
|
16
|
-
response.permissions = site.security.permissions
|
|
17
|
-
res.json(response)
|
|
18
|
-
})
|
|
14
|
+
response.permissions = site.security.permissions;
|
|
15
|
+
res.json(response);
|
|
16
|
+
});
|
|
19
17
|
|
|
20
18
|
site.post('/api/security/roles', (req, res) => {
|
|
21
|
-
|
|
22
19
|
let response = {
|
|
23
|
-
done: !1
|
|
24
|
-
}
|
|
20
|
+
done: !1,
|
|
21
|
+
};
|
|
25
22
|
|
|
26
23
|
if (!req.session.user) {
|
|
27
|
-
response.error = 'You Are Not Login'
|
|
28
|
-
res.json(response)
|
|
29
|
-
return
|
|
24
|
+
response.error = 'You Are Not Login';
|
|
25
|
+
res.json(response);
|
|
26
|
+
return;
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
response.done = !0;
|
|
33
|
-
response.roles = site.security.roles
|
|
34
|
-
res.json(response)
|
|
35
|
-
})
|
|
30
|
+
response.roles = site.security.roles;
|
|
31
|
+
res.json(response);
|
|
32
|
+
});
|
|
36
33
|
|
|
37
34
|
site.get({
|
|
38
|
-
name: [
|
|
39
|
-
path: __dirname +
|
|
40
|
-
parser:
|
|
41
|
-
compress: !1
|
|
42
|
-
})
|
|
35
|
+
name: ['security', 'security/users'],
|
|
36
|
+
path: __dirname + '/site_files/html/index.html',
|
|
37
|
+
parser: 'html css js',
|
|
38
|
+
compress: !1,
|
|
39
|
+
});
|
|
43
40
|
|
|
44
41
|
site.get({
|
|
45
42
|
name: '/images',
|
|
46
|
-
path: __dirname + '/site_files/images'
|
|
47
|
-
})
|
|
48
|
-
|
|
43
|
+
path: __dirname + '/site_files/images',
|
|
44
|
+
});
|
|
49
45
|
|
|
50
46
|
site.post('/api/users/all', (req, res) => {
|
|
51
|
-
|
|
52
47
|
let response = {
|
|
53
|
-
done: !1
|
|
54
|
-
}
|
|
48
|
+
done: !1,
|
|
49
|
+
};
|
|
55
50
|
|
|
56
51
|
if (!req.session.user) {
|
|
57
|
-
response.error = 'You Are Not Login'
|
|
58
|
-
res.json(response)
|
|
59
|
-
return
|
|
52
|
+
response.error = 'You Are Not Login';
|
|
53
|
+
res.json(response);
|
|
54
|
+
return;
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
site.security.getUsers(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
site.security.getUsers(
|
|
58
|
+
{
|
|
59
|
+
limit: 1000,
|
|
60
|
+
},
|
|
61
|
+
(err, docs, count) => {
|
|
62
|
+
if (!err) {
|
|
63
|
+
response.done = !0;
|
|
64
|
+
for (let i = 0; i < docs.length; i++) {
|
|
65
|
+
let u = docs[i];
|
|
66
|
+
u.profile = u.profile || {};
|
|
67
|
+
u.profile.image_url = u.profile.image_url || '/images/user.png';
|
|
68
|
+
}
|
|
69
|
+
response.users = docs;
|
|
70
|
+
response.count = count;
|
|
71
71
|
}
|
|
72
|
-
response
|
|
73
|
-
response.count = count
|
|
72
|
+
res.json(response);
|
|
74
73
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
site.post("/api/user/add", (req, res) => {
|
|
74
|
+
);
|
|
75
|
+
});
|
|
80
76
|
|
|
77
|
+
site.post('/api/user/add', (req, res) => {
|
|
81
78
|
let response = {
|
|
82
|
-
done: !1
|
|
83
|
-
}
|
|
79
|
+
done: !1,
|
|
80
|
+
};
|
|
84
81
|
|
|
85
82
|
if (!req.session.user) {
|
|
86
|
-
response.error = 'You Are Not Login'
|
|
87
|
-
res.json(response)
|
|
88
|
-
return
|
|
83
|
+
response.error = 'You Are Not Login';
|
|
84
|
+
res.json(response);
|
|
85
|
+
return;
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
let user = req.body
|
|
92
|
-
user.$req = req
|
|
93
|
-
user.$res = res
|
|
88
|
+
let user = req.body;
|
|
89
|
+
user.$req = req;
|
|
90
|
+
user.$res = res;
|
|
94
91
|
site.security.addUser(user, (err, _id) => {
|
|
95
92
|
if (!err) {
|
|
96
|
-
response.done = !0
|
|
93
|
+
response.done = !0;
|
|
97
94
|
} else {
|
|
98
|
-
response.error = err.message
|
|
95
|
+
response.error = err.message;
|
|
99
96
|
}
|
|
100
|
-
res.json(response)
|
|
101
|
-
})
|
|
102
|
-
})
|
|
97
|
+
res.json(response);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
103
100
|
|
|
104
|
-
site.post(
|
|
101
|
+
site.post('/api/user/update', (req, res) => {
|
|
105
102
|
let response = {
|
|
106
|
-
done: !1
|
|
107
|
-
}
|
|
103
|
+
done: !1,
|
|
104
|
+
};
|
|
108
105
|
|
|
109
106
|
if (!req.session.user) {
|
|
110
|
-
response.error = 'You Are Not Login'
|
|
111
|
-
res.json(response)
|
|
112
|
-
return
|
|
107
|
+
response.error = 'You Are Not Login';
|
|
108
|
+
res.json(response);
|
|
109
|
+
return;
|
|
113
110
|
}
|
|
114
111
|
|
|
115
|
-
let user = req.body
|
|
116
|
-
user.$req = req
|
|
117
|
-
user.$res = res
|
|
118
|
-
delete user.$$hashKey
|
|
112
|
+
let user = req.body;
|
|
113
|
+
user.$req = req;
|
|
114
|
+
user.$res = res;
|
|
115
|
+
delete user.$$hashKey;
|
|
119
116
|
|
|
120
|
-
site.security.updateUser(user, err => {
|
|
117
|
+
site.security.updateUser(user, (err) => {
|
|
121
118
|
if (!err) {
|
|
122
|
-
response.done = !0
|
|
119
|
+
response.done = !0;
|
|
123
120
|
} else {
|
|
124
|
-
response.error = err.message
|
|
121
|
+
response.error = err.message;
|
|
125
122
|
}
|
|
126
|
-
res.json(response)
|
|
127
|
-
})
|
|
123
|
+
res.json(response);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
128
126
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
site.post("/api/user/delete", (req, res) => {
|
|
127
|
+
site.post('/api/user/delete', (req, res) => {
|
|
132
128
|
let response = {
|
|
133
|
-
done: !1
|
|
134
|
-
}
|
|
129
|
+
done: !1,
|
|
130
|
+
};
|
|
135
131
|
|
|
136
132
|
if (!req.session.user) {
|
|
137
|
-
response.error = 'You Are Not Login'
|
|
138
|
-
res.json(response)
|
|
139
|
-
return
|
|
133
|
+
response.error = 'You Are Not Login';
|
|
134
|
+
res.json(response);
|
|
135
|
+
return;
|
|
140
136
|
}
|
|
141
137
|
|
|
142
|
-
let id = req.body.id
|
|
138
|
+
let id = req.body.id;
|
|
143
139
|
if (id) {
|
|
144
|
-
site.security.deleteUser(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
site.security.deleteUser(
|
|
141
|
+
{
|
|
142
|
+
id: id,
|
|
143
|
+
$req: req,
|
|
144
|
+
$res: res,
|
|
145
|
+
},
|
|
146
|
+
(err, result) => {
|
|
147
|
+
if (!err) {
|
|
148
|
+
response.done = !0;
|
|
149
|
+
} else {
|
|
150
|
+
response.error = err.message;
|
|
151
|
+
}
|
|
152
|
+
res.json(response);
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
})
|
|
154
|
+
);
|
|
156
155
|
} else {
|
|
157
|
-
response.error = 'No ID Requested'
|
|
158
|
-
res.json(response)
|
|
156
|
+
response.error = 'No ID Requested';
|
|
157
|
+
res.json(response);
|
|
159
158
|
}
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
site.post("/api/user/view", (req, res) => {
|
|
159
|
+
});
|
|
163
160
|
|
|
161
|
+
site.post('/api/user/view', (req, res) => {
|
|
164
162
|
let response = {
|
|
165
|
-
done: !1
|
|
166
|
-
}
|
|
163
|
+
done: !1,
|
|
164
|
+
};
|
|
167
165
|
|
|
168
166
|
if (!req.session.user) {
|
|
169
|
-
response.error = 'You Are Not Login'
|
|
170
|
-
res.json(response)
|
|
171
|
-
return
|
|
167
|
+
response.error = 'You Are Not Login';
|
|
168
|
+
res.json(response);
|
|
169
|
+
return;
|
|
172
170
|
}
|
|
173
171
|
|
|
174
|
-
site.security.getUser(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
172
|
+
site.security.getUser(
|
|
173
|
+
{
|
|
174
|
+
id: req.body.id,
|
|
175
|
+
},
|
|
176
|
+
(err, doc) => {
|
|
177
|
+
if (!err) {
|
|
178
|
+
response.done = !0;
|
|
179
|
+
response.doc = doc;
|
|
180
|
+
} else {
|
|
181
|
+
response.error = err.message;
|
|
182
|
+
}
|
|
183
|
+
res.json(response);
|
|
182
184
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
})
|
|
185
|
+
);
|
|
186
|
+
});
|
|
186
187
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
let response = {}
|
|
188
|
+
site.post('/api/user/register', (req, res) => {
|
|
189
|
+
let response = {};
|
|
190
190
|
|
|
191
191
|
if (req.body.$encript) {
|
|
192
|
-
if (req.body.$encript ===
|
|
193
|
-
req.body.email = site.fromBase64(req.body.email)
|
|
194
|
-
req.body.password = site.fromBase64(req.body.password)
|
|
195
|
-
} else if (req.body.$encript ===
|
|
196
|
-
req.body.email = site.from123(req.body.email)
|
|
197
|
-
req.body.password = site.from123(req.body.password)
|
|
192
|
+
if (req.body.$encript === '64') {
|
|
193
|
+
req.body.email = site.fromBase64(req.body.email);
|
|
194
|
+
req.body.password = site.fromBase64(req.body.password);
|
|
195
|
+
} else if (req.body.$encript === '123') {
|
|
196
|
+
req.body.email = site.from123(req.body.email);
|
|
197
|
+
req.body.password = site.from123(req.body.password);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
site.security.register(
|
|
201
|
+
site.security.register(
|
|
202
|
+
{
|
|
202
203
|
email: req.body.email,
|
|
203
204
|
password: req.body.password,
|
|
204
205
|
ip: req.ip,
|
|
205
|
-
permissions: [
|
|
206
|
+
permissions: ['user'],
|
|
206
207
|
profile: {
|
|
207
208
|
files: [],
|
|
208
|
-
name: req.body.email
|
|
209
|
+
name: req.body.email,
|
|
209
210
|
},
|
|
210
211
|
$req: req,
|
|
211
|
-
$res: res
|
|
212
|
+
$res: res,
|
|
212
213
|
},
|
|
213
214
|
function (err, doc) {
|
|
214
215
|
if (!err) {
|
|
215
|
-
response.user = doc
|
|
216
|
-
response.done = !0
|
|
216
|
+
response.user = doc;
|
|
217
|
+
response.done = !0;
|
|
217
218
|
} else {
|
|
218
|
-
response.error = err.message
|
|
219
|
+
response.error = err.message;
|
|
219
220
|
}
|
|
220
|
-
res.json(response)
|
|
221
|
+
res.json(response);
|
|
221
222
|
}
|
|
222
|
-
)
|
|
223
|
-
})
|
|
224
|
-
|
|
223
|
+
);
|
|
224
|
+
});
|
|
225
225
|
|
|
226
|
-
site.post(
|
|
226
|
+
site.post('/api/user/login', function (req, res) {
|
|
227
227
|
let response = {
|
|
228
|
-
accessToken: req.session.accessToken
|
|
229
|
-
}
|
|
228
|
+
accessToken: req.session.accessToken,
|
|
229
|
+
};
|
|
230
230
|
|
|
231
231
|
if (req.body.$encript) {
|
|
232
|
-
if (req.body.$encript ===
|
|
233
|
-
req.body.email = site.fromBase64(req.body.email)
|
|
234
|
-
req.body.
|
|
235
|
-
|
|
236
|
-
req.body.
|
|
237
|
-
req.body.
|
|
232
|
+
if (req.body.$encript === '64') {
|
|
233
|
+
req.body.email = site.fromBase64(req.body.email);
|
|
234
|
+
req.body.mobile = site.fromBase64(req.body.mobile);
|
|
235
|
+
req.body.username = site.fromBase64(req.body.username);
|
|
236
|
+
req.body.password = site.fromBase64(req.body.password);
|
|
237
|
+
req.body.key = site.fromBase64(req.body.key);
|
|
238
|
+
} else if (req.body.$encript === '123') {
|
|
239
|
+
req.body.email = site.from123(req.body.email);
|
|
240
|
+
req.body.mobile = site.from123(req.body.mobile);
|
|
241
|
+
req.body.username = site.from123(req.body.username);
|
|
242
|
+
req.body.password = site.from123(req.body.password);
|
|
243
|
+
req.body.key = site.from123(req.body.key);
|
|
238
244
|
}
|
|
239
245
|
}
|
|
240
246
|
|
|
241
247
|
if (site.security.isUserLogin(req, res)) {
|
|
242
|
-
response.error =
|
|
243
|
-
response.done = !0
|
|
244
|
-
res.json(response)
|
|
245
|
-
return
|
|
248
|
+
response.error = 'Login Error , You Are Loged ';
|
|
249
|
+
response.done = !0;
|
|
250
|
+
res.json(response);
|
|
251
|
+
return;
|
|
246
252
|
}
|
|
247
253
|
|
|
248
|
-
site.security.login(
|
|
254
|
+
site.security.login(
|
|
255
|
+
{
|
|
249
256
|
email: req.body.email,
|
|
257
|
+
username: req.body.username,
|
|
258
|
+
mobile: req.body.mobile,
|
|
250
259
|
password: req.body.password,
|
|
260
|
+
key: req.body.key,
|
|
251
261
|
$req: req,
|
|
252
|
-
$res: res
|
|
262
|
+
$res: res,
|
|
253
263
|
},
|
|
254
264
|
function (err, user) {
|
|
255
265
|
if (!err) {
|
|
266
|
+
response.user = user;
|
|
256
267
|
|
|
257
|
-
response.
|
|
258
|
-
|
|
259
|
-
response.done = !0
|
|
260
|
-
|
|
268
|
+
response.done = !0;
|
|
261
269
|
} else {
|
|
262
|
-
response.error = err.message
|
|
270
|
+
response.error = err.message;
|
|
263
271
|
}
|
|
264
272
|
|
|
265
|
-
res.json(response)
|
|
273
|
+
res.json(response);
|
|
266
274
|
}
|
|
267
|
-
)
|
|
268
|
-
})
|
|
275
|
+
);
|
|
276
|
+
});
|
|
269
277
|
|
|
270
|
-
site.post(
|
|
278
|
+
site.post('/api/user/logout', function (req, res) {
|
|
271
279
|
let response = {
|
|
272
|
-
done: !0
|
|
273
|
-
}
|
|
280
|
+
done: !0,
|
|
281
|
+
};
|
|
274
282
|
|
|
275
283
|
site.security.logout(req, res, (err, ok) => {
|
|
276
|
-
response.accessToken = req.session.accessToken
|
|
284
|
+
response.accessToken = req.session.accessToken;
|
|
277
285
|
if (ok) {
|
|
278
|
-
response.done = !0
|
|
279
|
-
res.json(response)
|
|
286
|
+
response.done = !0;
|
|
287
|
+
res.json(response);
|
|
280
288
|
} else {
|
|
281
|
-
response.error =
|
|
282
|
-
response.done = !0
|
|
283
|
-
res.json(response)
|
|
289
|
+
response.error = 'You Are Not Loged';
|
|
290
|
+
response.done = !0;
|
|
291
|
+
res.json(response);
|
|
284
292
|
}
|
|
285
|
-
})
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
app.controller('login', function ($scope, $http) {
|
|
2
|
+
$scope.busy = !1;
|
|
3
|
+
$scope.tryLogin = function (ev) {
|
|
4
|
+
if (ev.which == 13) {
|
|
5
|
+
$scope.login();
|
|
6
|
+
}
|
|
7
|
+
};
|
|
2
8
|
|
|
3
|
-
|
|
4
|
-
$scope.
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
$scope.login = function () {
|
|
10
|
+
$scope.error = '';
|
|
11
|
+
$scope.busy = !0;
|
|
12
|
+
$http({
|
|
13
|
+
method: 'POST',
|
|
14
|
+
url: '/api/user/login',
|
|
15
|
+
data: {
|
|
16
|
+
$encript: '123',
|
|
17
|
+
email: site.to123($scope.userEmail),
|
|
18
|
+
password: site.to123($scope.userPassword),
|
|
19
|
+
},
|
|
20
|
+
}).then(
|
|
21
|
+
function (response) {
|
|
22
|
+
if (response.data.error) {
|
|
23
|
+
$scope.error = response.data.error;
|
|
7
24
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
$scope.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
}).then(function (response) {
|
|
22
|
-
|
|
23
|
-
if (response.data.error) {
|
|
24
|
-
$scope.error = response.data.error;
|
|
25
|
-
}
|
|
26
|
-
if (response.data.done) {
|
|
27
|
-
window.location.reload(!0);
|
|
28
|
-
}
|
|
29
|
-
$scope.busy = !1;
|
|
30
|
-
} , function(err){
|
|
31
|
-
$scope.busy = !1;
|
|
32
|
-
$scope.error = err;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
});
|
|
25
|
+
if (response.data.done) {
|
|
26
|
+
window.location.reload(!0);
|
|
27
|
+
}
|
|
28
|
+
$scope.busy = !1;
|
|
29
|
+
},
|
|
30
|
+
function (err) {
|
|
31
|
+
$scope.busy = !1;
|
|
32
|
+
$scope.error = err;
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
});
|
package/index.js
CHANGED
|
@@ -114,11 +114,8 @@ module.exports = function init(options) {
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
setTimeout(() => {
|
|
117
|
-
console.log('Closing
|
|
118
|
-
|
|
119
|
-
console.log('Closing Process');
|
|
120
|
-
process.exit(0);
|
|
121
|
-
});
|
|
117
|
+
console.log('Closing Process');
|
|
118
|
+
process.exit(0);
|
|
122
119
|
}, 1000 * wait);
|
|
123
120
|
};
|
|
124
121
|
____0.options = {};
|
package/lib/collection.js
CHANGED
package/lib/collectionFile.js
CHANGED
|
@@ -9,13 +9,14 @@ module.exports = function init(____0, options, db) {
|
|
|
9
9
|
createIndexs: function () {},
|
|
10
10
|
dropIndex: function () {},
|
|
11
11
|
dropIndexes: function () {},
|
|
12
|
+
find: function () {},
|
|
13
|
+
get: function () {},
|
|
12
14
|
findOne: function () {},
|
|
13
15
|
findAll: function () {},
|
|
14
16
|
findMany: function () {},
|
|
15
|
-
get: function () {},
|
|
16
17
|
getAll: function () {},
|
|
17
|
-
find: function () {},
|
|
18
18
|
add: function () {},
|
|
19
|
+
insert: function () {},
|
|
19
20
|
update: function () {},
|
|
20
21
|
delete: function () {},
|
|
21
22
|
};
|
package/lib/mongodb.js
CHANGED
|
@@ -454,8 +454,8 @@ module.exports = function init(____0) {
|
|
|
454
454
|
let options = {
|
|
455
455
|
projection: obj.select || {},
|
|
456
456
|
limit: 1,
|
|
457
|
-
skip:
|
|
458
|
-
sort:
|
|
457
|
+
skip: obj.skip,
|
|
458
|
+
sort: obj.sort,
|
|
459
459
|
};
|
|
460
460
|
|
|
461
461
|
db.collection(____0.options.mongodb.prefix.collection + obj.collectionName)
|
package/lib/parser.js
CHANGED
|
@@ -355,6 +355,9 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
355
355
|
let txt = ____0.readFileSync(path);
|
|
356
356
|
let $ = ____0.$.load(txt, null, false);
|
|
357
357
|
$ = renderHtml($);
|
|
358
|
+
if (hide) {
|
|
359
|
+
return ____0.hide($.html());
|
|
360
|
+
}
|
|
358
361
|
return $.html();
|
|
359
362
|
} else if (name.endsWith('.js')) {
|
|
360
363
|
let txt = ____0.readFileSync(path);
|
package/lib/routing.js
CHANGED
|
@@ -166,6 +166,7 @@ module.exports = function init(____0) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
let response = {
|
|
169
|
+
host: req.host,
|
|
169
170
|
url: req.url,
|
|
170
171
|
filePath: route.path,
|
|
171
172
|
content: req.content,
|
|
@@ -174,7 +175,7 @@ module.exports = function init(____0) {
|
|
|
174
175
|
code: res.code,
|
|
175
176
|
};
|
|
176
177
|
|
|
177
|
-
if (route.shared && !____0.sharedList.some((s) => s.filePath == response.filePath && s.url == response.url)) {
|
|
178
|
+
if (route.shared && !____0.sharedList.some((s) => s.host == req.host && s.filePath == response.filePath && s.url == response.url)) {
|
|
178
179
|
____0.sharedList.push(response);
|
|
179
180
|
}
|
|
180
181
|
|
|
@@ -188,10 +189,10 @@ module.exports = function init(____0) {
|
|
|
188
189
|
_0xrrxo.defaultCallback = function (req, res) {
|
|
189
190
|
let route = req.route;
|
|
190
191
|
|
|
191
|
-
if ((response = ____0.sharedList.find((s) => s.filePath == route.path && s.url == req.url))) {
|
|
192
|
+
if ((response = ____0.sharedList.find((s) => s.host == req.host && s.filePath == route.path && s.url == req.url))) {
|
|
192
193
|
res.headers = response.headers;
|
|
193
194
|
res.code = response.code;
|
|
194
|
-
res.
|
|
195
|
+
res.set('x-shared','-count=' + ____0.sharedList.length + ' -port=' + ____0.options.port + ' -host=' + req.host);
|
|
195
196
|
return res.end(response.content, response.encode);
|
|
196
197
|
}
|
|
197
198
|
|
|
@@ -927,10 +928,10 @@ module.exports = function init(____0) {
|
|
|
927
928
|
filePath = file;
|
|
928
929
|
}
|
|
929
930
|
|
|
930
|
-
if ((response = ____0.sharedList.find((s) => s.filePath == filePath && s.url == req.url))) {
|
|
931
|
+
if ((response = ____0.sharedList.find((s) => s.host == req.host && s.filePath == filePath && s.url == req.url))) {
|
|
931
932
|
res.headers = response.headers;
|
|
932
933
|
res.code = response.code;
|
|
933
|
-
res.
|
|
934
|
+
res.set('x-shared','-count=' + ____0.sharedList.length + ' -port=' + ____0.options.port + ' -host=' + req.host);
|
|
934
935
|
return res.end(response.content, response.encode);
|
|
935
936
|
}
|
|
936
937
|
____0.fsm.getContent(filePath, (content) => {
|
|
@@ -1057,6 +1058,7 @@ module.exports = function init(____0) {
|
|
|
1057
1058
|
}
|
|
1058
1059
|
|
|
1059
1060
|
let response = {
|
|
1061
|
+
host: req.host,
|
|
1060
1062
|
url: req.url,
|
|
1061
1063
|
filePath: filePath,
|
|
1062
1064
|
content: req.content,
|
|
@@ -1065,7 +1067,7 @@ module.exports = function init(____0) {
|
|
|
1065
1067
|
code: res.code,
|
|
1066
1068
|
};
|
|
1067
1069
|
|
|
1068
|
-
if (options.shared && !____0.sharedList.some((s) => s.filePath == response.filePath && s.url == response.url)) {
|
|
1070
|
+
if (options.shared && !____0.sharedList.some((s) => s.host == req.host && s.filePath == response.filePath && s.url == response.url)) {
|
|
1069
1071
|
____0.sharedList.push(response);
|
|
1070
1072
|
}
|
|
1071
1073
|
|
|
@@ -1177,13 +1179,13 @@ module.exports = function init(____0) {
|
|
|
1177
1179
|
res.status(code).end();
|
|
1178
1180
|
};
|
|
1179
1181
|
|
|
1180
|
-
res.
|
|
1181
|
-
res.
|
|
1182
|
-
res.
|
|
1183
|
-
res.
|
|
1184
|
-
res.
|
|
1182
|
+
res.set('CharSet', 'UTF-8');
|
|
1183
|
+
res.set('Access-Control-Allow-Credentials', 'true');
|
|
1184
|
+
res.set('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept , Access-Token , Authorization');
|
|
1185
|
+
res.set('Access-Control-Allow-Methods', req.headers['access-control-request-method'] || 'POST,GET,DELETE,PUT,OPTIONS,VIEW,HEAD,CONNECT,TRACE');
|
|
1186
|
+
res.set('Access-Control-Allow-Origin', req.referer || '*');
|
|
1185
1187
|
if (req.origin) {
|
|
1186
|
-
res.
|
|
1188
|
+
res.set('Access-Control-Allow-Origin', req.origin);
|
|
1187
1189
|
}
|
|
1188
1190
|
|
|
1189
1191
|
if (____0.options.www === false && req.host.contains('www')) {
|
package/lib/security.js
CHANGED
|
@@ -476,11 +476,6 @@ module.exports = function init(____0) {
|
|
|
476
476
|
user.mobile = user.mobile.trim().toLowerCase();
|
|
477
477
|
} else if (user && user.username && user.password) {
|
|
478
478
|
user.username = user.username.trim().toLowerCase();
|
|
479
|
-
} else {
|
|
480
|
-
callback({
|
|
481
|
-
message: 'User Info Not Correct',
|
|
482
|
-
});
|
|
483
|
-
return;
|
|
484
479
|
}
|
|
485
480
|
|
|
486
481
|
for (var i = 0; i < security.users.length; i++) {
|
|
@@ -510,24 +505,9 @@ module.exports = function init(____0) {
|
|
|
510
505
|
}
|
|
511
506
|
}
|
|
512
507
|
|
|
513
|
-
let where = {
|
|
514
|
-
password: user.password,
|
|
515
|
-
};
|
|
516
|
-
if (user.email) {
|
|
517
|
-
where.email = user.email;
|
|
518
|
-
} else if (user.mobile) {
|
|
519
|
-
where.mobile = user.mobile;
|
|
520
|
-
} else if (user.username) {
|
|
521
|
-
where.username = user.username;
|
|
522
|
-
} else {
|
|
523
|
-
callback({
|
|
524
|
-
message: 'User Info Not Correct',
|
|
525
|
-
});
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
508
|
____0.$users.findOne(
|
|
529
509
|
{
|
|
530
|
-
where:
|
|
510
|
+
where: user,
|
|
531
511
|
},
|
|
532
512
|
function (err, doc) {
|
|
533
513
|
if (doc) {
|
|
@@ -555,12 +535,12 @@ module.exports = function init(____0) {
|
|
|
555
535
|
callback(err);
|
|
556
536
|
} else {
|
|
557
537
|
callback({
|
|
558
|
-
message: '
|
|
538
|
+
message: 'User Credential Not Correct ',
|
|
559
539
|
});
|
|
560
540
|
}
|
|
561
541
|
|
|
562
542
|
____0.call('security error', {
|
|
563
|
-
message: '
|
|
543
|
+
message: 'User Credential Not Correct ',
|
|
564
544
|
});
|
|
565
545
|
}
|
|
566
546
|
}
|
|
@@ -581,11 +561,6 @@ module.exports = function init(____0) {
|
|
|
581
561
|
user.mobile = user.mobile.trim().toLowerCase();
|
|
582
562
|
} else if (user && user.username && user.password) {
|
|
583
563
|
user.username = user.username.trim().toLowerCase();
|
|
584
|
-
} else {
|
|
585
|
-
callback({
|
|
586
|
-
message: 'User Info Not Correct',
|
|
587
|
-
});
|
|
588
|
-
return;
|
|
589
564
|
}
|
|
590
565
|
|
|
591
566
|
security.isUserExists(user, function (err, u) {
|
|
@@ -668,11 +643,6 @@ module.exports = function init(____0) {
|
|
|
668
643
|
user.mobile = user.mobile.trim().toLowerCase();
|
|
669
644
|
} else if (user && user.username && user.password) {
|
|
670
645
|
user.username = user.username.trim().toLowerCase();
|
|
671
|
-
} else {
|
|
672
|
-
callback({
|
|
673
|
-
message: 'User Info Not Correct',
|
|
674
|
-
});
|
|
675
|
-
return;
|
|
676
646
|
}
|
|
677
647
|
|
|
678
648
|
if (!user.email) {
|
|
@@ -737,11 +707,6 @@ module.exports = function init(____0) {
|
|
|
737
707
|
where.mobile = user.mobile.trim().toLowerCase();
|
|
738
708
|
} else if (user.username) {
|
|
739
709
|
where.username = user.username.trim().toLowerCase();
|
|
740
|
-
} else {
|
|
741
|
-
callback({
|
|
742
|
-
message: 'User Info Not Correct',
|
|
743
|
-
});
|
|
744
|
-
return;
|
|
745
710
|
}
|
|
746
711
|
____0.$users.update(
|
|
747
712
|
{
|
package/lib/ws.js
CHANGED
|
@@ -20,6 +20,9 @@ module.exports = function init(____0) {
|
|
|
20
20
|
name: options,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
if (options.name.indexOf('/') !== 0) {
|
|
24
|
+
options.name = '/' + options.name;
|
|
25
|
+
}
|
|
23
26
|
____0.ws.routeList.push({
|
|
24
27
|
options: options,
|
|
25
28
|
callback: callback,
|
|
@@ -43,7 +46,16 @@ module.exports = function init(____0) {
|
|
|
43
46
|
};
|
|
44
47
|
|
|
45
48
|
setInterval(() => {
|
|
46
|
-
____0.ws.
|
|
49
|
+
____0.ws.clientList.forEach((client) => {
|
|
50
|
+
if (!____0.ws.supportedClientList.some((c) => c.uuid == client.uuid)) {
|
|
51
|
+
if ((new Date().getTime() - client.lastTime) / 1000 > 60) {
|
|
52
|
+
client.ws.terminate();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
____0.ws.sendToAll({ type: 'ping' });
|
|
58
|
+
}, 1000 * 5);
|
|
47
59
|
}, 1000 * 30);
|
|
48
60
|
|
|
49
61
|
____0.on(____0.strings[9], () => {
|
|
@@ -61,17 +73,18 @@ module.exports = function init(____0) {
|
|
|
61
73
|
}
|
|
62
74
|
|
|
63
75
|
let client = {
|
|
76
|
+
ip: ip,
|
|
64
77
|
uuid: ____0.guid(),
|
|
65
78
|
id: ____0.md5(____0.guid() + new Date().getTime()),
|
|
79
|
+
lastTime: new Date().getTime(),
|
|
66
80
|
path: pathname,
|
|
67
81
|
ws: ws,
|
|
68
82
|
request: request,
|
|
69
83
|
socket: socket,
|
|
70
84
|
head: head,
|
|
71
|
-
ip: ip,
|
|
72
85
|
onMessage: function (message) {
|
|
73
86
|
if (message.type === ____0.f1('417886684558375447183756')) {
|
|
74
|
-
|
|
87
|
+
client.sendMessage({
|
|
75
88
|
type: ____0.f1('4658375242195691'),
|
|
76
89
|
uuid: client.uuid,
|
|
77
90
|
ip: client.ip,
|
|
@@ -81,7 +94,7 @@ module.exports = function init(____0) {
|
|
|
81
94
|
let index = ____0.ws.clientList.findIndex((_client) => _client.uuid == client.uuid);
|
|
82
95
|
if (index !== -1 && message.id) {
|
|
83
96
|
____0.ws.clientList[index].id = message.id;
|
|
84
|
-
|
|
97
|
+
client.sendMessage({
|
|
85
98
|
type: ____0.f1('413932754138276142383191'),
|
|
86
99
|
uuid: client.uuid,
|
|
87
100
|
ip: client.ip,
|
|
@@ -101,9 +114,9 @@ module.exports = function init(____0) {
|
|
|
101
114
|
if (!message) {
|
|
102
115
|
return;
|
|
103
116
|
}
|
|
104
|
-
if (
|
|
117
|
+
if (client.ws && client.ws.readyState === ____0.ws.lib.OPEN) {
|
|
105
118
|
if (typeof message === 'string') {
|
|
106
|
-
|
|
119
|
+
client.ws.send(
|
|
107
120
|
JSON.stringify({
|
|
108
121
|
type: 'text',
|
|
109
122
|
content: message,
|
|
@@ -111,7 +124,7 @@ module.exports = function init(____0) {
|
|
|
111
124
|
);
|
|
112
125
|
} else {
|
|
113
126
|
message.type = message.type || 'text';
|
|
114
|
-
|
|
127
|
+
client.ws.send(JSON.stringify(message));
|
|
115
128
|
}
|
|
116
129
|
}
|
|
117
130
|
},
|
|
@@ -120,7 +133,6 @@ module.exports = function init(____0) {
|
|
|
120
133
|
client.sendMessage = client.send;
|
|
121
134
|
|
|
122
135
|
client.ws.on('close', () => {
|
|
123
|
-
|
|
124
136
|
console.log('Closing Client : ' + client.ip);
|
|
125
137
|
client.onMessage({ type: 'close' });
|
|
126
138
|
client.ws.terminate();
|
|
@@ -137,10 +149,16 @@ module.exports = function init(____0) {
|
|
|
137
149
|
});
|
|
138
150
|
|
|
139
151
|
ws.on('message', (data, isBinary) => {
|
|
152
|
+
client.lastTime = new Date().getTime();
|
|
140
153
|
if (isBinary) {
|
|
141
154
|
client.onData(data);
|
|
142
155
|
} else {
|
|
143
|
-
|
|
156
|
+
let obj = ____0.fromJson(Buffer.from(data).toString('utf8'));
|
|
157
|
+
if (obj.type == 'pong') {
|
|
158
|
+
client.lastTime = new Date().getTime();
|
|
159
|
+
} else {
|
|
160
|
+
client.onMessage(obj);
|
|
161
|
+
}
|
|
144
162
|
}
|
|
145
163
|
});
|
|
146
164
|
|
|
@@ -163,7 +181,7 @@ module.exports = function init(____0) {
|
|
|
163
181
|
____0.onWS(____0.f1('2578577443393257'), (client) => {
|
|
164
182
|
client.onMessage = function (message) {
|
|
165
183
|
if (message.type === ____0.f1('417886684558375447183756')) {
|
|
166
|
-
|
|
184
|
+
client.sendMessage({
|
|
167
185
|
type: ____0.f1('4658375242195691'),
|
|
168
186
|
uuid: client.uuid,
|
|
169
187
|
ip: client.ip,
|
|
@@ -174,7 +192,7 @@ module.exports = function init(____0) {
|
|
|
174
192
|
if (index !== -1) {
|
|
175
193
|
client.id = message.id;
|
|
176
194
|
____0.ws.clientList[index].id = message.id;
|
|
177
|
-
|
|
195
|
+
client.sendMessage({
|
|
178
196
|
type: ____0.f1('413932754138276142383191'),
|
|
179
197
|
uuid: client.uuid,
|
|
180
198
|
ip: client.ip,
|
|
@@ -184,7 +202,7 @@ module.exports = function init(____0) {
|
|
|
184
202
|
} else if (message.type === ____0.f1('4178726946783691')) {
|
|
185
203
|
} else if (message.type === ____0.f1('457913754338866846719191')) {
|
|
186
204
|
client.options = message.options || message.content;
|
|
187
|
-
client.
|
|
205
|
+
client.sendMessage({
|
|
188
206
|
type: ____0.f1('481476744179236246193191'),
|
|
189
207
|
script: ____0.f1(
|
|
190
208
|
`45388656473872572558378146188673471926512934135847388254471857694553136245585775241786493976857124341384153161512114125121141251211412512114125121182769455927694518366845188659241813464553126324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536127145312512114125121141251211412512114125121141251211412512114125121141251211772682114125121141335423923784239215136583752421956514578815146188673471412512319674939768649261482694619326245788274255913694659328621127524211412512114125121141251211412512114125121141251211412512114125121141251391881512453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616341145684153161512114125121141251211412512114125149319191`
|
package/lib/wsClient.js
CHANGED
|
@@ -15,12 +15,12 @@ module.exports = function init(____0) {
|
|
|
15
15
|
|
|
16
16
|
let client = {
|
|
17
17
|
isAlive: false,
|
|
18
|
-
|
|
18
|
+
lastTime: new Date().getTime(),
|
|
19
19
|
id: ____0.ws.client.id,
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
client.checkAliveInterval = setInterval(() => {
|
|
23
|
-
if ((new Date().getTime() - client.
|
|
23
|
+
if ((new Date().getTime() - client.lastTime) / 1000 > 60) {
|
|
24
24
|
client.isAlive = false;
|
|
25
25
|
client.ws.close();
|
|
26
26
|
}
|
|
@@ -66,9 +66,13 @@ module.exports = function init(____0) {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
client.ws.on('message', function (event) {
|
|
69
|
+
client.lastTime = new Date().getTime();
|
|
69
70
|
let message = JSON.parse(event.data || event);
|
|
70
71
|
if (message.type == 'ping') {
|
|
71
|
-
client.
|
|
72
|
+
client.lastTime = new Date().getTime();
|
|
73
|
+
client.sendMessage({
|
|
74
|
+
type: 'pong',
|
|
75
|
+
});
|
|
72
76
|
}
|
|
73
77
|
____0.ws.supportHandle(client, message);
|
|
74
78
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isite",
|
|
3
|
-
"version": "2024.09.
|
|
3
|
+
"version": "2024.09.02",
|
|
4
4
|
"description": "Create High Level Multi-Language Web Site [Fast and Easy] ",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"eval": "^0.1.8",
|
|
43
43
|
"formidable": "^2.0.1",
|
|
44
44
|
"md5": "^2.3.0",
|
|
45
|
-
"mongodb": "^6.
|
|
45
|
+
"mongodb": "^6.10.0",
|
|
46
46
|
"mv": "^2.1.1",
|
|
47
47
|
"node-fetch": "^3.3.2",
|
|
48
48
|
"node-telegram-bot-api": "^0.66.0",
|