isite 2023.1.6 → 2023.1.7

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.
@@ -262,6 +262,82 @@ module.exports = function (site) {
262
262
  res.download(site.options.upload_dir + '/' + req.params.category + '/images/' + req.params.name);
263
263
  });
264
264
 
265
+ site.post({ name: '/x-api/upload/audio', public: true }, (req, res) => {
266
+ site.createDir(site.options.upload_dir + '/' + req.headers['folder'], () => {
267
+ site.createDir(site.options.upload_dir + '/' + req.headers['folder'] + '/audios', () => {
268
+ let response = {
269
+ audio: {},
270
+ done: !0,
271
+ };
272
+ let file = req.files.fileToUpload;
273
+ if (file) {
274
+ let newName = 'audio_' + new Date().getTime().toString() + Math.random().toString() + site.path.extname(file.originalFilename);
275
+ let newpath = site.path.resolve(site.options.upload_dir + '/' + req.headers['folder'] + '/audios/' + newName);
276
+ site.mv(file.filepath, newpath, function (err) {
277
+ if (err) {
278
+ response.error = err;
279
+ response.done = !1;
280
+ } else {
281
+ response.audio.name = file.originalFilename;
282
+ response.audio.path = newpath;
283
+ response.audio.url = '/x-api/audio/' + req.headers['folder'] + '/' + newName;
284
+ response.audio.size = file.size;
285
+ }
286
+ res.json(response);
287
+ });
288
+ } else {
289
+ response.error = 'no file';
290
+ response.done = !1;
291
+ res.json(response);
292
+ }
293
+ });
294
+ });
295
+ });
296
+
297
+ site.get({ name: '/x-api/audio/:category/:name', public: true }, (req, res) => {
298
+ res.set('Cache-Control', 'public, max-age=2592000');
299
+ res.download(site.options.upload_dir + '/' + req.params.category + '/audios/' + req.params.name);
300
+ });
301
+
302
+
303
+ site.post({ name: '/x-api/upload/video', public: true }, (req, res) => {
304
+ site.createDir(site.options.upload_dir + '/' + req.headers['folder'], () => {
305
+ site.createDir(site.options.upload_dir + '/' + req.headers['folder'] + '/videos', () => {
306
+ let response = {
307
+ video: {},
308
+ done: !0,
309
+ };
310
+ let file = req.files.fileToUpload;
311
+ if (file) {
312
+ let newName = 'video_' + new Date().getTime().toString() + Math.random().toString() + site.path.extname(file.originalFilename);
313
+ let newpath = site.path.resolve(site.options.upload_dir + '/' + req.headers['folder'] + '/videos/' + newName);
314
+ site.mv(file.filepath, newpath, function (err) {
315
+ if (err) {
316
+ response.error = err;
317
+ response.done = !1;
318
+ } else {
319
+ response.video.name = file.originalFilename;
320
+ response.video.path = newpath;
321
+ response.video.url = '/x-api/video/' + req.headers['folder'] + '/' + newName;
322
+ response.video.size = file.size;
323
+ }
324
+ res.json(response);
325
+ });
326
+ } else {
327
+ response.error = 'no file';
328
+ response.done = !1;
329
+ res.json(response);
330
+ }
331
+ });
332
+ });
333
+ });
334
+
335
+ site.get({ name: '/x-api/video/:category/:name', public: true }, (req, res) => {
336
+ res.set('Cache-Control', 'public, max-age=2592000');
337
+ res.download(site.options.upload_dir + '/' + req.params.category + '/videos/' + req.params.name);
338
+ });
339
+
340
+
265
341
  site.post({ name: '/x-api/upload/file', public: true }, (req, res) => {
266
342
  site.createDir(site.options.upload_dir + '/' + req.headers['folder'], () => {
267
343
  site.createDir(site.options.upload_dir + '/' + req.headers['folder'] + '/files', () => {
@@ -62,10 +62,13 @@ fieldset legend {
62
62
  font-weight: var(--legend-font-weight);
63
63
  background: var(--fieldset-background);
64
64
  border: var(--legend-border);
65
- float: none;
65
+ float: left;
66
66
  width: auto;
67
67
  padding: 5px;
68
68
  }
69
+ .ar fieldset legend{
70
+ float: right;
71
+ }
69
72
  legend::after {
70
73
  content: ' : ';
71
74
  }
@@ -193,3 +196,25 @@ i-datetime.is-invalid .row {
193
196
  .v-tabs .nav-link.active::before {
194
197
  opacity: 1;
195
198
  }
199
+
200
+ i-audio {
201
+ background: #fff;
202
+ border: 1px solid #ddd;
203
+ display: block;
204
+ padding: 5px;
205
+ }
206
+ i-audio audio {
207
+ vertical-align: bottom;
208
+ }
209
+ i-video {
210
+ border: 1px solid #4caf50;
211
+ padding: 5px;
212
+ display: block;
213
+ }
214
+ i-audio .btn {
215
+ vertical-align: top;
216
+ }
217
+
218
+ i-video video {
219
+ max-height: 50vh;
220
+ }
File without changes
@@ -1,29 +1,49 @@
1
+
1
2
  .image {
2
3
  width: 400px;
3
4
  height: 300px;
4
5
  border-radius: 10px;
5
6
  }
6
- .logo {
7
- width: 48px !important;
8
- height: 48px !important;
9
- border-radius: 5px;
10
- }
11
7
 
12
8
  i-image {
13
9
  display: block;
14
10
  width: 90% !important;
15
11
  height: 90% !important;
16
12
  border: var(--i-image-border);
13
+ margin: 5px;
14
+ border-radius: 5px;
17
15
  }
16
+ i-image div{
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+ i-image button i{
21
+ width: 100%;
22
+ }
23
+ i-image.logo {
24
+ width: 48px !important;
25
+ height: 48px !important;
26
+ border-radius: 5px;
27
+ }
28
+ .logo img {
29
+ width: 44px !important;
30
+ height: 44px !important;
31
+ }
32
+
33
+
18
34
  i-image img {
19
- width: auto;
20
- min-height: 32px;
35
+ width: 100%;
36
+ height: 100%;
21
37
  object-fit: fill;
22
38
  background-size: contain;
23
39
  background-position: center;
24
40
  background-repeat: no-repeat;
25
41
  }
26
42
 
43
+ i-image i-button {
44
+ display: none;
45
+ }
46
+
27
47
  i-image.full img {
28
48
  width: 100% !important;
29
49
  height: auto !important;
@@ -94,12 +114,14 @@ i-image.img256 {
94
114
  padding: 3px !important;
95
115
  }
96
116
  i-image.img256 img {
97
- width: 245px !important;
98
- height: 245px !important;
99
- min-width: 245px !important;
100
- min-height: 245px !important;
117
+ width: 200px !important;
118
+ height: 200px !important;
119
+ min-width: 200px !important;
120
+ min-height: 200px !important;
121
+ }
122
+ i-image.img256 i-button {
123
+ display: inline-block;
101
124
  }
102
-
103
125
  i-image.hover img:hover {
104
126
  transform: scale(1.1);
105
127
  }
@@ -0,0 +1,14 @@
1
+ <div class="text-center pointer">
2
+ <input class="hidden" type="file" name="fileToUpload" accept="{{accept}}" />
3
+ <div class="center">
4
+ <audio controls>
5
+ Your browser does not support the audio element.
6
+ </audio>
7
+ <i-button type="upload" ng-click="upload()"></i-button>
8
+ <i-button type="delete" ng-click="delete()"></i-button>
9
+ </div>
10
+
11
+ <div class="progress row">
12
+ <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="100"></div>
13
+ </div>
14
+ </div>
@@ -1,5 +1,5 @@
1
1
  <div class="mb-3 {{class2}}">
2
- <label for="{{id2}}" class="form-label">{{label}}</label>
2
+ <label for="{{id2}}" class="form-label"> <span class="red bold"> {{requird}} </span> {{label}}</label>
3
3
  <input id="{{id2}}" ng-disabled="disabled" autofocus v="{{v}}" type="{{type}}" ng-model="ngModel" ng-change="ngChange()" ngKeydown="ngKeydown()" class="form-control" placeholder="{{placeholder}}" aria-label="{{label}}" />
4
4
  <div class="invalid-feedback"></div>
5
5
  </div>
@@ -1,7 +1,12 @@
1
1
  <div class="text-center pointer">
2
2
  <input class="hidden" type="file" name="fileToUpload" accept="{{accept}}" />
3
- <img class="rounded" ng-src="{{ngModel.url}}" ngClick="ngClick()" onerror="this.src='/images/no.jpg'" />
3
+ <div class="center">
4
+ <img ng-src="{{ngModel.url}}" ngClick="ngClick()" onerror="this.src='/images/no.jpg'" ng-click="upload()" />
5
+ <i-button type="upload" ng-click="upload()"></i-button>
6
+ <i-button type="delete" ng-click="delete()"></i-button>
7
+ </div>
8
+
4
9
  <div class="progress row">
5
- <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="100" style="width: {{value}}%"></div>
10
+ <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="100"></div>
6
11
  </div>
7
12
  </div>
@@ -1,6 +1,6 @@
1
1
  <div class="dropdown i-list">
2
2
  <div class="mb-3 {{class2}}">
3
- <label class="form-label"> {{label}} </label>
3
+ <label class="form-label"> <span class="red bold"> {{requird}} </span> {{label}} </label>
4
4
  <input ng-focus="focus()" class="full-width text dropdown-text form-control {{css}}" ng-disabled="disabled" v="{{v}}" readonly ng-model="ngModel.$display" />
5
5
  </div>
6
6
 
@@ -0,0 +1,15 @@
1
+ <div class="text-center pointer">
2
+ <input class="hidden" type="file" name="fileToUpload" accept="{{accept}}" />
3
+ <div class="center">
4
+ <div class="row">
5
+ <video controls>Your browser does not support the video element.</video>
6
+ </div>
7
+ <i-button type="upload" ng-click="upload()"></i-button>
8
+ <i-button type="delete" ng-click="delete()"></i-button>
9
+ </div>
10
+ <div class="row padding">
11
+ <div class="progress row">
12
+ <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="100"></div>
13
+ </div>
14
+ </div>
15
+ </div>
@@ -16,7 +16,11 @@ app.directive('iControl', function () {
16
16
  link: function ($scope, element, attrs, ctrl) {
17
17
  attrs.type = attrs.type || 'text';
18
18
  $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
19
-
19
+ $scope.v = $scope.v || '';
20
+ $scope.requird = '';
21
+ if ($scope.v.like('*r*')) {
22
+ $scope.requird = '*';
23
+ }
20
24
  if (typeof attrs.disabled !== 'undefined') {
21
25
  attrs.disabled = 'disabled';
22
26
  } else {
@@ -88,7 +92,13 @@ app.directive('iContent', function ($timeout, $interval) {
88
92
  .focus(() => {
89
93
  $('.popup').hide();
90
94
  });
91
- $timeout(() => {
95
+ $scope.handelContentElement = function () {
96
+ if (!document.querySelector('#' + $scope.id2)) {
97
+ $timeout(() => {
98
+ $scope.handelContentElement();
99
+ }, 1000);
100
+ return false;
101
+ }
92
102
  window['content_' + attrs.id] = WebShareEditor.create($scope.id2, {
93
103
  toolbarItem: [
94
104
  ['undo', 'redo'],
@@ -106,17 +116,21 @@ app.directive('iContent', function ($timeout, $interval) {
106
116
  width: '100%',
107
117
  minHeight: '300px',
108
118
  });
109
- if ($scope.ngModel) {
119
+ if ($scope.ngModel && window['content_' + attrs.id]) {
110
120
  window['content_' + attrs.id].setContents($scope.ngModel);
111
121
  }
112
122
  $interval(() => {
113
- $scope.ngModel2 = window['content_' + attrs.id].getContents();
114
- if ($scope.ngModel !== $scope.ngModel2) {
115
- $scope.ngModel = $scope.ngModel2;
116
- $scope.changed();
123
+ if (window['content_' + attrs.id]) {
124
+ $scope.ngModel2 = window['content_' + attrs.id].getContents();
125
+ if ($scope.ngModel !== $scope.ngModel2) {
126
+ $scope.ngModel = $scope.ngModel2;
127
+ $scope.changed();
128
+ }
117
129
  }
118
130
  }, 1000);
119
- }, 500);
131
+ };
132
+
133
+ $scope.handelContentElement();
120
134
 
121
135
  $scope.changed = function () {
122
136
  $timeout(() => {
@@ -128,7 +142,7 @@ app.directive('iContent', function ($timeout, $interval) {
128
142
 
129
143
  $scope.$watch('ngModel', (ngModel) => {
130
144
  if (ngModel && window['content_' + attrs.id]) {
131
- if ($scope.ngModel !== $scope.ngModel2) {
145
+ if ($scope.ngModel2 && $scope.ngModel !== $scope.ngModel2) {
132
146
  $scope.ngModel = $scope.ngModel2;
133
147
  window['content_' + attrs.id].setContents($scope.ngModel);
134
148
  }
@@ -249,11 +263,20 @@ app.directive('iButton', function () {
249
263
  $scope.fa = 'fas fa-sign-out-alt';
250
264
  $scope.class = 'btn-light';
251
265
  } else if ($scope.type.like('*push*')) {
252
- $scope.fa = 'fas fa-long-arrow-alt-down';
266
+ $scope.fa = 'fas fa-folder-plus';
253
267
  $scope.class = 'btn-primary';
254
268
  } else if ($scope.type.like('*cancel*')) {
255
269
  $scope.fa = 'fas fa-minus-circle';
256
270
  $scope.class = 'btn-danger';
271
+ } else if ($scope.type.like('*upload*')) {
272
+ $scope.fa = 'fas fa-upload';
273
+ $scope.class = 'btn-primary';
274
+ } else if ($scope.type.like('*up*')) {
275
+ $scope.fa = 'fas fa-long-arrow-alt-up';
276
+ $scope.class = 'btn-light';
277
+ } else if ($scope.type.like('*down*')) {
278
+ $scope.fa = 'fas fa-long-arrow-alt-down';
279
+ $scope.class = 'btn-light';
257
280
  }
258
281
  if ($scope.type.like('*default*')) {
259
282
  $scope.class = '';
@@ -304,7 +327,11 @@ app.directive('iList', [
304
327
  $scope.display2 = $scope.display2 || '';
305
328
  $scope.space = $scope.space || ' - ';
306
329
  attrs.ngValue = attrs.ngValue || '';
307
-
330
+ $scope.v = $scope.v || '';
331
+ $scope.requird = '';
332
+ if ($scope.v.like('*r*')) {
333
+ $scope.requird = '*';
334
+ }
308
335
  $scope.searchElement = $(element).find('.dropdown .search');
309
336
  $scope.popupElement = $(element).find('.dropdown .dropdown-content');
310
337
 
@@ -411,8 +438,6 @@ app.directive('iList', [
411
438
  }
412
439
  });
413
440
  }
414
-
415
-
416
441
  });
417
442
 
418
443
  $scope.$watch('ngModel', (ngModel) => {
@@ -594,7 +619,6 @@ app.directive('iDate', function () {
594
619
  $scope.dayTitle = 'Day';
595
620
  $scope.monthTitle = 'Month';
596
621
  $scope.yearTitle = 'Year';
597
-
598
622
 
599
623
  $scope.lang = site.session ? site.session.lang : 'en';
600
624
  if ($scope.lang === 'ar') {
@@ -654,7 +678,8 @@ app.directive('iDate', function () {
654
678
  };
655
679
  $scope.updateDate = function (date) {
656
680
  if ($scope.model.selectedDay && $scope.model.selectedMonth && $scope.model.selectedYear) {
657
- $scope.ngModel = new Date($scope.model.selectedYear.id, $scope.model.selectedMonth.id, $scope.model.selectedDay.id, 0, 0, 0);
681
+ let now = new Date();
682
+ $scope.ngModel = new Date($scope.model.selectedYear.id, $scope.model.selectedMonth.id, $scope.model.selectedDay.id, now.getHours(), now.getMinutes(), now.getSeconds());
658
683
  $scope.editOnly = false;
659
684
  if ($scope.ngChange) {
660
685
  $scope.ngChange();
@@ -927,11 +952,15 @@ app.directive('iImage', [
927
952
  let progress = $(element).find('.progress')[0];
928
953
  $(progress).hide();
929
954
 
930
- if (!$scope.viewOnly) {
931
- img.addEventListener('click', function () {
955
+ $scope.upload = function () {
956
+ if (!$scope.viewOnly) {
932
957
  input.click();
933
- });
934
- }
958
+ }
959
+ };
960
+ $scope.delete = function () {
961
+ img.src = null;
962
+ $scope.ngModel = null;
963
+ };
935
964
 
936
965
  input.addEventListener('change', function () {
937
966
  isite.uploadImage(
@@ -944,6 +973,7 @@ app.directive('iImage', [
944
973
  $(progress).show();
945
974
  $scope.value = (e.loaded / e.total) * 100;
946
975
  $scope.max = e.total;
976
+ $(progress).css('width', $scope.value);
947
977
  if ($scope.value === 100) {
948
978
  $(progress).hide();
949
979
  }
@@ -971,6 +1001,181 @@ app.directive('iImage', [
971
1001
  };
972
1002
  },
973
1003
  ]);
1004
+
1005
+ app.directive('iAudio', [
1006
+ '$interval',
1007
+ 'isite',
1008
+ '$timeout',
1009
+ function ($interval, isite, $timeout) {
1010
+ return {
1011
+ restrict: 'E',
1012
+ required: 'ngModel',
1013
+ scope: {
1014
+ folder: '@',
1015
+ view: '@',
1016
+ accept: '@',
1017
+ ngModel: '=',
1018
+ ngClick: '&',
1019
+ ngChange: '&',
1020
+ },
1021
+ link: function ($scope, element, attrs, ctrl) {
1022
+ $scope.folder = $scope.folder || 'default';
1023
+ $scope.accept = $scope.accept ? $scope.accept : '.mp3';
1024
+ $scope.viewOnly = $scope.view === undefined ? false : true;
1025
+
1026
+ let input = $(element).find('input')[0];
1027
+ let audio = $(element).find('audio')[0];
1028
+ let progress = $(element).find('.progress')[0];
1029
+ $(progress).hide();
1030
+
1031
+ $scope.upload = function () {
1032
+ if (!$scope.viewOnly) {
1033
+ input.click();
1034
+ }
1035
+ };
1036
+ $scope.delete = function () {
1037
+ $scope.ngModel = null;
1038
+ audio.setAttribute('src', null);
1039
+ };
1040
+
1041
+ input.addEventListener('change', function () {
1042
+ isite.uploadAudio(
1043
+ this.files,
1044
+ {
1045
+ folder: $scope.folder,
1046
+ },
1047
+ (err, audio, e) => {
1048
+ if (e) {
1049
+ $(progress).show();
1050
+ $scope.value = (e.loaded / e.total) * 100;
1051
+ $scope.max = e.total;
1052
+ $(progress).css('width', $scope.value);
1053
+ if ($scope.value === 100) {
1054
+ $(progress).hide();
1055
+ }
1056
+ }
1057
+
1058
+ if (audio) {
1059
+ $scope.ngModel = audio;
1060
+ if ($scope.ngChange) {
1061
+ $timeout(() => {
1062
+ $scope.ngChange();
1063
+ }, 200);
1064
+ }
1065
+ }
1066
+ }
1067
+ );
1068
+ });
1069
+
1070
+ $scope.$watch('ngModel', (ngModel) => {
1071
+ if (ngModel) {
1072
+ audio.setAttribute('src', ngModel.url);
1073
+ audio.setAttribute('type', 'audio/mpeg');
1074
+ }
1075
+ });
1076
+ },
1077
+ template: `/*##client-side/directive/i-audio.html*/`,
1078
+ };
1079
+ },
1080
+ ]);
1081
+
1082
+ app.directive('iVideo', [
1083
+ '$interval',
1084
+ 'isite',
1085
+ '$timeout',
1086
+ function ($interval, isite, $timeout) {
1087
+ return {
1088
+ restrict: 'E',
1089
+ required: 'ngModel',
1090
+ scope: {
1091
+ folder: '@',
1092
+ view: '@',
1093
+ accept: '@',
1094
+ ngModel: '=',
1095
+ ngClick: '&',
1096
+ ngChange: '&',
1097
+ },
1098
+ link: function ($scope, element, attrs, ctrl) {
1099
+ $scope.folder = $scope.folder || 'default';
1100
+ $scope.accept = $scope.accept ? $scope.accept : '.mp4';
1101
+ $scope.viewOnly = $scope.view === undefined ? false : true;
1102
+
1103
+ let input = $(element).find('input')[0];
1104
+ let video = $(element).find('video')[0];
1105
+ let progress = $(element).find('.progress')[0];
1106
+ $(progress).hide();
1107
+
1108
+ $scope.upload = function () {
1109
+ if (!$scope.viewOnly) {
1110
+ input.click();
1111
+ }
1112
+ };
1113
+ $scope.delete = function () {
1114
+ console.log('delete ...');
1115
+ $scope.ngModel = null;
1116
+ video.setAttribute('src', null);
1117
+ };
1118
+
1119
+ input.addEventListener('change', function () {
1120
+ isite.uploadVideo(
1121
+ this.files,
1122
+ {
1123
+ folder: $scope.folder,
1124
+ },
1125
+ (err, video, e) => {
1126
+ if (e) {
1127
+ $(progress).show();
1128
+ $scope.value = (e.loaded / e.total) * 100;
1129
+ $scope.max = e.total;
1130
+ $(progress).css('width', $scope.value);
1131
+ if ($scope.value === 100) {
1132
+ $(progress).hide();
1133
+ }
1134
+ }
1135
+
1136
+ if (video) {
1137
+ $scope.ngModel = video;
1138
+ if ($scope.ngChange) {
1139
+ $timeout(() => {
1140
+ $scope.ngChange();
1141
+ }, 200);
1142
+ }
1143
+ }
1144
+ }
1145
+ );
1146
+ });
1147
+
1148
+ $scope.capture = function () {
1149
+ let canvas = document.createElement('canvas');
1150
+ canvas.width = video.videoWidth / 4;
1151
+ canvas.height = video.videoHeight / 4;
1152
+ canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
1153
+ $scope.ngModel.imageURL = canvas.toDataURL('image/jpeg');
1154
+ };
1155
+
1156
+ video.addEventListener(
1157
+ 'canplay',
1158
+ function (e) {
1159
+ $timeout(() => {
1160
+ $scope.capture();
1161
+ }, 2000);
1162
+ },
1163
+ false
1164
+ );
1165
+
1166
+ $scope.$watch('ngModel', (ngModel) => {
1167
+ if (ngModel) {
1168
+ video.setAttribute('src', ngModel.url);
1169
+ video.setAttribute('type', 'video/mp4');
1170
+ video.load();
1171
+ }
1172
+ });
1173
+ },
1174
+ template: `/*##client-side/directive/i-video.html*/`,
1175
+ };
1176
+ },
1177
+ ]);
1178
+
974
1179
  app.directive('iUpload', [
975
1180
  '$interval',
976
1181
  'isite',
@@ -96,6 +96,80 @@ app.service('isite', [
96
96
  );
97
97
  };
98
98
 
99
+ this.uploadAudio = function (files, options, callback) {
100
+ options = Object.assign(
101
+ {
102
+ category: 'default',
103
+ },
104
+ options
105
+ );
106
+ callback = callback || function () {};
107
+
108
+ var fd = new FormData();
109
+ fd.append('fileToUpload', files[0]);
110
+ $http
111
+ .post('/x-api/upload/audio', fd, {
112
+ withCredentials: !0,
113
+ headers: {
114
+ 'Content-Type': undefined,
115
+ folder: options.folder,
116
+ },
117
+ uploadEventHandlers: {
118
+ progress: function (e) {
119
+ callback(null, null, e);
120
+ },
121
+ },
122
+ transformRequest: angular.identity,
123
+ })
124
+ .then(
125
+ function (res) {
126
+ if (res.data && res.data.done) {
127
+ callback(null, res.data.audio);
128
+ }
129
+ },
130
+ function (error) {
131
+ callback(error, null, null);
132
+ }
133
+ );
134
+ };
135
+
136
+ this.uploadVideo = function (files, options, callback) {
137
+ options = Object.assign(
138
+ {
139
+ category: 'default',
140
+ },
141
+ options
142
+ );
143
+ callback = callback || function () {};
144
+
145
+ var fd = new FormData();
146
+ fd.append('fileToUpload', files[0]);
147
+ $http
148
+ .post('/x-api/upload/video', fd, {
149
+ withCredentials: !0,
150
+ headers: {
151
+ 'Content-Type': undefined,
152
+ folder: options.folder,
153
+ },
154
+ uploadEventHandlers: {
155
+ progress: function (e) {
156
+ callback(null, null, e);
157
+ },
158
+ },
159
+ transformRequest: angular.identity,
160
+ })
161
+ .then(
162
+ function (res) {
163
+ if (res.data && res.data.done) {
164
+ callback(null, res.data.video);
165
+ }
166
+ },
167
+ function (error) {
168
+ callback(error, null, null);
169
+ }
170
+ );
171
+ };
172
+
99
173
  this.uploadFile = function (files, options, callback) {
100
174
  options = Object.assign(
101
175
  {
@@ -585,21 +585,29 @@
585
585
  };
586
586
 
587
587
  site.showTabContent = function (e, tabContentSelector) {
588
- let parent = document.querySelector(tabContentSelector).parentNode.parentNode;
589
-
590
- parent.querySelectorAll('.tab-content').forEach((tabContent) => {
591
- tabContent.style.display = 'none';
592
- });
593
- parent.querySelectorAll('.tab-link').forEach((tabLink) => {
594
- tabLink.className = tabLink.className.replace(' active', '');
595
- });
596
-
597
- document.querySelectorAll(tabContentSelector + '.tab-content').forEach((el) => {
598
- el.style.display = 'block';
599
- });
588
+ tabContentSelector = tabContentSelector || e;
589
+ let tabContent = document.querySelector(tabContentSelector);
590
+ if (tabContent) {
591
+ let tabHeader = tabContent.parentNode;
592
+ if (tabHeader) {
593
+ let tabs = tabHeader.parentNode;
594
+ if (tabs) {
595
+ tabs.querySelectorAll('.tab-content').forEach((tabContent) => {
596
+ tabContent.style.display = 'none';
597
+ });
598
+ tabs.querySelectorAll('.tab-link').forEach((tabLink) => {
599
+ if (tabLink.getAttribute('onclick').contains(tabContentSelector + "'")) {
600
+ tabLink.classList.add('active');
601
+ } else {
602
+ tabLink.classList.remove('active');
603
+ }
604
+ });
600
605
 
601
- if (e) {
602
- e.currentTarget.className += ' active';
606
+ tabs.querySelectorAll(tabContentSelector + '.tab-content').forEach((el) => {
607
+ el.style.display = 'block';
608
+ });
609
+ }
610
+ }
603
611
  }
604
612
  };
605
613
 
package/lib/parser.js CHANGED
@@ -458,6 +458,39 @@ module.exports = function init(req, res, ____0, route) {
458
458
  }
459
459
  });
460
460
 
461
+ $('[x-data]').each(function (i, elem) {
462
+ let property = $(elem).attr('x-data').split('.');
463
+ let out = null;
464
+ if (property.length > 0) {
465
+ if (property.length > 0) {
466
+ out = req.data[property[0]];
467
+ }
468
+
469
+ if (property.length > 1 && out) {
470
+ out = out[property[1]];
471
+ }
472
+
473
+ if (property.length > 2 && out) {
474
+ out = out[property[2]];
475
+ }
476
+
477
+ if (property.length > 3 && out) {
478
+ out = out[property[3]];
479
+ }
480
+
481
+ if (property.length > 4 && out) {
482
+ out = out[property[4]];
483
+ }
484
+
485
+ if (property.length > 5 && out) {
486
+ out = out[property[5]];
487
+ }
488
+ }
489
+ if (out !== true) {
490
+ $(this).remove();
491
+ }
492
+ });
493
+
461
494
  $('[x-permission]').each(function (i, elem) {
462
495
  if (!____0.security.isUserHasPermission(req, res, $(this).attr('x-permission'))) {
463
496
  $(this).remove();
@@ -613,6 +646,10 @@ module.exports = function init(req, res, ____0, route) {
613
646
  $(handleXList1($, elem, req.data)).insertAfter($(this));
614
647
  $(this).remove();
615
648
  });
649
+ $('[x-list2]').each(function (i, elem) {
650
+ $(handleXList2($, elem, req.data)).insertAfter($(this));
651
+ $(this).remove();
652
+ });
616
653
  return $;
617
654
  }
618
655
 
package/lib/sessions.js CHANGED
@@ -98,14 +98,13 @@ module.exports = function init(____0) {
98
98
  session.$exists = !1;
99
99
 
100
100
  if (session.accessToken) {
101
- sessions.list.forEach((s, i) => {
102
- if (s && s.accessToken && s.accessToken == session.accessToken) {
103
- session.$exists = !0;
104
- session.$index = i;
105
- sessions.list[session.$index].requestesCount++;
106
- }
107
- });
108
- if (!session.$exists) {
101
+ let index = sessions.list.findIndex(s=> s && s.accessToken && s.accessToken === session.accessToken);
102
+ if(index > -1){
103
+ sessions.list[index].requestesCount++;
104
+ session.$exists = !0;
105
+ session.$index = index;
106
+ callback(sessions.list[index]);
107
+ }else {
109
108
  if (____0.options.session.storage === 'mongodb') {
110
109
  sessions.$collection.find({ accessToken: session.accessToken }, (err, doc) => {
111
110
  if (!err && doc) {
@@ -140,8 +139,6 @@ module.exports = function init(____0) {
140
139
  sessions.list.push(session);
141
140
  callback(sessions.list[session.$index]);
142
141
  }
143
- } else {
144
- callback(sessions.list[session.$index]);
145
142
  }
146
143
  } else {
147
144
  session.$new = !0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2023.01.06",
3
+ "version": "2023.01.07",
4
4
  "description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {