isite 2024.8.23 → 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/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: null,
458
- sort: null,
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
@@ -20,6 +20,10 @@ module.exports = function init(____0) {
20
20
  return;
21
21
  }
22
22
 
23
+ if (req.route.encript == '123') {
24
+ req.content = ____0.f1(req.content);
25
+ }
26
+
23
27
  if (route.parser.like('*html*') && route.content && route.content.length > 0) {
24
28
  req.content = ____0.parser(req, res, ____0, route).html(route.content);
25
29
  } else if (route.parser == 'css' && route.content && route.content.length > 0) {
@@ -162,6 +166,7 @@ module.exports = function init(____0) {
162
166
  }
163
167
 
164
168
  let response = {
169
+ host: req.host,
165
170
  url: req.url,
166
171
  filePath: route.path,
167
172
  content: req.content,
@@ -170,7 +175,7 @@ module.exports = function init(____0) {
170
175
  code: res.code,
171
176
  };
172
177
 
173
- 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)) {
174
179
  ____0.sharedList.push(response);
175
180
  }
176
181
 
@@ -183,10 +188,11 @@ module.exports = function init(____0) {
183
188
 
184
189
  _0xrrxo.defaultCallback = function (req, res) {
185
190
  let route = req.route;
186
- if ((response = ____0.sharedList.find((s) => s.filePath == route.path && s.url == req.url))) {
191
+
192
+ if ((response = ____0.sharedList.find((s) => s.host == req.host && s.filePath == route.path && s.url == req.url))) {
187
193
  res.headers = response.headers;
188
194
  res.code = response.code;
189
- res.setHeader('x-shared', ____0.sharedList.length + ' - ' + ____0.options.port);
195
+ res.set('x-shared','-count=' + ____0.sharedList.length + ' -port=' + ____0.options.port + ' -host=' + req.host);
190
196
  return res.end(response.content, response.encode);
191
197
  }
192
198
 
@@ -263,9 +269,7 @@ module.exports = function init(____0) {
263
269
  }
264
270
 
265
271
  route.content = data.toString('utf8');
266
- if (route.encript && route.encript === '123') {
267
- route.content = ____0.f1(route.content);
268
- }
272
+
269
273
  res.status(200);
270
274
  route.path = route.path.join('&&');
271
275
  _0xrrxo.endResponse(req, res);
@@ -374,6 +378,7 @@ module.exports = function init(____0) {
374
378
  route.cache = !0;
375
379
  route.hide = !1;
376
380
  route.compress = !1;
381
+ route.encript = !1;
377
382
  route.shared = !1;
378
383
  route.content = null;
379
384
  route.headers = null;
@@ -403,8 +408,8 @@ module.exports = function init(____0) {
403
408
  route.overwrite = r.overwrite ?? !1;
404
409
  route.cache = r.cache ?? !0;
405
410
  route.hide = r.hide ?? !1;
406
- route.encript = r.encript;
407
411
  route.compress = r.compress ?? !1;
412
+ route.encript = r.encript ?? !1;
408
413
  route.shared = r.shared ?? !1;
409
414
  route.map = r.map || [];
410
415
  route.callback = callback || r.callback || _0xrrxo.defaultCallback;
@@ -923,10 +928,10 @@ module.exports = function init(____0) {
923
928
  filePath = file;
924
929
  }
925
930
 
926
- 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))) {
927
932
  res.headers = response.headers;
928
933
  res.code = response.code;
929
- res.setHeader('x-shared', ____0.sharedList.length + ' - ' + ____0.options.port);
934
+ res.set('x-shared','-count=' + ____0.sharedList.length + ' -port=' + ____0.options.port + ' -host=' + req.host);
930
935
  return res.end(response.content, response.encode);
931
936
  }
932
937
  ____0.fsm.getContent(filePath, (content) => {
@@ -941,16 +946,20 @@ module.exports = function init(____0) {
941
946
  req.content = content;
942
947
  req.data = { ...req.data, ..._data };
943
948
  req.route = { ...req.route, ...options };
949
+
950
+ if (req.route.encript == '123') {
951
+ req.content = ____0.f1(req.content);
952
+ }
953
+
944
954
  if (req.route.parser) {
945
955
  req.content = ____0.parser(req, res, ____0, req.route).html(req.content);
946
956
  }
947
957
 
948
- res.status(options.code || 200);
949
-
950
958
  if (req.route.compress) {
951
959
  req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
952
960
  }
953
961
 
962
+ res.status(options.code || 200);
954
963
  if (filePath.endsWith('.css')) {
955
964
  res.set(____0.strings[7], 'text/css');
956
965
  if (____0.options.cache.enabled && req.route.cache) {
@@ -1049,6 +1058,7 @@ module.exports = function init(____0) {
1049
1058
  }
1050
1059
 
1051
1060
  let response = {
1061
+ host: req.host,
1052
1062
  url: req.url,
1053
1063
  filePath: filePath,
1054
1064
  content: req.content,
@@ -1057,7 +1067,7 @@ module.exports = function init(____0) {
1057
1067
  code: res.code,
1058
1068
  };
1059
1069
 
1060
- 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)) {
1061
1071
  ____0.sharedList.push(response);
1062
1072
  }
1063
1073
 
@@ -1071,7 +1081,7 @@ module.exports = function init(____0) {
1071
1081
  return res.status(404).end();
1072
1082
  }
1073
1083
  req.route.content = content;
1074
- if (req.route.encript && req.route.encript === '123') {
1084
+ if (req.route.encript === '123') {
1075
1085
  req.route.content = ____0.f1(req.route.content);
1076
1086
  }
1077
1087
  req.data = { ...req.data, ..._data };
@@ -1088,7 +1098,7 @@ module.exports = function init(____0) {
1088
1098
  return res.status(404).end();
1089
1099
  }
1090
1100
  req.route.content = content;
1091
- if (req.route.encript && req.route.encript === '123') {
1101
+ if (req.route.encript === '123') {
1092
1102
  req.route.content = ____0.f1(req.route.content);
1093
1103
  }
1094
1104
  req.data = { ...req.data, ..._data };
@@ -1105,7 +1115,7 @@ module.exports = function init(____0) {
1105
1115
  return res.status(404).end();
1106
1116
  }
1107
1117
  req.route.content = content;
1108
- if (req.route.encript && req.route.encript === '123') {
1118
+ if (req.route.encript === '123') {
1109
1119
  req.route.content = ____0.f1(req.route.content);
1110
1120
  }
1111
1121
  req.data = { ...req.data, ..._data };
@@ -1122,7 +1132,7 @@ module.exports = function init(____0) {
1122
1132
  return res.status(404).end();
1123
1133
  }
1124
1134
  req.route.content = content;
1125
- if (req.route.encript && req.route.encript === '123') {
1135
+ if (req.route.encript === '123') {
1126
1136
  req.route.content = ____0.f1(req.route.content);
1127
1137
  }
1128
1138
  req.data = { ...req.data, ..._data };
@@ -1169,13 +1179,13 @@ module.exports = function init(____0) {
1169
1179
  res.status(code).end();
1170
1180
  };
1171
1181
 
1172
- res.setHeader('CharSet', 'UTF-8');
1173
- res.setHeader('Access-Control-Allow-Credentials', 'true');
1174
- res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept , Access-Token , Authorization');
1175
- res.setHeader('Access-Control-Allow-Methods', req.headers['access-control-request-method'] || 'POST,GET,DELETE,PUT,OPTIONS,VIEW,HEAD,CONNECT,TRACE');
1176
- res.setHeader('Access-Control-Allow-Origin', req.referer || '*');
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 || '*');
1177
1187
  if (req.origin) {
1178
- res.setHeader('Access-Control-Allow-Origin', req.origin);
1188
+ res.set('Access-Control-Allow-Origin', req.origin);
1179
1189
  }
1180
1190
 
1181
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: 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: 'email or password error ',
538
+ message: 'User Credential Not Correct ',
559
539
  });
560
540
  }
561
541
 
562
542
  ____0.call('security error', {
563
- message: 'email or password error',
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.sendToAll({ type: 'ping' });
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
- this.send({
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
- this.send({
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 (this.ws && this.ws.readyState === ____0.ws.lib.OPEN) {
117
+ if (client.ws && client.ws.readyState === ____0.ws.lib.OPEN) {
105
118
  if (typeof message === 'string') {
106
- this.ws.send(
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
- this.ws.send(JSON.stringify(message));
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
- client.onMessage(____0.fromJson(Buffer.from(data).toString('utf8')));
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
- this.send({
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
- this.send({
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.send({
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
- time: new Date().getTime(),
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.time) / 1000 > 60) {
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.time = new Date().getTime();
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.08.23",
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.8.0",
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",