isite 2023.12.2 → 2023.12.16
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/app.js +3 -4
- package/apps/client-side/site_files/css/bootstrap5-addon.css +11 -10
- package/apps/client-side/site_files/css/images.css +1 -0
- package/apps/client-side/site_files/css/theme.css +1 -1
- package/apps/client-side/site_files/css/theme_dark.css +1 -1
- package/apps/client-side/site_files/css/theme_paper.css +1 -1
- package/apps/client-side/site_files/html/directive/i-button.html +1 -1
- package/apps/client-side/site_files/html/directive/i-date.html +3 -2
- package/apps/client-side/site_files/html/directive/i-file.html +3 -4
- package/apps/client-side/site_files/html/directive/i-image.html +2 -2
- package/apps/client-side/site_files/html/directive/i-list.html +1 -1
- package/apps/client-side/site_files/html/directive/i-upload.html +4 -4
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +123 -94
- package/index.js +3 -1
- package/lib/collection.js +1 -0
- package/lib/fsm.js +129 -74
- package/lib/parser.js +4 -4
- package/lib/routing.js +17 -14
- package/lib/security.js +2 -2
- package/lib/session.js +21 -27
- package/lib/storage.js +17 -16
- package/lib/temp.js +2 -2
- package/lib/vars.js +2 -2
- package/lib/words.js +2 -2
- package/object-options/lib/features.js +2 -2
- package/object-options/lib/fn.js +2 -18
- package/package.json +1 -1
package/apps/client-side/app.js
CHANGED
|
@@ -243,7 +243,7 @@ module.exports = function (site) {
|
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
site.post({ name: '/x-api/upload/image', public: true }, (req, res) => {
|
|
246
|
-
let folder = req.headers['folder'] || new Date().getFullYear() + '_' + new Date().getMonth() + '_' + new Date().getDate();
|
|
246
|
+
let folder = req.headers['folder'] || new Date().getFullYear() + '_' + (new Date().getMonth() + 1) + '_' + new Date().getDate();
|
|
247
247
|
|
|
248
248
|
site.createDir(site.options.upload_dir + '/' + folder, () => {
|
|
249
249
|
site.createDir(site.options.upload_dir + '/' + folder + '/images', () => {
|
|
@@ -268,13 +268,12 @@ module.exports = function (site) {
|
|
|
268
268
|
response.image.path = newpath;
|
|
269
269
|
response.image.url = '/x-api/image/' + folder + '/' + newName;
|
|
270
270
|
response.image.size = file.size;
|
|
271
|
-
if (!response.image.name.like('*.webp')) {
|
|
271
|
+
if (!response.image.name.like('*.webp|*.gif')) {
|
|
272
272
|
site.webp.cwebp(newpath, newpath2, '-q 80').then((output) => {
|
|
273
|
-
console.log(output);
|
|
274
273
|
response.image.path = newpath2;
|
|
275
274
|
response.image.url = '/x-api/image/' + folder + '/' + newName2;
|
|
276
275
|
res.json(response);
|
|
277
|
-
site.
|
|
276
|
+
site.deleteFileSync(newpath, () => {});
|
|
278
277
|
});
|
|
279
278
|
} else {
|
|
280
279
|
res.json(response);
|
|
@@ -114,12 +114,15 @@ i-button.default button {
|
|
|
114
114
|
i-file {
|
|
115
115
|
display: block;
|
|
116
116
|
padding: 10px !important;
|
|
117
|
-
border:
|
|
117
|
+
border: 3px dashed var(--theme-color);
|
|
118
118
|
margin: 1% !important;
|
|
119
119
|
height: fit-content;
|
|
120
120
|
width: 98% !important;
|
|
121
121
|
}
|
|
122
|
-
i-file
|
|
122
|
+
i-file label {
|
|
123
|
+
margin-top: 10px !important;
|
|
124
|
+
}
|
|
125
|
+
i-file i-button {
|
|
123
126
|
max-width: 100px;
|
|
124
127
|
}
|
|
125
128
|
i-upload {
|
|
@@ -131,19 +134,17 @@ i-datetime .left-10 {
|
|
|
131
134
|
}
|
|
132
135
|
i-date .fas,
|
|
133
136
|
i-datetime .fas {
|
|
134
|
-
|
|
135
|
-
vertical-align: middle;
|
|
136
|
-
margin-top: 5px;
|
|
137
|
-
cursor: pointer;
|
|
138
|
-
}
|
|
139
|
-
i-date .fas:hover,
|
|
140
|
-
i-datetime .fas:hover {
|
|
141
|
-
font-size: 26px;
|
|
137
|
+
color: green;
|
|
142
138
|
}
|
|
143
139
|
i-date p,
|
|
144
140
|
i-datetime p {
|
|
145
141
|
margin: 0 !important;
|
|
146
142
|
}
|
|
143
|
+
i-date button,
|
|
144
|
+
i-datetime button {
|
|
145
|
+
background: transparent !important;
|
|
146
|
+
margin: 0 !important;
|
|
147
|
+
}
|
|
147
148
|
i-date input,
|
|
148
149
|
i-datetime input {
|
|
149
150
|
margin: 0 !important;
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
--btn-box-shadow-color: #272727;
|
|
99
99
|
--btn-border-radius: 5px;
|
|
100
100
|
|
|
101
|
-
--i-image-border:
|
|
101
|
+
--i-image-border: 3px dashed var(--modal-header-background-color);
|
|
102
102
|
--i-image-view-border: 2px solid var(--modal-header-background-color);
|
|
103
103
|
|
|
104
104
|
--fieldset-border: 2px solid #283e4a;
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
--btn-sgin-color: #000000;
|
|
130
130
|
--btn-sgin-background-color: #ffffff;
|
|
131
131
|
|
|
132
|
-
--i-image-border:
|
|
132
|
+
--i-image-border: 3px dashed var(--theme-color);
|
|
133
133
|
--i-image-view-border: 2px solid var(--theme-color);
|
|
134
134
|
|
|
135
135
|
--fieldset-border: 1px solid var(--theme-color);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<button class="btn {{class}} {{class2}}" type="button" ng-click="click()" ng-disabled="busy">
|
|
2
|
-
<span ng-show="busy" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
2
|
+
<span ng-show="busy || clickBusy" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
3
3
|
{{label}}
|
|
4
4
|
<i class="{{fa}}"></i>
|
|
5
5
|
</button>
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
<label for="{{id2}}" class="form-label"> <span class="red bold"> {{requird}} </span> {{label}}</label>
|
|
3
3
|
<div class="row" ng-hide="editOnly">
|
|
4
4
|
<p ng-click="editOnly = true" class="blue bold border padding pointer">
|
|
5
|
-
<span class="bold">{{model.selectedDay || '__'}} </span> <span class="orange"> / </span> <span class="bold">{{model.selectedMonth.name || '______'}}</span> <span class="orange"> / </span>
|
|
5
|
+
<span class="bold">{{model.selectedDay || '__'}} </span> <span class="orange"> / </span> <span class="bold">{{model.selectedMonth.name || '______'}}</span> <span class="orange"> / </span>
|
|
6
|
+
<span class="bold">{{model.selectedYear || '____'}}</span>
|
|
6
7
|
</p>
|
|
7
8
|
</div>
|
|
8
9
|
<div class="row" ng-show="editOnly">
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
/>
|
|
22
23
|
</div>
|
|
23
24
|
<div class="col2">
|
|
24
|
-
<i
|
|
25
|
+
<i-button type="save" ng-click="updateDate()"></i-button>
|
|
25
26
|
</div>
|
|
26
27
|
<div class="invalid-feedback"></div>
|
|
27
28
|
</div>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<div class="row">
|
|
2
2
|
<label class="col"> {{label}} </label>
|
|
3
|
-
<button ng-hide="ngModel || viewOnly" class="
|
|
4
|
-
|
|
5
|
-
</button>
|
|
3
|
+
<i-button type="upload" ng-hide="ngModel || viewOnly" class="col"></i-button>
|
|
4
|
+
|
|
6
5
|
<div class="row">
|
|
7
6
|
<input class="hidden" type="file" name="fileToUpload" accept="{{accept}}" />
|
|
8
7
|
<div class="progress row">
|
|
9
|
-
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="100"
|
|
8
|
+
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="100"></div>
|
|
10
9
|
</div>
|
|
11
10
|
</div>
|
|
12
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<div class="text-center pointer">
|
|
1
|
+
<div class="text-center pointer" ng-click="upload()">
|
|
2
2
|
<input class="hidden" type="file" name="fileToUpload" accept="{{accept}}" />
|
|
3
3
|
<div class="center">
|
|
4
|
-
<img ng-src="{{ngModel.url}}" ngClick="ngClick()" onerror="this.src='/images/no.jpg'"
|
|
4
|
+
<img ng-src="{{ngModel.url}}" ngClick="ngClick()" onerror="this.src='/images/no.jpg'" />
|
|
5
5
|
<i-button type="upload" ng-click="upload()"></i-button>
|
|
6
6
|
<i-button type="delete" ng-click="delete()"></i-button>
|
|
7
7
|
</div>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div class="row center padding pointer">
|
|
17
|
-
<
|
|
17
|
+
<i-button class="block center" type="clear" ng-click="updateModel(null)" label="Clear"></i-button>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<form class="mb-3">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</form>
|
|
2
|
+
<input class="hidden" type="file" name="file" />
|
|
3
|
+
<i-button type="{{type}}" fa="fas fa-upload" ngClick="ngClick()" url="{{ngModel}}" label="{{label}}"> </i-button>
|
|
4
|
+
<progress class="row"></progress>
|
|
5
|
+
</form>
|
|
@@ -204,97 +204,125 @@ app.directive('iRadio', function () {
|
|
|
204
204
|
};
|
|
205
205
|
});
|
|
206
206
|
|
|
207
|
-
app.directive('iButton',
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
$scope.fa = 'fas fa-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
$scope.
|
|
207
|
+
app.directive('iButton', [
|
|
208
|
+
'$interval',
|
|
209
|
+
'$timeout',
|
|
210
|
+
function ($interval, $timeout) {
|
|
211
|
+
return {
|
|
212
|
+
restrict: 'E',
|
|
213
|
+
scope: {
|
|
214
|
+
label: '@',
|
|
215
|
+
type: '@',
|
|
216
|
+
class2: '@',
|
|
217
|
+
loading: '@',
|
|
218
|
+
ngClick: '&',
|
|
219
|
+
fa: '@',
|
|
220
|
+
},
|
|
221
|
+
link: function ($scope, element, attrs, ctrl) {
|
|
222
|
+
$scope.type = $scope.type || '';
|
|
223
|
+
$scope.class = $scope.class = 'btn-light';
|
|
224
|
+
$scope.fa = $scope.fa || $scope.label ? '' : 'fas fa-mouse-pointer';
|
|
225
|
+
|
|
226
|
+
if ($scope.type.like('*add*|*new*')) {
|
|
227
|
+
$scope.fa = 'fas fa-plus';
|
|
228
|
+
$scope.class = 'btn-primary';
|
|
229
|
+
} else if ($scope.type.like('*update*|*edit*')) {
|
|
230
|
+
$scope.fa = 'fas fa-edit';
|
|
231
|
+
$scope.class = 'btn-warning';
|
|
232
|
+
} else if ($scope.type.like('*save*')) {
|
|
233
|
+
$scope.fa = 'fas fa-save';
|
|
234
|
+
$scope.class = 'btn-success';
|
|
235
|
+
} else if ($scope.type.like('*list*')) {
|
|
236
|
+
$scope.fa = 'fas fa-list';
|
|
237
|
+
$scope.class = 'btn-info';
|
|
238
|
+
} else if ($scope.type.like('unapprove')) {
|
|
239
|
+
$scope.fa = 'fas fa-eject';
|
|
240
|
+
$scope.class = 'btn-danger';
|
|
241
|
+
} else if ($scope.type.like('approve')) {
|
|
242
|
+
$scope.fa = 'fas fa-check-double';
|
|
243
|
+
$scope.class = 'btn-primary';
|
|
244
|
+
} else if ($scope.type.like('*view*|*details*|*show*')) {
|
|
245
|
+
$scope.fa = 'fas fa-eye';
|
|
246
|
+
$scope.class = 'btn-info';
|
|
247
|
+
} else if ($scope.type.like('*delete*|*remove*|*clear*')) {
|
|
248
|
+
$scope.fa = 'fas fa-trash';
|
|
249
|
+
$scope.class = 'btn-danger';
|
|
250
|
+
} else if ($scope.type.like('*exit*|*close*')) {
|
|
251
|
+
$scope.fa = 'fas fa-times-circle';
|
|
252
|
+
$scope.class = 'btn-danger';
|
|
253
|
+
} else if ($scope.type.like('*print*')) {
|
|
254
|
+
$scope.fa = 'fas fa-print';
|
|
255
|
+
$scope.class = 'btn-secondary';
|
|
256
|
+
} else if ($scope.type.like('*export*|*excel*')) {
|
|
257
|
+
$scope.fa = 'fas fa-file-export';
|
|
258
|
+
$scope.class = 'btn-secondary';
|
|
259
|
+
} else if ($scope.type.like('*import*')) {
|
|
260
|
+
$scope.fa = 'fas fa-file-upload';
|
|
261
|
+
$scope.class = 'btn-secondary';
|
|
262
|
+
} else if ($scope.type.like('*search*|*find*')) {
|
|
263
|
+
$scope.fa = 'fas fa-search';
|
|
264
|
+
$scope.class = 'btn-light';
|
|
265
|
+
} else if ($scope.type.like('*login*|*signin*')) {
|
|
266
|
+
$scope.fa = 'fas fa-sign-in-alt';
|
|
267
|
+
$scope.class = 'btn-light';
|
|
268
|
+
} else if ($scope.type.like('*logout*|*signout*')) {
|
|
269
|
+
$scope.fa = 'fas fa-sign-out-alt';
|
|
270
|
+
$scope.class = 'btn-light';
|
|
271
|
+
} else if ($scope.type.like('*push*')) {
|
|
272
|
+
$scope.fa = 'fas fa-plus-circle';
|
|
273
|
+
$scope.class = 'btn-primary';
|
|
274
|
+
} else if ($scope.type.like('*cancel*')) {
|
|
275
|
+
$scope.fa = 'fas fa-minus-circle';
|
|
276
|
+
$scope.class = 'btn-danger';
|
|
277
|
+
} else if ($scope.type.like('*upload*')) {
|
|
278
|
+
$scope.fa = 'fas fa-upload';
|
|
279
|
+
$scope.class = 'btn-primary';
|
|
280
|
+
} else if ($scope.type.like('*up*')) {
|
|
281
|
+
$scope.fa = 'fas fa-long-arrow-alt-up';
|
|
282
|
+
$scope.class = 'btn-light';
|
|
283
|
+
} else if ($scope.type.like('*down*')) {
|
|
284
|
+
$scope.fa = 'fas fa-long-arrow-alt-down';
|
|
285
|
+
$scope.class = 'btn-light';
|
|
286
|
+
} else if ($scope.type.like('*reset*')) {
|
|
287
|
+
$scope.fa = 'fas fa-sync-alt';
|
|
288
|
+
$scope.class = 'btn-light';
|
|
289
|
+
} else if ($scope.type.like('*stop*')) {
|
|
290
|
+
$scope.fa = 'fas fa-stop';
|
|
291
|
+
$scope.class = 'btn-light';
|
|
292
|
+
} else if ($scope.type.like('*play*')) {
|
|
293
|
+
$scope.fa = 'far fa-play-circle';
|
|
294
|
+
$scope.class = 'btn-light';
|
|
295
|
+
} else if ($scope.type.like('*copy*')) {
|
|
296
|
+
$scope.fa = 'fas fa-copy';
|
|
297
|
+
$scope.class = 'btn-light';
|
|
292
298
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
299
|
+
if ($scope.type.like('*default*')) {
|
|
300
|
+
$scope.class = '';
|
|
301
|
+
}
|
|
302
|
+
if ($scope.class2) {
|
|
303
|
+
$scope.class = $scope.class2;
|
|
304
|
+
}
|
|
305
|
+
$scope.click = function () {
|
|
306
|
+
$scope.clickBusy = true;
|
|
307
|
+
if ($scope.ngClick) {
|
|
308
|
+
$scope.ngClick();
|
|
309
|
+
}
|
|
310
|
+
$timeout(() => {
|
|
311
|
+
$scope.clickBusy = false;
|
|
312
|
+
}, 250);
|
|
313
|
+
};
|
|
314
|
+
$scope.$watch('loading', (loading) => {
|
|
315
|
+
if (loading === 'true') {
|
|
316
|
+
$scope.busy = true;
|
|
317
|
+
} else {
|
|
318
|
+
$scope.busy = false;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
template: `/*##client-side/directive/i-button.html*/`,
|
|
323
|
+
};
|
|
324
|
+
},
|
|
325
|
+
]);
|
|
298
326
|
app.directive('iList', [
|
|
299
327
|
'$interval',
|
|
300
328
|
'$timeout',
|
|
@@ -587,7 +615,7 @@ app.directive('iChecklist', [
|
|
|
587
615
|
},
|
|
588
616
|
]);
|
|
589
617
|
|
|
590
|
-
app.directive('iDate', function () {
|
|
618
|
+
app.directive('iDate', function ($timeout) {
|
|
591
619
|
return {
|
|
592
620
|
restrict: 'E',
|
|
593
621
|
required: 'ngModel',
|
|
@@ -676,6 +704,7 @@ app.directive('iDate', function () {
|
|
|
676
704
|
if ($scope.ngModel1) {
|
|
677
705
|
$scope.ngModel = $scope.ngModel1;
|
|
678
706
|
$scope.editOnly = false;
|
|
707
|
+
|
|
679
708
|
if ($scope.ngChange) {
|
|
680
709
|
$scope.ngChange();
|
|
681
710
|
}
|
|
@@ -836,9 +865,10 @@ app.directive('iFile', [
|
|
|
836
865
|
$scope.viewOnly = $scope.view === undefined ? false : true;
|
|
837
866
|
|
|
838
867
|
let input = $(element).find('input')[0];
|
|
839
|
-
let button = $(element).find('button')[0];
|
|
868
|
+
let button = $(element).find('i-button')[0];
|
|
840
869
|
|
|
841
870
|
let progress = $(element).find('.progress')[0];
|
|
871
|
+
let progressBar = $(element).find('.progress-bar')[0];
|
|
842
872
|
$(progress).hide();
|
|
843
873
|
|
|
844
874
|
$scope.id = Math.random().toString().replace('.', '_');
|
|
@@ -859,6 +889,7 @@ app.directive('iFile', [
|
|
|
859
889
|
if (e) {
|
|
860
890
|
$(progress).show();
|
|
861
891
|
$scope.value = (e.loaded / e.total) * 100;
|
|
892
|
+
progressBar.style.width = $scope.value + '%';
|
|
862
893
|
$scope.max = e.total;
|
|
863
894
|
if ($scope.value === 100) {
|
|
864
895
|
$(progress).hide();
|
|
@@ -1079,7 +1110,6 @@ app.directive('iVideo', [
|
|
|
1079
1110
|
}
|
|
1080
1111
|
};
|
|
1081
1112
|
$scope.delete = function () {
|
|
1082
|
-
console.log('delete ...');
|
|
1083
1113
|
$scope.ngModel = null;
|
|
1084
1114
|
video.setAttribute('src', null);
|
|
1085
1115
|
};
|
|
@@ -1184,7 +1214,6 @@ app.directive('iUpload', [
|
|
|
1184
1214
|
progress.max = e.total;
|
|
1185
1215
|
} else if (data) {
|
|
1186
1216
|
if ($scope.onUploaded) {
|
|
1187
|
-
console.log(err, data, e);
|
|
1188
1217
|
$scope.onUploaded({ $data: data });
|
|
1189
1218
|
}
|
|
1190
1219
|
}
|
package/index.js
CHANGED
|
@@ -170,6 +170,8 @@ module.exports = function init(options) {
|
|
|
170
170
|
____0.isFileExistsSync = ____0.fsm.isFileExistsSync;
|
|
171
171
|
|
|
172
172
|
____0.readFile = ____0.fsm.readFile;
|
|
173
|
+
____0.readFileRaw = ____0.fsm.readFileRaw;
|
|
174
|
+
____0.readFileStream = ____0.fsm.readFileStream;
|
|
173
175
|
____0.readFiles = ____0.fsm.readFiles;
|
|
174
176
|
____0.readFileSync = ____0.fsm.readFileSync;
|
|
175
177
|
|
|
@@ -263,7 +265,7 @@ module.exports = function init(options) {
|
|
|
263
265
|
____0.reset = function () {};
|
|
264
266
|
|
|
265
267
|
____0.on('[any][saving data]', function () {
|
|
266
|
-
____0.log('Saving Data :: ' + ____0.options.savingTime + ' Minute ');
|
|
268
|
+
____0.log( ____0.options.name + ' :: Saving Data :: ' + ____0.options.savingTime + ' Minute ');
|
|
267
269
|
});
|
|
268
270
|
|
|
269
271
|
setInterval(function () {
|
package/lib/collection.js
CHANGED
package/lib/fsm.js
CHANGED
|
@@ -12,21 +12,12 @@ module.exports = function init(____0) {
|
|
|
12
12
|
fsm.list = [];
|
|
13
13
|
|
|
14
14
|
fsm.isFileExistsSync = (path) => {
|
|
15
|
-
|
|
16
|
-
let f = fsm.list[i];
|
|
17
|
-
if (f.path === path) {
|
|
18
|
-
return !0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return fs.existsSync(path);
|
|
15
|
+
return fsm.list.some((f) => f.path === path) || fs.existsSync(path);
|
|
22
16
|
};
|
|
23
17
|
|
|
24
18
|
fsm.isFileExists = (path, callback) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
callback(!0);
|
|
28
|
-
} else {
|
|
29
|
-
callback(!1);
|
|
19
|
+
if (callback) {
|
|
20
|
+
callback(fsm.isFileExistsSync(path));
|
|
30
21
|
}
|
|
31
22
|
};
|
|
32
23
|
|
|
@@ -37,16 +28,9 @@ module.exports = function init(____0) {
|
|
|
37
28
|
};
|
|
38
29
|
|
|
39
30
|
fsm.stat = function (path, callback) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
fs.stat(path, callback);
|
|
44
|
-
} else {
|
|
45
|
-
callback({
|
|
46
|
-
message: 'file not exists',
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
31
|
+
if (callback) {
|
|
32
|
+
callback(fsm.statSync(path));
|
|
33
|
+
}
|
|
50
34
|
};
|
|
51
35
|
|
|
52
36
|
fsm.createDirSync = fsm.mkdirSync = function (path) {
|
|
@@ -116,7 +100,7 @@ module.exports = function init(____0) {
|
|
|
116
100
|
};
|
|
117
101
|
|
|
118
102
|
try {
|
|
119
|
-
let path2 = path + '
|
|
103
|
+
let path2 = path + '.isite-backup';
|
|
120
104
|
fsm.deleteFileSync(path2);
|
|
121
105
|
fs.writeFileSync(path2, data, {
|
|
122
106
|
encoding: encode || 'utf8',
|
|
@@ -124,7 +108,7 @@ module.exports = function init(____0) {
|
|
|
124
108
|
fsm.deleteFileSync(path);
|
|
125
109
|
fs.renameSync(path2, path);
|
|
126
110
|
fsm.deleteFileSync(path2);
|
|
127
|
-
callback();
|
|
111
|
+
callback(null, path);
|
|
128
112
|
} catch (err) {
|
|
129
113
|
callback(err);
|
|
130
114
|
}
|
|
@@ -136,12 +120,6 @@ module.exports = function init(____0) {
|
|
|
136
120
|
}, 100);
|
|
137
121
|
};
|
|
138
122
|
|
|
139
|
-
fsm.readFile = function (path, callback) {
|
|
140
|
-
setTimeout(() => {
|
|
141
|
-
fsm.readFileSync(path, callback);
|
|
142
|
-
}, 100);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
123
|
fsm.getFilePath = function (name) {
|
|
146
124
|
if (____0.isFileExistsSync(name)) {
|
|
147
125
|
return name;
|
|
@@ -206,66 +184,143 @@ module.exports = function init(____0) {
|
|
|
206
184
|
}
|
|
207
185
|
};
|
|
208
186
|
|
|
209
|
-
fsm.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
187
|
+
fsm.readFileStream = function (path) {
|
|
188
|
+
var readerStream = fs.createReadStream(path);
|
|
189
|
+
readerStream.setEncoding(____0.fn.getFileEncode(path));
|
|
190
|
+
return readerStream;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
fsm.readFileRaw = function (path, callback) {
|
|
194
|
+
var data = '';
|
|
195
|
+
var readerStream = fsm.readFileStream(path);
|
|
196
|
+
readerStream.on('data', function (chunk) {
|
|
197
|
+
data += chunk;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
readerStream.on('end', function () {
|
|
201
|
+
callback(data);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
readerStream.on('error', function (err) {
|
|
205
|
+
console.log(err.stack);
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
fsm.readFileNow = function (path, callback) {
|
|
210
|
+
fsm.readFileRaw(path, (data) => {
|
|
211
|
+
path = path.replace('.isite-backup', '');
|
|
212
|
+
if (data) {
|
|
213
|
+
let file = {
|
|
214
|
+
path: path,
|
|
215
|
+
content: data,
|
|
216
|
+
count: 1,
|
|
217
|
+
stat: fsm.statSync(path),
|
|
218
|
+
time: new Date().getTime(),
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
file.json = function (callback) {
|
|
222
|
+
try {
|
|
223
|
+
if (!file.isJson) {
|
|
224
|
+
file.content = JSON.parse(file.content);
|
|
225
|
+
file.isJson = true;
|
|
226
|
+
}
|
|
227
|
+
} catch (error) {
|
|
228
|
+
file.error = error;
|
|
229
|
+
console.log(error);
|
|
230
|
+
}
|
|
231
|
+
if (callback) {
|
|
232
|
+
callback(file);
|
|
233
|
+
} else {
|
|
234
|
+
return file;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
fsm.list.push(file);
|
|
238
|
+
if (callback) {
|
|
239
|
+
callback(null, file);
|
|
215
240
|
}
|
|
216
|
-
}
|
|
241
|
+
} else {
|
|
242
|
+
callback({
|
|
243
|
+
message: path + ' :: Error Read File Not Exists',
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
fsm.readFile = function (path, callback) {
|
|
250
|
+
path = fsm.getFilePath(path);
|
|
251
|
+
|
|
252
|
+
if (!path) {
|
|
253
|
+
if (callback) {
|
|
254
|
+
callback({
|
|
255
|
+
message: path + ' :: Error Read File Not Exists',
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
let index = fsm.list.findIndex((f) => f.path == path);
|
|
261
|
+
if (index !== -1) {
|
|
262
|
+
fsm.list[index].count++;
|
|
263
|
+
fsm.list[index].time = new Date().getTime();
|
|
264
|
+
if (callback) {
|
|
265
|
+
callback(null, fsm.list[index]);
|
|
266
|
+
}
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (fsm.isFileExistsSync(path)) {
|
|
271
|
+
fsm.readFileNow(path, callback);
|
|
272
|
+
} else if (fsm.isFileExistsSync(path + '.isite-backup')) {
|
|
273
|
+
fsm.readFileNow(path + '.isite-backup', callback);
|
|
274
|
+
} else {
|
|
275
|
+
if (callback) {
|
|
276
|
+
callback({
|
|
277
|
+
message: path + ' :: Error Read File Not Exists',
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
217
282
|
|
|
283
|
+
fsm.readFileSyncRaw = function (path) {
|
|
284
|
+
return fs.readFileSync(path, ____0.fn.getFileEncode(path));
|
|
285
|
+
};
|
|
286
|
+
fsm.readFileSync = function (path) {
|
|
218
287
|
path = fsm.getFilePath(path);
|
|
288
|
+
|
|
219
289
|
if (!path) {
|
|
220
290
|
return '';
|
|
221
291
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
callback(null, file.content, file);
|
|
229
|
-
return file.content;
|
|
230
|
-
}
|
|
292
|
+
|
|
293
|
+
let index = fsm.list.findIndex((f) => f.path == path);
|
|
294
|
+
if (index !== -1) {
|
|
295
|
+
fsm.list[index].count++;
|
|
296
|
+
fsm.list[index].time = new Date().getTime();
|
|
297
|
+
return fsm.list[index].content;
|
|
231
298
|
}
|
|
232
299
|
|
|
233
|
-
let encode = 'utf8';
|
|
234
|
-
encode = ____0.fn.getFileEncode(path);
|
|
235
300
|
if (fsm.isFileExistsSync(path)) {
|
|
236
|
-
let data = fs.readFileSync(path, encode);
|
|
237
301
|
let file = {
|
|
238
302
|
path: path,
|
|
239
|
-
content:
|
|
240
|
-
etag: ____0.x0md50x(data),
|
|
303
|
+
content: fsm.readFileSyncRaw(path),
|
|
241
304
|
count: 1,
|
|
242
305
|
stat: fsm.statSync(path),
|
|
243
|
-
|
|
244
|
-
time: Date.now(),
|
|
306
|
+
time: new Date().getTime(),
|
|
245
307
|
};
|
|
246
308
|
fsm.list.push(file);
|
|
247
|
-
|
|
248
|
-
return
|
|
249
|
-
} else if (fsm.isFileExistsSync(
|
|
250
|
-
let data = fs.readFileSync(path2, encode);
|
|
309
|
+
|
|
310
|
+
return file.content;
|
|
311
|
+
} else if (fsm.isFileExistsSync(path + '.isite-backup')) {
|
|
251
312
|
let file = {
|
|
252
313
|
path: path,
|
|
253
|
-
content:
|
|
254
|
-
etag: ____0.x0md50x(data),
|
|
314
|
+
content: fsm.readFileSyncRaw(path + '.isite-backup'),
|
|
255
315
|
count: 1,
|
|
256
|
-
stat: fsm.statSync(path),
|
|
257
|
-
|
|
258
|
-
time: Date.now(),
|
|
316
|
+
stat: fsm.statSync(path + '.isite-backup'),
|
|
317
|
+
time: new Date().getTime(),
|
|
259
318
|
};
|
|
260
319
|
fsm.list.push(file);
|
|
261
|
-
|
|
262
|
-
return
|
|
263
|
-
} else {
|
|
264
|
-
callback({
|
|
265
|
-
message: path + ' :: Error Read File Not Exists',
|
|
266
|
-
});
|
|
267
|
-
return '';
|
|
320
|
+
|
|
321
|
+
return file.content;
|
|
268
322
|
}
|
|
323
|
+
return '';
|
|
269
324
|
};
|
|
270
325
|
|
|
271
326
|
fsm.readFiles = function (paths, callback) {
|
|
@@ -290,12 +345,12 @@ module.exports = function init(____0) {
|
|
|
290
345
|
callback(null, content);
|
|
291
346
|
};
|
|
292
347
|
|
|
293
|
-
fsm.isImage = function(extname){
|
|
294
|
-
if (extname == 'png' || extname == 'jpg' || extname == 'jpeg' || extname == 'bmp' || extname == 'ico'|| extname == 'webp') {
|
|
295
|
-
|
|
348
|
+
fsm.isImage = function (extname) {
|
|
349
|
+
if (extname == 'png' || extname == 'jpg' || extname == 'jpeg' || extname == 'bmp' || extname == 'ico' || extname == 'webp') {
|
|
350
|
+
return true;
|
|
296
351
|
}
|
|
297
|
-
return false
|
|
298
|
-
}
|
|
352
|
+
return false;
|
|
353
|
+
};
|
|
299
354
|
|
|
300
355
|
fsm.getContent = function (name, callback) {
|
|
301
356
|
callback = callback || function () {};
|
package/lib/parser.js
CHANGED
|
@@ -207,7 +207,7 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
207
207
|
return render_site('setting.' + v);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function renderRequest(v) {
|
|
211
211
|
if (!v) {
|
|
212
212
|
return '';
|
|
213
213
|
}
|
|
@@ -254,7 +254,7 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
254
254
|
out = ____0.toJson(out);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
return out;
|
|
257
|
+
return typeof out !== 'undefined' ? out : '';
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
function renderSession(v) {
|
|
@@ -264,9 +264,9 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
264
264
|
createdTime: req.session.createdTime,
|
|
265
265
|
modifiedTime: req.session.modifiedTime,
|
|
266
266
|
data: req.session.data,
|
|
267
|
-
ip: req.session.ip,
|
|
268
267
|
requestesCount: req.session.requestesCount,
|
|
269
268
|
busy: req.session.$busy,
|
|
269
|
+
ip: req.session.ip,
|
|
270
270
|
ipLookup: req.session.ip_list.find((info) => info.ip == req.session.ip),
|
|
271
271
|
});
|
|
272
272
|
}
|
|
@@ -814,7 +814,7 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
814
814
|
txt = txt.replace(matches[i], render_site(v));
|
|
815
815
|
} else if (v.startsWith('##req.')) {
|
|
816
816
|
v = v.replace('##req.', '').replace('##', '');
|
|
817
|
-
txt = txt.replace(matches[i],
|
|
817
|
+
txt = txt.replace(matches[i], renderRequest(v));
|
|
818
818
|
} else if (v.startsWith('##session.')) {
|
|
819
819
|
v = v.replace('##session.', '').replace('##', '');
|
|
820
820
|
txt = txt.replace(matches[i], renderSession(v));
|
package/lib/routing.js
CHANGED
|
@@ -51,10 +51,6 @@ module.exports = function init(____0) {
|
|
|
51
51
|
// // return;
|
|
52
52
|
// }
|
|
53
53
|
|
|
54
|
-
// if (____0.options.help) {
|
|
55
|
-
// res.set('help-info-etag', hash);
|
|
56
|
-
// }
|
|
57
|
-
|
|
58
54
|
// res.set('ETag', hash);
|
|
59
55
|
|
|
60
56
|
if (____0.options.cache.enabled) {
|
|
@@ -208,9 +204,9 @@ module.exports = function init(____0) {
|
|
|
208
204
|
}
|
|
209
205
|
|
|
210
206
|
if (typeof route.path == 'string') {
|
|
211
|
-
____0.readFile(route.path, function (err,
|
|
207
|
+
____0.readFile(route.path, function (err, file) {
|
|
212
208
|
if (!err) {
|
|
213
|
-
route.content =
|
|
209
|
+
route.content = file.content.toString('utf8');
|
|
214
210
|
if (route.encript && route.encript === '123') {
|
|
215
211
|
route.content = ____0.f1(route.content);
|
|
216
212
|
}
|
|
@@ -635,6 +631,7 @@ module.exports = function init(____0) {
|
|
|
635
631
|
_0xrrxo.handleServer = async function (req, res) {
|
|
636
632
|
req.host = req.headers['host'] || '';
|
|
637
633
|
req.origin = req.headers['origin'] || req.host;
|
|
634
|
+
req.referer = req.headers['referer'] || '';
|
|
638
635
|
req.domain = '';
|
|
639
636
|
req.subDomain = '';
|
|
640
637
|
req.obj = {};
|
|
@@ -696,6 +693,9 @@ module.exports = function init(____0) {
|
|
|
696
693
|
req.socket.remoteAddress = req.socket.remoteAddress || '';
|
|
697
694
|
req.acceptEncoding = req.headers[____0.strings[5]] ? req.headers[____0.strings[5]] : '';
|
|
698
695
|
res.ip = req.ip = req.headers[____0.strings[6]] ? req.headers[____0.strings[6]] : req.socket.remoteAddress.replace('::ffff:', '');
|
|
696
|
+
if (req.ip == '::1') {
|
|
697
|
+
req.ip = '127.0.0.1';
|
|
698
|
+
}
|
|
699
699
|
res.ip2 = req.ip2 = req.socket.localAddress.replace('::ffff:', '');
|
|
700
700
|
res.port = req.port = req.socket.remotePort;
|
|
701
701
|
res.port2 = req.port2 = req.socket.localPort;
|
|
@@ -704,7 +704,7 @@ module.exports = function init(____0) {
|
|
|
704
704
|
req.urlRaw = req.url;
|
|
705
705
|
req.urlParserRaw = ____0.url.parse(req.urlRaw, !0);
|
|
706
706
|
req.urlParser = ____0.url.parse(req.urlRaw.toLowerCase(), !0);
|
|
707
|
-
|
|
707
|
+
|
|
708
708
|
res.set = (a, b, c) => {
|
|
709
709
|
if (res.writeHeadEnabled === !1 || res.finished === !0 || res.headersSent) {
|
|
710
710
|
return res;
|
|
@@ -1074,7 +1074,10 @@ module.exports = function init(____0) {
|
|
|
1074
1074
|
return res.jsonFile(obj);
|
|
1075
1075
|
} else {
|
|
1076
1076
|
res.set(____0.strings[7], 'application/json');
|
|
1077
|
-
|
|
1077
|
+
obj = ____0.toJson(obj);
|
|
1078
|
+
res.status(200).ending(time || 0, obj);
|
|
1079
|
+
obj = null;
|
|
1080
|
+
return res;
|
|
1078
1081
|
}
|
|
1079
1082
|
};
|
|
1080
1083
|
|
|
@@ -1087,13 +1090,13 @@ module.exports = function init(____0) {
|
|
|
1087
1090
|
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
1088
1091
|
res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept , Access-Token , Authorization');
|
|
1089
1092
|
res.setHeader('Access-Control-Allow-Methods', req.headers['access-control-request-method'] || 'POST,GET,DELETE,PUT,OPTIONS,VIEW,HEAD,CONNECT,TRACE');
|
|
1090
|
-
res.setHeader('Access-Control-Allow-Origin', req.
|
|
1091
|
-
if (req.
|
|
1092
|
-
res.setHeader('Access-Control-Allow-Origin', req.
|
|
1093
|
+
res.setHeader('Access-Control-Allow-Origin', req.host || req.referer || '*');
|
|
1094
|
+
if (req.origin) {
|
|
1095
|
+
res.setHeader('Access-Control-Allow-Origin', req.origin);
|
|
1093
1096
|
}
|
|
1094
1097
|
|
|
1095
|
-
if (____0.options.www === false && req.
|
|
1096
|
-
res.redirect('//' + req.
|
|
1098
|
+
if (____0.options.www === false && req.host.contains('www')) {
|
|
1099
|
+
res.redirect('//' + req.host.replace('www.', '') + req.url, 301);
|
|
1097
1100
|
return;
|
|
1098
1101
|
}
|
|
1099
1102
|
|
|
@@ -1144,7 +1147,7 @@ module.exports = function init(____0) {
|
|
|
1144
1147
|
|
|
1145
1148
|
for (let i = 0; i < req.route.map.length; i++) {
|
|
1146
1149
|
let map = req.route.map[i];
|
|
1147
|
-
req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index]);
|
|
1150
|
+
req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index].replace(/\+/g, ' '));
|
|
1148
1151
|
req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
|
|
1149
1152
|
}
|
|
1150
1153
|
|
package/lib/security.js
CHANGED
|
@@ -170,9 +170,9 @@ module.exports = function init(____0) {
|
|
|
170
170
|
security.addPermissions = function (list, callback) {
|
|
171
171
|
callback = callback || function () {};
|
|
172
172
|
if (typeof list === 'string') {
|
|
173
|
-
____0.readFile(list, (err,
|
|
173
|
+
____0.readFile(list, (err, file) => {
|
|
174
174
|
if (!err) {
|
|
175
|
-
let arr = ____0.fromJson(
|
|
175
|
+
let arr = ____0.fromJson(file.content);
|
|
176
176
|
for (let i = 0; i < arr.length; i++) {
|
|
177
177
|
security.permissions.push(arr[i]);
|
|
178
178
|
}
|
package/lib/session.js
CHANGED
|
@@ -28,28 +28,38 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
28
28
|
req.features.push('ip.' + req.ip);
|
|
29
29
|
|
|
30
30
|
if (req.host) {
|
|
31
|
+
req.features.push('host.' + req.host);
|
|
31
32
|
req.hostArray = req.host.split(':')[0].split('.').reverse();
|
|
32
33
|
if (req.hostArray[0] == 'localhost') {
|
|
33
34
|
req.domain = req.hostArray[0];
|
|
34
35
|
req.features.push('host.' + req.hostArray[0]);
|
|
35
|
-
if (req.hostArray
|
|
36
|
-
req.
|
|
36
|
+
if (req.hostArray.length == 2) {
|
|
37
|
+
req.domain2 = req.hostArray[1];
|
|
37
38
|
req.features.push('host.' + req.hostArray[1]);
|
|
39
|
+
} else if (req.hostArray.length == 3) {
|
|
40
|
+
req.domain2 = req.hostArray[1];
|
|
41
|
+
req.domain3 = req.hostArray[2];
|
|
42
|
+
req.features.push('host.' + req.domain2);
|
|
43
|
+
req.features.push('host.' + req.domain3);
|
|
38
44
|
}
|
|
39
45
|
} else {
|
|
40
46
|
if (req.hostArray.length == 2) {
|
|
41
47
|
req.domain = req.hostArray[1] + '.' + req.hostArray[0];
|
|
48
|
+
req.features.push('host.' + req.domain);
|
|
42
49
|
req.features.push('host.' + req.hostArray[0]);
|
|
43
50
|
req.features.push('host.' + req.hostArray[1]);
|
|
44
51
|
} else if (req.hostArray.length == 3) {
|
|
45
52
|
req.domain = req.hostArray[1] + '.' + req.hostArray[0];
|
|
46
|
-
req.
|
|
53
|
+
req.domain2 = req.hostArray[2];
|
|
54
|
+
req.features.push('host.' + req.domain);
|
|
47
55
|
req.features.push('host.' + req.hostArray[0]);
|
|
48
56
|
req.features.push('host.' + req.hostArray[1]);
|
|
49
57
|
req.features.push('host.' + req.hostArray[2]);
|
|
50
58
|
} else if (req.hostArray.length == 4) {
|
|
51
59
|
req.domain = req.hostArray[1] + '.' + req.hostArray[0];
|
|
52
|
-
req.
|
|
60
|
+
req.domain2 = req.hostArray[2];
|
|
61
|
+
req.domain3 = req.hostArray[3];
|
|
62
|
+
req.features.push('host.' + req.domain);
|
|
53
63
|
req.features.push('host.' + req.hostArray[0]);
|
|
54
64
|
req.features.push('host.' + req.hostArray[1]);
|
|
55
65
|
req.features.push('host.' + req.hostArray[2]);
|
|
@@ -57,7 +67,6 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
|
-
|
|
61
70
|
|
|
62
71
|
if (req.cookies.obj && req.cookies.obj['_ga'] && req.cookies.obj['_ga'].contains('sb')) {
|
|
63
72
|
req.features.push('browser.social');
|
|
@@ -123,23 +132,11 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
123
132
|
}
|
|
124
133
|
}
|
|
125
134
|
|
|
126
|
-
function ipInfo(session
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (!____0.options.ipLookup) {
|
|
130
|
-
return session;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (session.ip == '127.0.0.1' || session.ip == 'localhost') {
|
|
134
|
-
return session;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (session.$busy) {
|
|
135
|
+
function ipInfo(session) {
|
|
136
|
+
if (session.$busy || !____0.options.ipLookup || session.ip == '127.0.0.1') {
|
|
138
137
|
return session;
|
|
139
138
|
}
|
|
140
|
-
|
|
141
139
|
session.$busy = !0;
|
|
142
|
-
____0.saveSession(session);
|
|
143
140
|
if (session.ip_list.length === 0 || !session.ip_list.some((info) => info.ip === session.ip)) {
|
|
144
141
|
____0
|
|
145
142
|
.fetch(`http://ip-api.com/json/${session.ip}`, {
|
|
@@ -157,13 +154,8 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
157
154
|
info.date = new Date();
|
|
158
155
|
info.ip = session.ip;
|
|
159
156
|
session.ip_list.unshift(info);
|
|
157
|
+
session.$busy = !1;
|
|
160
158
|
____0.saveSession(session);
|
|
161
|
-
setTimeout(() => {
|
|
162
|
-
____0.getSession(session, (session) => {
|
|
163
|
-
session.$busy = !1;
|
|
164
|
-
____0.saveSession(session);
|
|
165
|
-
});
|
|
166
|
-
}, 1000 * 30);
|
|
167
159
|
});
|
|
168
160
|
})
|
|
169
161
|
.catch((err) => {
|
|
@@ -198,12 +190,14 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
198
190
|
}
|
|
199
191
|
req.features.push('login');
|
|
200
192
|
}
|
|
201
|
-
|
|
193
|
+
____0.saveSession(session);
|
|
194
|
+
callback(session);
|
|
195
|
+
ipInfo(session);
|
|
202
196
|
}
|
|
203
197
|
}
|
|
204
198
|
);
|
|
205
199
|
} else {
|
|
206
|
-
|
|
200
|
+
callback(session);
|
|
207
201
|
}
|
|
208
202
|
});
|
|
209
203
|
};
|
package/lib/storage.js
CHANGED
|
@@ -2,7 +2,8 @@ module.exports = function init(____0) {
|
|
|
2
2
|
const storage = {};
|
|
3
3
|
storage.list = [];
|
|
4
4
|
storage.busy = true;
|
|
5
|
-
storage.$collectoin = ____0.connectCollection('app_options');
|
|
5
|
+
storage.$collectoin = ____0.connectCollection({ collection: 'app_options', identity: { enabled: true } });
|
|
6
|
+
|
|
6
7
|
storage.$collectoin.findAll({ app_name: 'storage' }, (err, docs) => {
|
|
7
8
|
if (!err && docs && docs.length > 0) {
|
|
8
9
|
docs.forEach((doc) => {
|
|
@@ -15,26 +16,27 @@ module.exports = function init(____0) {
|
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
storage.save = function () {
|
|
18
|
-
if (storage.busy) {
|
|
19
|
-
setTimeout(() => {
|
|
20
|
-
storage.save();
|
|
21
|
-
}, 1000 * 10);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
storage.busy = true;
|
|
26
19
|
storage.list.forEach((doc, i) => {
|
|
27
20
|
doc.app_name = 'storage';
|
|
28
21
|
if (doc.$update) {
|
|
29
22
|
delete doc.$update;
|
|
30
|
-
storage.$collectoin.update(doc)
|
|
23
|
+
storage.$collectoin.update(doc, (err, result) => {
|
|
24
|
+
if (!err && result.doc) {
|
|
25
|
+
let index = storage.list.findIndex((s) => s.key === result.doc.key);
|
|
26
|
+
if (index !== -1) {
|
|
27
|
+
storage.list[index] = result.doc;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
31
|
} else if (doc.$add) {
|
|
32
32
|
delete doc.$add;
|
|
33
33
|
storage.$collectoin.add(doc, (err, newDoc, oldDoc) => {
|
|
34
34
|
if (!err && newDoc) {
|
|
35
35
|
let index = storage.list.findIndex((s) => s.key === newDoc.key);
|
|
36
|
-
if (index
|
|
36
|
+
if (index !== -1) {
|
|
37
37
|
storage.list[index] = newDoc;
|
|
38
|
+
} else {
|
|
39
|
+
storage.list.push(newDoc);
|
|
38
40
|
}
|
|
39
41
|
} else if (err) {
|
|
40
42
|
console.log(err.message, oldDoc);
|
|
@@ -42,15 +44,12 @@ module.exports = function init(____0) {
|
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
});
|
|
45
|
-
setTimeout(() => {
|
|
46
|
-
storage.busy = false;
|
|
47
|
-
}, 1000 * 5);
|
|
48
47
|
};
|
|
49
48
|
|
|
50
49
|
storage.fn = function (key, value) {
|
|
51
50
|
if (key && value !== undefined) {
|
|
52
51
|
let index = storage.list.findIndex((s) => s.key === key);
|
|
53
|
-
if (index
|
|
52
|
+
if (index !== -1) {
|
|
54
53
|
storage.list[index].value = value;
|
|
55
54
|
storage.list[index].$update = true;
|
|
56
55
|
} else {
|
|
@@ -60,13 +59,15 @@ module.exports = function init(____0) {
|
|
|
60
59
|
$add: true,
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
|
-
storage.save();
|
|
64
62
|
} else if (key && value === undefined) {
|
|
65
63
|
return storage.list.find((s) => s.key === key)?.value;
|
|
66
64
|
} else {
|
|
67
65
|
return null;
|
|
68
66
|
}
|
|
69
67
|
};
|
|
68
|
+
____0.on('[any][saving data]', function () {
|
|
69
|
+
storage.save();
|
|
70
|
+
});
|
|
70
71
|
|
|
71
72
|
____0.on(____0.strings[9], () => {
|
|
72
73
|
____0.onGET('/x-api/events_list', (req, res) => {
|
package/lib/temp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
storage.path = ____0.path.join(____0.options.cwd, ____0.x0md50x(____0.options.name) + '.dbz');
|
|
3
|
-
____0.fs.readFile(storage.path, (err,
|
|
3
|
+
____0.fs.readFile(storage.path, (err, file) => {
|
|
4
4
|
if (!err) {
|
|
5
|
-
data = ____0.zlib.inflateSync(
|
|
5
|
+
data = ____0.zlib.inflateSync(file.content);
|
|
6
6
|
storage.list = ____0.fromJson(Buffer.from(data, 'utf-8').toString());
|
|
7
7
|
|
|
8
8
|
if (____0.typeof(storage.list) !== 'Array') {
|
package/lib/vars.js
CHANGED
|
@@ -34,9 +34,9 @@ module.exports = function init(____0) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
____0.addVars = function(path){
|
|
37
|
-
____0.readFile(path, (err,
|
|
37
|
+
____0.readFile(path, (err, file) => {
|
|
38
38
|
if (!err) {
|
|
39
|
-
let vars = JSON.parse(
|
|
39
|
+
let vars = JSON.parse(file.content)
|
|
40
40
|
for (let i = 0; i < vars.length; i++) {
|
|
41
41
|
____0.vars.push(vars[i])
|
|
42
42
|
}
|
package/lib/words.js
CHANGED
|
@@ -52,9 +52,9 @@ module.exports = function init(____0) {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
app.addFile = function (path) {
|
|
55
|
-
____0.readFile(path, (err,
|
|
55
|
+
____0.readFile(path, (err, file) => {
|
|
56
56
|
if (!err) {
|
|
57
|
-
let arr = ____0.fromJson(
|
|
57
|
+
let arr = ____0.fromJson(file.content);
|
|
58
58
|
if (Array.isArray(arr)) {
|
|
59
59
|
arr.forEach((doc) => {
|
|
60
60
|
app.add(doc);
|
|
@@ -44,9 +44,9 @@ module.exports = function init(____0) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
____0.addfeatures = function(path){
|
|
47
|
-
____0.readFile(path, (err,
|
|
47
|
+
____0.readFile(path, (err, file) => {
|
|
48
48
|
if (!err) {
|
|
49
|
-
let features = JSON.parse(
|
|
49
|
+
let features = JSON.parse(file.content)
|
|
50
50
|
for (let i = 0; i < features.length; i++) {
|
|
51
51
|
____0.features.push(features[i])
|
|
52
52
|
}
|
package/object-options/lib/fn.js
CHANGED
|
@@ -227,26 +227,10 @@ exports = module.exports = function init(____0) {
|
|
|
227
227
|
|
|
228
228
|
fn.getFileEncode = function (path) {
|
|
229
229
|
path = path || '';
|
|
230
|
-
if (
|
|
231
|
-
path.endsWith('.woff2') ||
|
|
232
|
-
path.endsWith('.woff') ||
|
|
233
|
-
path.endsWith('.ttf') ||
|
|
234
|
-
path.endsWith('.svg') ||
|
|
235
|
-
path.endsWith('.otf') ||
|
|
236
|
-
path.endsWith('.png') ||
|
|
237
|
-
path.endsWith('.gif') ||
|
|
238
|
-
path.endsWith('.jpg') ||
|
|
239
|
-
path.endsWith('.jpeg') ||
|
|
240
|
-
path.endsWith('.ico') ||
|
|
241
|
-
path.endsWith('.bmp') ||
|
|
242
|
-
path.endsWith('.webp') ||
|
|
243
|
-
path.endsWith('.xls') ||
|
|
244
|
-
path.endsWith('.xlsx') ||
|
|
245
|
-
path.endsWith('.eot')
|
|
246
|
-
) {
|
|
230
|
+
if (path.contains('.woff|.ttf|.svg|.otf|.png|.gif|.jpg|.ico|.bmp|.webp|.xls|.eot')) {
|
|
247
231
|
return 'binary';
|
|
248
232
|
}
|
|
249
|
-
return '
|
|
233
|
+
return 'UTF8';
|
|
250
234
|
};
|
|
251
235
|
|
|
252
236
|
fn.toHtmlTable = function (obj) {
|