isite 2024.8.9 → 2024.8.10
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 +30 -6
- package/apps/client-side/site_files/css/dropdown.css +62 -60
- package/apps/client-side/site_files/html/directive/i-list.html +5 -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 +26 -11
- package/apps/client-side/site_files/js/directive-core.js +8 -8
- package/apps/client-side/site_files/js/directive.js +2 -2
- package/apps/client-side/site_files/js/site.js +2 -2
- package/index.js +2 -4
- package/lib/ws.js +93 -99
- package/package.json +1 -1
|
@@ -36,15 +36,22 @@ body {
|
|
|
36
36
|
.container {
|
|
37
37
|
max-width: 100%;
|
|
38
38
|
}
|
|
39
|
-
.ar .form-check .form-check-input
|
|
39
|
+
.ar .form-check .form-check-input,
|
|
40
|
+
.AR .form-check .form-check-input {
|
|
40
41
|
float: right;
|
|
41
42
|
margin-right: -1.5em;
|
|
42
43
|
}
|
|
44
|
+
.form-label {
|
|
45
|
+
margin-bottom: 0.5rem;
|
|
46
|
+
margin-left: 5px;
|
|
47
|
+
border-bottom: 1px solid #00000061;
|
|
48
|
+
}
|
|
43
49
|
label {
|
|
44
50
|
float: left;
|
|
45
51
|
color: var(--label-color);
|
|
46
52
|
}
|
|
47
|
-
.ar label
|
|
53
|
+
.ar label,
|
|
54
|
+
.AR label {
|
|
48
55
|
float: right;
|
|
49
56
|
}
|
|
50
57
|
fieldset {
|
|
@@ -67,7 +74,8 @@ fieldset legend {
|
|
|
67
74
|
width: auto;
|
|
68
75
|
padding: 5px;
|
|
69
76
|
}
|
|
70
|
-
.ar fieldset legend
|
|
77
|
+
.ar fieldset legend,
|
|
78
|
+
.AR fieldset legend {
|
|
71
79
|
float: right;
|
|
72
80
|
}
|
|
73
81
|
legend::after {
|
|
@@ -105,6 +113,7 @@ i-button button {
|
|
|
105
113
|
margin: 5px !important;
|
|
106
114
|
margin-top: 30px !important;
|
|
107
115
|
padding: 7px 9px !important;
|
|
116
|
+
max-height: 40px;
|
|
108
117
|
}
|
|
109
118
|
i-button.default button {
|
|
110
119
|
margin: 3px;
|
|
@@ -129,7 +138,7 @@ i-file i-button {
|
|
|
129
138
|
i-upload {
|
|
130
139
|
display: contents;
|
|
131
140
|
}
|
|
132
|
-
i-upload form{
|
|
141
|
+
i-upload form {
|
|
133
142
|
display: inline-block;
|
|
134
143
|
}
|
|
135
144
|
i-date .left-10,
|
|
@@ -181,7 +190,21 @@ i-datetime input {
|
|
|
181
190
|
width: 100%;
|
|
182
191
|
}
|
|
183
192
|
.dropdown-content {
|
|
184
|
-
|
|
193
|
+
display: none;
|
|
194
|
+
position: absolute;
|
|
195
|
+
top: 30px !important;
|
|
196
|
+
background-color: #ffffff;
|
|
197
|
+
width: 100%;
|
|
198
|
+
box-shadow: 0px 20px 16px 16px rgb(0 0 0);
|
|
199
|
+
z-index: 999;
|
|
200
|
+
max-height: 75vh;
|
|
201
|
+
min-height: 20%;
|
|
202
|
+
padding: 0px;
|
|
203
|
+
margin: 0;
|
|
204
|
+
scroll-behavior: auto;
|
|
205
|
+
overflow: auto;
|
|
206
|
+
border: 5px solid #6b6868;
|
|
207
|
+
transition: all 0.2s ease;
|
|
185
208
|
}
|
|
186
209
|
.v-tabs .nav-link {
|
|
187
210
|
color: #aaa !important;
|
|
@@ -213,7 +236,8 @@ i-datetime input {
|
|
|
213
236
|
transform: translateY(-50%);
|
|
214
237
|
opacity: 0;
|
|
215
238
|
}
|
|
216
|
-
.ar .v-tabs .nav-link::before
|
|
239
|
+
.ar .v-tabs .nav-link::before,
|
|
240
|
+
.AR .v-tabs .nav-link::before {
|
|
217
241
|
border-right: 10px solid #fff;
|
|
218
242
|
left: -10px;
|
|
219
243
|
}
|
|
@@ -1,87 +1,89 @@
|
|
|
1
1
|
/* The container <div> - needed to position the dropdown content */
|
|
2
2
|
.dropdown {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
width: 100%;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/* Dropdown Content (Hidden by Default) */
|
|
9
9
|
.dropdown-content {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
display: none;
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 40px;
|
|
13
|
+
background-color: #ffffff;
|
|
14
|
+
width: 100%;
|
|
15
|
+
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
|
16
|
+
z-index: 999;
|
|
17
|
+
max-height: 50vh;
|
|
18
|
+
padding: 0px;
|
|
19
|
+
scroll-behavior: auto;
|
|
20
|
+
overflow: auto;
|
|
21
|
+
border: 1px solid var(--theme-color);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.dropdown .dropdown-search{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
.dropdown .dropdown-search {
|
|
25
|
+
padding: 5px;
|
|
26
|
+
position: sticky;
|
|
27
|
+
top: 0;
|
|
28
|
+
background: #eee;
|
|
29
29
|
}
|
|
30
|
+
.dropdown .dropdown-search i-control {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
width: 85%;
|
|
33
|
+
}
|
|
34
|
+
.dropdown .dropdown-search i-button button {
|
|
35
|
+
margin-top: 10px !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
/* Links inside the dropdown */
|
|
31
39
|
.dropdown-content p {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
color: black;
|
|
41
|
+
background-color: #ffffff;
|
|
42
|
+
padding: 12px 16px;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
display: block;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
/* Change color of dropdown links on hover */
|
|
40
48
|
.dropdown-content .dropdown-item:hover {
|
|
41
|
-
|
|
42
|
-
color: #fff;
|
|
43
|
-
}
|
|
44
|
-
.dropdown-content .dropdown-item:hover p,
|
|
45
|
-
.dropdown-content .dropdown-item:hover small {
|
|
46
|
-
color: #fff;
|
|
49
|
+
background-color: #bbbbbb;
|
|
47
50
|
}
|
|
51
|
+
|
|
48
52
|
/* Show the dropdown menu on hover */
|
|
49
53
|
.dropdown:hover .dropdown-content {
|
|
50
|
-
|
|
54
|
+
display: block;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
.dropdown-text:hover > .dropdown-content {
|
|
54
|
-
display: block;
|
|
55
|
-
}
|
|
56
57
|
|
|
57
|
-
.dropdown-item {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
i-list .dropdown-item {
|
|
59
|
+
display: inline-block !important;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
background: var(--dropdown-background);
|
|
62
|
+
padding: 0px !important;
|
|
63
|
+
margin: 0px !important;
|
|
64
|
+
transition: all 0.1s ease;
|
|
65
|
+
border-bottom: 1px solid #ddd !important;
|
|
64
66
|
}
|
|
65
67
|
.dropdown-item p {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
color: var(--color);
|
|
69
|
+
font-size: 16px;
|
|
70
|
+
font-weight: bold;
|
|
71
|
+
background: transparent;
|
|
72
|
+
text-align: center;
|
|
73
|
+
padding: 0;
|
|
71
74
|
}
|
|
72
|
-
.ar .dropdown-item p
|
|
73
|
-
|
|
75
|
+
.ar .dropdown-item p,
|
|
76
|
+
.AR .dropdown-item p {
|
|
77
|
+
text-align: right;
|
|
74
78
|
}
|
|
75
|
-
.dropdown-item small {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
font-weight: bold;
|
|
82
|
-
padding-right: 9px;
|
|
83
|
-
padding-left: 9px;
|
|
79
|
+
.dropdown-item .small {
|
|
80
|
+
color: #000000;
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
text-align: center;
|
|
83
|
+
font-weight: bold;
|
|
84
|
+
padding: 0;
|
|
84
85
|
}
|
|
85
|
-
.ar .dropdown-item small
|
|
86
|
-
|
|
86
|
+
.ar .dropdown-item .small,
|
|
87
|
+
.AR .dropdown-item small {
|
|
88
|
+
text-align: right;
|
|
87
89
|
}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
<div class="dropdown i-list">
|
|
2
2
|
<div class="mb-3 {{class2}}">
|
|
3
3
|
<label class="form-label"> <span class="red bold"> {{requird}} </span> {{label}} </label>
|
|
4
|
-
<input
|
|
4
|
+
<input class="full-width text dropdown-text form-control {{css}}" ng-disabled="disabled" v="{{v}}" readonly ng-model="ngModel.$display" />
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div class="dropdown-content">
|
|
8
8
|
<div class="dropdown-search" ng-show="showSearch">
|
|
9
|
-
<
|
|
9
|
+
<i-control class="search" ng-model="_search"></i-control>
|
|
10
|
+
<i-button type="reset" ng-click="updateModel(null)"></i-button>
|
|
10
11
|
</div>
|
|
11
12
|
|
|
12
13
|
<div class="dropdown-item row" ng-repeat="item in items | filter:$filter" ng-click="updateModel(item)">
|
|
13
|
-
<p>{{getValue(item)}}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<div class="row center padding pointer">
|
|
17
|
-
<i-button class="block center" type="clear" ng-click="updateModel(null)" label="Clear"></i-button>
|
|
14
|
+
<p>{{getValue(item)}}</p>
|
|
15
|
+
<p class="small" ng-show="display2"> {{getValue2(item)}} </p>
|
|
18
16
|
</div>
|
|
19
17
|
</div>
|
|
20
18
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class="dropdown i-list">
|
|
2
2
|
<div class="control">
|
|
3
3
|
<label> {{label}} </label>
|
|
4
|
-
<input
|
|
4
|
+
<input class="full-width text dropdown-text {{css}}" ng-disabled="disabled" v="{{v}}" readonly ng-model="ngModel.$display" />
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div class="dropdown-content">
|
|
@@ -27,11 +27,6 @@ app.directive('iControl', function () {
|
|
|
27
27
|
attrs.disabled = '';
|
|
28
28
|
}
|
|
29
29
|
$scope.class2 = $scope.class2 || '';
|
|
30
|
-
$(element)
|
|
31
|
-
.find('input')
|
|
32
|
-
.focus(() => {
|
|
33
|
-
$('.i-list .dropdown-content').css('display', 'none');
|
|
34
|
-
});
|
|
35
30
|
},
|
|
36
31
|
template: `/*##client-side/directive/i-control.html*/`,
|
|
37
32
|
};
|
|
@@ -365,7 +360,7 @@ app.directive('iList', [
|
|
|
365
360
|
if ($scope.v.like('*r*')) {
|
|
366
361
|
$scope.requird = '*';
|
|
367
362
|
}
|
|
368
|
-
$scope.searchElement = $(element).find('.dropdown .search');
|
|
363
|
+
$scope.searchElement = $(element).find('.dropdown .search input');
|
|
369
364
|
$scope.popupElement = $(element).find('.dropdown .dropdown-content');
|
|
370
365
|
|
|
371
366
|
if (typeof attrs.disabled !== 'undefined') {
|
|
@@ -450,7 +445,12 @@ app.directive('iList', [
|
|
|
450
445
|
if (items) {
|
|
451
446
|
items.forEach((item) => {
|
|
452
447
|
if ($scope.display2) {
|
|
453
|
-
|
|
448
|
+
let val = $scope.getValue(item);
|
|
449
|
+
if (val) {
|
|
450
|
+
val = val + $scope.space;
|
|
451
|
+
}
|
|
452
|
+
val = val + $scope.getValue2(item);
|
|
453
|
+
item.$display = val;
|
|
454
454
|
} else {
|
|
455
455
|
item.$display = $scope.getValue(item);
|
|
456
456
|
}
|
|
@@ -462,7 +462,12 @@ app.directive('iList', [
|
|
|
462
462
|
if (isite.getValue(item, $scope.primary) == isite.getValue($scope.ngModel, $scope.primary)) {
|
|
463
463
|
$scope.ngModel = item;
|
|
464
464
|
if ($scope.display2) {
|
|
465
|
-
|
|
465
|
+
let val = $scope.getValue(item);
|
|
466
|
+
if (val) {
|
|
467
|
+
val = val + $scope.space;
|
|
468
|
+
}
|
|
469
|
+
val = val + $scope.getValue2(item);
|
|
470
|
+
item.$display = val;
|
|
466
471
|
} else {
|
|
467
472
|
item.$display = $scope.getValue(item);
|
|
468
473
|
}
|
|
@@ -480,9 +485,14 @@ app.directive('iList', [
|
|
|
480
485
|
|
|
481
486
|
if (ngModel) {
|
|
482
487
|
if ($scope.display2) {
|
|
483
|
-
|
|
488
|
+
let val = $scope.getNgModelValue(ngModel);
|
|
489
|
+
if (val) {
|
|
490
|
+
val = val + $scope.space;
|
|
491
|
+
}
|
|
492
|
+
val = val + $scope.getNgModelValue2(ngModel);
|
|
493
|
+
input.val(val);
|
|
484
494
|
} else {
|
|
485
|
-
input.val(
|
|
495
|
+
input.val($scope.getNgModelValue(ngModel));
|
|
486
496
|
}
|
|
487
497
|
}
|
|
488
498
|
});
|
|
@@ -501,7 +511,12 @@ app.directive('iList', [
|
|
|
501
511
|
if (item) {
|
|
502
512
|
$scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
|
|
503
513
|
if ($scope.display2) {
|
|
504
|
-
|
|
514
|
+
let val = $scope.getNgModelValue($scope.ngModel);
|
|
515
|
+
if (val) {
|
|
516
|
+
val = val + $scope.space;
|
|
517
|
+
}
|
|
518
|
+
val = val + $scope.getNgModelValue2($scope.ngModel);
|
|
519
|
+
input.val(val);
|
|
505
520
|
} else {
|
|
506
521
|
input.val($scope.getNgModelValue($scope.ngModel));
|
|
507
522
|
}
|
|
@@ -66,20 +66,20 @@ app.service('isite', [
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
let arr = property.split('.');
|
|
69
|
+
let value = null;
|
|
69
70
|
|
|
70
|
-
if (arr.length
|
|
71
|
-
|
|
71
|
+
if (arr.length > 0) {
|
|
72
|
+
value = obj[arr[0]];
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
if (arr.length
|
|
75
|
-
|
|
75
|
+
if (arr.length > 1 && value) {
|
|
76
|
+
value = value[arr[1]];
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return obj[arr[0]][arr[1]][arr[2]];
|
|
78
|
+
if (arr.length > 2 && value) {
|
|
79
|
+
value = value[arr[2]];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return
|
|
82
|
+
return value;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
this.uploadImage = function (files, options, callback) {
|
|
@@ -953,14 +953,14 @@ app.directive('iList', [
|
|
|
953
953
|
}
|
|
954
954
|
|
|
955
955
|
let input = $(element).find('input');
|
|
956
|
-
|
|
956
|
+
/*$(element).hover(
|
|
957
957
|
() => {
|
|
958
958
|
$scope.popupElement.css('display', 'block');
|
|
959
959
|
},
|
|
960
960
|
() => {
|
|
961
961
|
$scope.popupElement.css('display', 'none');
|
|
962
962
|
}
|
|
963
|
-
)
|
|
963
|
+
);*/
|
|
964
964
|
$scope.focus = function () {
|
|
965
965
|
$('.i-list .dropdown-content').css('display', 'none');
|
|
966
966
|
$scope.popupElement.css('display', 'block');
|
|
@@ -1117,7 +1117,7 @@
|
|
|
1117
1117
|
url: options,
|
|
1118
1118
|
};
|
|
1119
1119
|
}
|
|
1120
|
-
|
|
1120
|
+
let ws = new WebSocket(options.url);
|
|
1121
1121
|
let server = {
|
|
1122
1122
|
ws: ws,
|
|
1123
1123
|
options: options,
|
|
@@ -1178,7 +1178,7 @@
|
|
|
1178
1178
|
server.onMessage(JSON.parse(msg.data));
|
|
1179
1179
|
}
|
|
1180
1180
|
};
|
|
1181
|
-
|
|
1181
|
+
site.server = server;
|
|
1182
1182
|
callback(server);
|
|
1183
1183
|
} else {
|
|
1184
1184
|
console.error('WebSocket Not Supported');
|
package/index.js
CHANGED
|
@@ -81,7 +81,7 @@ module.exports = function init(options) {
|
|
|
81
81
|
});
|
|
82
82
|
};
|
|
83
83
|
____0.closing = false;
|
|
84
|
-
____0.close = function (wait =
|
|
84
|
+
____0.close = function (wait = 0) {
|
|
85
85
|
if (____0.closing) {
|
|
86
86
|
return false;
|
|
87
87
|
}
|
|
@@ -155,9 +155,7 @@ module.exports = function init(options) {
|
|
|
155
155
|
____0.close(1);
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
____0.close(1);
|
|
160
|
-
});
|
|
158
|
+
|
|
161
159
|
|
|
162
160
|
process.on('unhandledRejection', (reason, p) => {
|
|
163
161
|
console.error('Unhandled Rejection at :: ', p, 'reason :: ', reason);
|
package/lib/ws.js
CHANGED
|
@@ -3,6 +3,7 @@ module.exports = function init(____0) {
|
|
|
3
3
|
client: null,
|
|
4
4
|
server: null,
|
|
5
5
|
clientList: [],
|
|
6
|
+
supportedClientList: [],
|
|
6
7
|
routeList: [],
|
|
7
8
|
lib: require('ws'),
|
|
8
9
|
};
|
|
@@ -44,111 +45,102 @@ module.exports = function init(____0) {
|
|
|
44
45
|
____0.servers.forEach((server) => {
|
|
45
46
|
server.on('upgrade', function upgrade(request, socket, head) {
|
|
46
47
|
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
|
-
}
|
|
61
|
-
|
|
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));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
};
|
|
48
|
+
let index = ____0.ws.routeList.findIndex((route) => route.options.name == pathname);
|
|
49
|
+
if (index !== -1) {
|
|
50
|
+
____0.ws.server.handleUpgrade(request, socket, head, function done(ws) {
|
|
51
|
+
let ip = '0.0.0.0';
|
|
52
|
+
if (request.headers[____0.strings[6]]) {
|
|
53
|
+
ip = request.headers[____0.strings[6]].split(',')[0].trim();
|
|
54
|
+
} else if (request.connection.remoteAddress) {
|
|
55
|
+
ip = request.connection.remoteAddress.replace('::ffff:', '');
|
|
56
|
+
}
|
|
107
57
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
58
|
+
let client = {
|
|
59
|
+
uuid: ____0.guid(),
|
|
60
|
+
path: pathname,
|
|
61
|
+
ws: ws,
|
|
62
|
+
request: request,
|
|
63
|
+
socket: socket,
|
|
64
|
+
head: head,
|
|
65
|
+
ip: ip,
|
|
66
|
+
onMessage: function (data) {
|
|
67
|
+
if (data.type === ____0.f1('417886684558375447183756')) {
|
|
68
|
+
this.send({
|
|
69
|
+
type: ____0.f1('4658375242195691'),
|
|
70
|
+
content: {
|
|
71
|
+
uuid: client.uuid,
|
|
72
|
+
ip: client.ip,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
console.log('client.onMessage Not Implement ...', data);
|
|
77
|
+
},
|
|
78
|
+
onData: function (data) {
|
|
79
|
+
console.log('client.onData Not Implement ...', data);
|
|
80
|
+
},
|
|
81
|
+
onError: function (e) {
|
|
82
|
+
console.log('client.onError Not Implement ...', e);
|
|
83
|
+
},
|
|
84
|
+
send: function (message) {
|
|
85
|
+
if (!message) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (this.ws && this.ws.readyState === ____0.ws.lib.OPEN) {
|
|
89
|
+
if (typeof message === 'string') {
|
|
90
|
+
this.ws.send(
|
|
91
|
+
JSON.stringify({
|
|
92
|
+
type: 'text',
|
|
93
|
+
content: message,
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
} else {
|
|
97
|
+
message.type = message.type || 'text';
|
|
98
|
+
this.ws.send(JSON.stringify(message));
|
|
114
99
|
}
|
|
115
|
-
});
|
|
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')));
|
|
123
100
|
}
|
|
124
|
-
}
|
|
101
|
+
},
|
|
102
|
+
onClose: function () {},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
client.ws.on('close', () => {
|
|
106
|
+
console.log('Closing Client : ' + client.ip);
|
|
107
|
+
client.onMessage({ type: 'close' });
|
|
108
|
+
client.ws.terminate();
|
|
109
|
+
let index = ____0.ws.clientList.findIndex((_client) => _client.uuid == client.uuid);
|
|
110
|
+
if (index !== -1) {
|
|
111
|
+
____0.ws.clientList.splice(index, 1);
|
|
112
|
+
}
|
|
113
|
+
client.onClose();
|
|
114
|
+
});
|
|
125
115
|
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
ws.on('message', (data, isBinary) => {
|
|
117
|
+
if (isBinary) {
|
|
118
|
+
client.onData(data);
|
|
128
119
|
} else {
|
|
129
|
-
____0.
|
|
130
|
-
route.callback(client);
|
|
120
|
+
client.onMessage(____0.fromJson(Buffer.from(data).toString('utf8')));
|
|
131
121
|
}
|
|
132
|
-
client.onMessage({ type: 'connected' });
|
|
133
122
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
123
|
+
|
|
124
|
+
if (client.path == '/isite') {
|
|
125
|
+
____0.ws.routeList[index].callback(client);
|
|
126
|
+
} else {
|
|
127
|
+
____0.ws.clientList.push(client);
|
|
128
|
+
____0.ws.routeList[index].callback(client);
|
|
129
|
+
}
|
|
130
|
+
client.onMessage({ type: 'connected' });
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
137
133
|
socket.destroy();
|
|
138
134
|
}
|
|
139
135
|
});
|
|
140
136
|
});
|
|
141
137
|
});
|
|
142
138
|
|
|
143
|
-
____0.ws.supportedClientList = [];
|
|
144
139
|
____0.ws.onNewSupportedClient = function (client) {
|
|
145
140
|
console.log(`New Supported Client ( ${client.ip} ) / ${____0.ws.supportedClientList.length}`);
|
|
146
141
|
};
|
|
147
142
|
|
|
148
143
|
____0.onWS(____0.f1('2578577443393257'), (client) => {
|
|
149
|
-
____0.ws.supportedClientList.push(client);
|
|
150
|
-
____0.ws.onNewSupportedClient(client);
|
|
151
|
-
|
|
152
144
|
client.onMessage =
|
|
153
145
|
client.onMessage ||
|
|
154
146
|
function (message) {
|
|
@@ -161,12 +153,6 @@ module.exports = function init(____0) {
|
|
|
161
153
|
},
|
|
162
154
|
});
|
|
163
155
|
} 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
156
|
} else if (message.type === ____0.f1('457913754338866846719191')) {
|
|
171
157
|
client.options = message.content;
|
|
172
158
|
client.send({
|
|
@@ -180,12 +166,20 @@ module.exports = function init(____0) {
|
|
|
180
166
|
fn(____0, client);
|
|
181
167
|
}
|
|
182
168
|
};
|
|
169
|
+
client.onClose = function () {
|
|
170
|
+
let index2 = ____0.ws.supportedClientList.findIndex((_client) => _client.uuid == client.uuid);
|
|
171
|
+
if (index2 !== -1) {
|
|
172
|
+
____0.ws.supportedClientList.splice(index2, 1);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
____0.ws.supportedClientList.push(client);
|
|
176
|
+
____0.ws.onNewSupportedClient(client);
|
|
183
177
|
});
|
|
184
178
|
|
|
179
|
+
____0.ws.reconnectCount = 0;
|
|
185
180
|
____0.ws.wsSupport = function () {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
181
|
+
clearTimeout(____0.ws.timeoutId);
|
|
182
|
+
let client = {};
|
|
189
183
|
|
|
190
184
|
client.ws = new ____0.ws.lib(____0.f1('477926832573867445782764423931684678865443381765253823734579477442392168417886672578577443393257'));
|
|
191
185
|
client.sendMessage = function (message) {
|
|
@@ -194,10 +188,10 @@ module.exports = function init(____0) {
|
|
|
194
188
|
client.ws.on('open', function () {});
|
|
195
189
|
client.ws.on('ping', function () {});
|
|
196
190
|
client.ws.on('close', function (e) {
|
|
197
|
-
setTimeout(function () {
|
|
198
|
-
|
|
191
|
+
____0.ws.timeoutId = setTimeout(function () {
|
|
192
|
+
____0.ws.reconnectCount++;
|
|
199
193
|
____0.ws.wsSupport();
|
|
200
|
-
}, 1000 *
|
|
194
|
+
}, 1000 * 60 * ____0.ws.reconnectCount);
|
|
201
195
|
});
|
|
202
196
|
client.ws.on('error', function (err) {
|
|
203
197
|
client.ws.close();
|