isite 2023.12.15 → 2023.12.17
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 +2 -2
- 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 +120 -103
- package/lib/fsm.js +56 -38
- package/lib/parser.js +3 -3
- 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
|
-
<button class="btn {{class}} {{class2}}" type="button" ng-click="
|
|
2
|
-
<span ng-show="busy" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
1
|
+
<button class="btn {{class}} {{class2}}" type="button" ng-click="onclick()" ng-disabled="busy">
|
|
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,106 +204,122 @@ 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
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
$scope.busy = true;
|
|
299
|
-
} else {
|
|
300
|
-
$scope.busy = false;
|
|
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
|
+
click: '&',
|
|
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-light';
|
|
259
|
+
} else if ($scope.type.like('*import*')) {
|
|
260
|
+
$scope.fa = 'fas fa-file-upload';
|
|
261
|
+
$scope.class = 'btn-light';
|
|
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-light';
|
|
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';
|
|
301
298
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
299
|
+
if ($scope.type.like('*default*')) {
|
|
300
|
+
$scope.class = '';
|
|
301
|
+
}
|
|
302
|
+
if ($scope.class2) {
|
|
303
|
+
$scope.class = $scope.class2;
|
|
304
|
+
}
|
|
305
|
+
$scope.onclick = function () {
|
|
306
|
+
$scope.clickBusy = true;
|
|
307
|
+
$timeout(() => {
|
|
308
|
+
$scope.clickBusy = false;
|
|
309
|
+
}, 250);
|
|
310
|
+
};
|
|
311
|
+
$scope.$watch('loading', (loading) => {
|
|
312
|
+
if (loading === 'true') {
|
|
313
|
+
$scope.busy = true;
|
|
314
|
+
} else {
|
|
315
|
+
$scope.busy = false;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
template: `/*##client-side/directive/i-button.html*/`,
|
|
320
|
+
};
|
|
321
|
+
},
|
|
322
|
+
]);
|
|
307
323
|
app.directive('iList', [
|
|
308
324
|
'$interval',
|
|
309
325
|
'$timeout',
|
|
@@ -596,7 +612,7 @@ app.directive('iChecklist', [
|
|
|
596
612
|
},
|
|
597
613
|
]);
|
|
598
614
|
|
|
599
|
-
app.directive('iDate', function () {
|
|
615
|
+
app.directive('iDate', function ($timeout) {
|
|
600
616
|
return {
|
|
601
617
|
restrict: 'E',
|
|
602
618
|
required: 'ngModel',
|
|
@@ -685,6 +701,7 @@ app.directive('iDate', function () {
|
|
|
685
701
|
if ($scope.ngModel1) {
|
|
686
702
|
$scope.ngModel = $scope.ngModel1;
|
|
687
703
|
$scope.editOnly = false;
|
|
704
|
+
|
|
688
705
|
if ($scope.ngChange) {
|
|
689
706
|
$scope.ngChange();
|
|
690
707
|
}
|
|
@@ -845,9 +862,10 @@ app.directive('iFile', [
|
|
|
845
862
|
$scope.viewOnly = $scope.view === undefined ? false : true;
|
|
846
863
|
|
|
847
864
|
let input = $(element).find('input')[0];
|
|
848
|
-
let button = $(element).find('button')[0];
|
|
865
|
+
let button = $(element).find('i-button')[0];
|
|
849
866
|
|
|
850
867
|
let progress = $(element).find('.progress')[0];
|
|
868
|
+
let progressBar = $(element).find('.progress-bar')[0];
|
|
851
869
|
$(progress).hide();
|
|
852
870
|
|
|
853
871
|
$scope.id = Math.random().toString().replace('.', '_');
|
|
@@ -868,6 +886,7 @@ app.directive('iFile', [
|
|
|
868
886
|
if (e) {
|
|
869
887
|
$(progress).show();
|
|
870
888
|
$scope.value = (e.loaded / e.total) * 100;
|
|
889
|
+
progressBar.style.width = $scope.value + '%';
|
|
871
890
|
$scope.max = e.total;
|
|
872
891
|
if ($scope.value === 100) {
|
|
873
892
|
$(progress).hide();
|
|
@@ -1088,7 +1107,6 @@ app.directive('iVideo', [
|
|
|
1088
1107
|
}
|
|
1089
1108
|
};
|
|
1090
1109
|
$scope.delete = function () {
|
|
1091
|
-
console.log('delete ...');
|
|
1092
1110
|
$scope.ngModel = null;
|
|
1093
1111
|
video.setAttribute('src', null);
|
|
1094
1112
|
};
|
|
@@ -1193,7 +1211,6 @@ app.directive('iUpload', [
|
|
|
1193
1211
|
progress.max = e.total;
|
|
1194
1212
|
} else if (data) {
|
|
1195
1213
|
if ($scope.onUploaded) {
|
|
1196
|
-
console.log(err, data, e);
|
|
1197
1214
|
$scope.onUploaded({ $data: data });
|
|
1198
1215
|
}
|
|
1199
1216
|
}
|
package/lib/fsm.js
CHANGED
|
@@ -100,7 +100,7 @@ module.exports = function init(____0) {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
try {
|
|
103
|
-
let path2 = path + '
|
|
103
|
+
let path2 = path + '.isite-backup';
|
|
104
104
|
fsm.deleteFileSync(path2);
|
|
105
105
|
fs.writeFileSync(path2, data, {
|
|
106
106
|
encoding: encode || 'utf8',
|
|
@@ -108,7 +108,7 @@ module.exports = function init(____0) {
|
|
|
108
108
|
fsm.deleteFileSync(path);
|
|
109
109
|
fs.renameSync(path2, path);
|
|
110
110
|
fsm.deleteFileSync(path2);
|
|
111
|
-
callback();
|
|
111
|
+
callback(null, path);
|
|
112
112
|
} catch (err) {
|
|
113
113
|
callback(err);
|
|
114
114
|
}
|
|
@@ -206,6 +206,46 @@ module.exports = function init(____0) {
|
|
|
206
206
|
});
|
|
207
207
|
};
|
|
208
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);
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
callback({
|
|
243
|
+
message: path + ' :: Error Read File Not Exists',
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
|
|
209
249
|
fsm.readFile = function (path, callback) {
|
|
210
250
|
path = fsm.getFilePath(path);
|
|
211
251
|
|
|
@@ -228,42 +268,9 @@ module.exports = function init(____0) {
|
|
|
228
268
|
}
|
|
229
269
|
|
|
230
270
|
if (fsm.isFileExistsSync(path)) {
|
|
231
|
-
fsm.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
path: path,
|
|
235
|
-
content: data,
|
|
236
|
-
count: 1,
|
|
237
|
-
stat: fsm.statSync(path),
|
|
238
|
-
time: new Date().getTime(),
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
file.json = function (callback) {
|
|
242
|
-
try {
|
|
243
|
-
if (!file.isJson) {
|
|
244
|
-
file.content = JSON.parse(file.content);
|
|
245
|
-
file.isJson = true;
|
|
246
|
-
}
|
|
247
|
-
} catch (error) {
|
|
248
|
-
file.error = error;
|
|
249
|
-
console.log(error);
|
|
250
|
-
}
|
|
251
|
-
if (callback) {
|
|
252
|
-
callback(file);
|
|
253
|
-
} else {
|
|
254
|
-
return file;
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
fsm.list.push(file);
|
|
258
|
-
if (callback) {
|
|
259
|
-
callback(null, file);
|
|
260
|
-
}
|
|
261
|
-
} else {
|
|
262
|
-
callback({
|
|
263
|
-
message: path + ' :: Error Read File Not Exists',
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
});
|
|
271
|
+
fsm.readFileNow(path, callback);
|
|
272
|
+
} else if (fsm.isFileExistsSync(path + '.isite-backup')) {
|
|
273
|
+
fsm.readFileNow(path + '.isite-backup', callback);
|
|
267
274
|
} else {
|
|
268
275
|
if (callback) {
|
|
269
276
|
callback({
|
|
@@ -300,6 +307,17 @@ module.exports = function init(____0) {
|
|
|
300
307
|
};
|
|
301
308
|
fsm.list.push(file);
|
|
302
309
|
|
|
310
|
+
return file.content;
|
|
311
|
+
} else if (fsm.isFileExistsSync(path + '.isite-backup')) {
|
|
312
|
+
let file = {
|
|
313
|
+
path: path,
|
|
314
|
+
content: fsm.readFileSyncRaw(path + '.isite-backup'),
|
|
315
|
+
count: 1,
|
|
316
|
+
stat: fsm.statSync(path + '.isite-backup'),
|
|
317
|
+
time: new Date().getTime(),
|
|
318
|
+
};
|
|
319
|
+
fsm.list.push(file);
|
|
320
|
+
|
|
303
321
|
return file.content;
|
|
304
322
|
}
|
|
305
323
|
return '';
|
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) {
|
|
@@ -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));
|