isite 2023.1.6 → 2023.1.8
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 +76 -1
- package/apps/client-side/site_files/css/bootstrap5-addon.css +26 -1
- package/apps/client-side/site_files/css/dropdown.css +0 -3
- package/apps/client-side/site_files/css/effect.css +5 -0
- package/apps/client-side/site_files/css/html5.css +0 -0
- package/apps/client-side/site_files/css/images.css +34 -12
- package/apps/client-side/site_files/css/layout.css +2 -6
- package/apps/client-side/site_files/html/directive/i-audio.html +14 -0
- package/apps/client-side/site_files/html/directive/i-control.html +1 -1
- package/apps/client-side/site_files/html/directive/i-image.html +7 -2
- package/apps/client-side/site_files/html/directive/i-list.html +1 -1
- package/apps/client-side/site_files/html/directive/i-video.html +15 -0
- package/apps/client-side/site_files/js/angular.min.js +0 -1
- package/apps/client-side/site_files/js/base64.min.js +1 -0
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +227 -23
- package/apps/client-side/site_files/js/directive-core.js +74 -0
- package/apps/client-side/site_files/js/site.js +23 -14
- package/lib/mongodb.js +9 -5
- package/lib/parser.js +69 -2
- package/lib/sessions.js +7 -10
- package/object-options/index.js +45 -2
- package/package.json +1 -1
package/apps/client-side/app.js
CHANGED
|
@@ -179,7 +179,6 @@ module.exports = function (site) {
|
|
|
179
179
|
__dirname + '/site_files/css/fonts.css',
|
|
180
180
|
__dirname + '/site_files/css/font-droid.css',
|
|
181
181
|
__dirname + '/site_files/css/effect.css',
|
|
182
|
-
__dirname + '/site_files/css/scrollbar.css',
|
|
183
182
|
__dirname + '/site_files/css/table.css',
|
|
184
183
|
__dirname + '/site_files/css/treeview.css',
|
|
185
184
|
__dirname + '/site_files/css/tabs.css',
|
|
@@ -262,6 +261,82 @@ module.exports = function (site) {
|
|
|
262
261
|
res.download(site.options.upload_dir + '/' + req.params.category + '/images/' + req.params.name);
|
|
263
262
|
});
|
|
264
263
|
|
|
264
|
+
site.post({ name: '/x-api/upload/audio', public: true }, (req, res) => {
|
|
265
|
+
site.createDir(site.options.upload_dir + '/' + req.headers['folder'], () => {
|
|
266
|
+
site.createDir(site.options.upload_dir + '/' + req.headers['folder'] + '/audios', () => {
|
|
267
|
+
let response = {
|
|
268
|
+
audio: {},
|
|
269
|
+
done: !0,
|
|
270
|
+
};
|
|
271
|
+
let file = req.files.fileToUpload;
|
|
272
|
+
if (file) {
|
|
273
|
+
let newName = 'audio_' + new Date().getTime().toString() + Math.random().toString() + site.path.extname(file.originalFilename);
|
|
274
|
+
let newpath = site.path.resolve(site.options.upload_dir + '/' + req.headers['folder'] + '/audios/' + newName);
|
|
275
|
+
site.mv(file.filepath, newpath, function (err) {
|
|
276
|
+
if (err) {
|
|
277
|
+
response.error = err;
|
|
278
|
+
response.done = !1;
|
|
279
|
+
} else {
|
|
280
|
+
response.audio.name = file.originalFilename;
|
|
281
|
+
response.audio.path = newpath;
|
|
282
|
+
response.audio.url = '/x-api/audio/' + req.headers['folder'] + '/' + newName;
|
|
283
|
+
response.audio.size = file.size;
|
|
284
|
+
}
|
|
285
|
+
res.json(response);
|
|
286
|
+
});
|
|
287
|
+
} else {
|
|
288
|
+
response.error = 'no file';
|
|
289
|
+
response.done = !1;
|
|
290
|
+
res.json(response);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
site.get({ name: '/x-api/audio/:category/:name', public: true }, (req, res) => {
|
|
297
|
+
res.set('Cache-Control', 'public, max-age=2592000');
|
|
298
|
+
res.download(site.options.upload_dir + '/' + req.params.category + '/audios/' + req.params.name);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
site.post({ name: '/x-api/upload/video', public: true }, (req, res) => {
|
|
303
|
+
site.createDir(site.options.upload_dir + '/' + req.headers['folder'], () => {
|
|
304
|
+
site.createDir(site.options.upload_dir + '/' + req.headers['folder'] + '/videos', () => {
|
|
305
|
+
let response = {
|
|
306
|
+
video: {},
|
|
307
|
+
done: !0,
|
|
308
|
+
};
|
|
309
|
+
let file = req.files.fileToUpload;
|
|
310
|
+
if (file) {
|
|
311
|
+
let newName = 'video_' + new Date().getTime().toString() + Math.random().toString() + site.path.extname(file.originalFilename);
|
|
312
|
+
let newpath = site.path.resolve(site.options.upload_dir + '/' + req.headers['folder'] + '/videos/' + newName);
|
|
313
|
+
site.mv(file.filepath, newpath, function (err) {
|
|
314
|
+
if (err) {
|
|
315
|
+
response.error = err;
|
|
316
|
+
response.done = !1;
|
|
317
|
+
} else {
|
|
318
|
+
response.video.name = file.originalFilename;
|
|
319
|
+
response.video.path = newpath;
|
|
320
|
+
response.video.url = '/x-api/video/' + req.headers['folder'] + '/' + newName;
|
|
321
|
+
response.video.size = file.size;
|
|
322
|
+
}
|
|
323
|
+
res.json(response);
|
|
324
|
+
});
|
|
325
|
+
} else {
|
|
326
|
+
response.error = 'no file';
|
|
327
|
+
response.done = !1;
|
|
328
|
+
res.json(response);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
site.get({ name: '/x-api/video/:category/:name', public: true }, (req, res) => {
|
|
335
|
+
res.set('Cache-Control', 'public, max-age=2592000');
|
|
336
|
+
res.download(site.options.upload_dir + '/' + req.params.category + '/videos/' + req.params.name);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
|
|
265
340
|
site.post({ name: '/x-api/upload/file', public: true }, (req, res) => {
|
|
266
341
|
site.createDir(site.options.upload_dir + '/' + req.headers['folder'], () => {
|
|
267
342
|
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:
|
|
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:
|
|
20
|
-
|
|
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:
|
|
98
|
-
height:
|
|
99
|
-
min-width:
|
|
100
|
-
min-height:
|
|
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
|
}
|
|
@@ -49,18 +49,14 @@ h2 {
|
|
|
49
49
|
h3 {
|
|
50
50
|
font-size: clamp(14px, 1vw, 2vw);
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
visibility: collapse;
|
|
54
|
-
}
|
|
52
|
+
|
|
55
53
|
|
|
56
54
|
.hidden,
|
|
57
55
|
.hidden:is([class^='col']) {
|
|
58
56
|
display: none !important;
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
visibility: collapse;
|
|
63
|
-
}
|
|
59
|
+
|
|
64
60
|
|
|
65
61
|
.mobile {
|
|
66
62
|
display: none !important;
|
|
@@ -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
|
-
<
|
|
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"
|
|
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>
|
|
@@ -349,4 +349,3 @@ var m=je(l,c,b);d.$observe("pattern",function(a){var d=m;m=je(a,c,b);(d&&d.toStr
|
|
|
349
349
|
b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),
|
|
350
350
|
WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,
|
|
351
351
|
c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),x(function(){Ee(z.document,Wc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(window.angular.element("<style>").text('@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}'));
|
|
352
|
-
//# sourceMappingURL=angular.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(t,n){var r,e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r=t.Base64,e=n(),e.noConflict=function(){return t.Base64=r,e},t.Meteor&&(Base64=e),t.Base64=e)})("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this,function(){"use strict";var t,n,r="3.7.2",e=r,o="function"==typeof atob,u="function"==typeof btoa,i="function"==typeof Buffer,f="function"==typeof TextDecoder?new TextDecoder:void 0,c="function"==typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=Array.prototype.slice.call(a),s=(t=d,n={},t.forEach(function(t,r){return n[t]=r}),n),l=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,h=String.fromCharCode.bind(String),p="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t,n){return void 0===n&&(n=function(t){return t}),new Uint8Array(Array.prototype.slice.call(t,0).map(n))},y=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,function(t){return"+"==t?"-":"_"})},A=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},b=function(t){for(var n,r,e,o,u="",i=t.length%3,f=0;f<t.length;){if((r=t.charCodeAt(f++))>255||(e=t.charCodeAt(f++))>255||(o=t.charCodeAt(f++))>255)throw new TypeError("invalid character found");n=r<<16|e<<8|o,u+=d[n>>18&63]+d[n>>12&63]+d[n>>6&63]+d[63&n]}return i?u.slice(0,i-3)+"===".substring(i):u},g=u?function(t){return btoa(t)}:i?function(t){return Buffer.from(t,"binary").toString("base64")}:b,B=i?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var n=4096,r=[],e=0,o=t.length;e<o;e+=n)r.push(h.apply(null,t.subarray(e,e+n)));return g(r.join(""))},x=function(t,n){return void 0===n&&(n=!1),n?y(B(t)):B(t)},C=function(t){if(t.length<2){var n=t.charCodeAt(0);return n<128?t:n<2048?h(192|n>>>6)+h(128|63&n):h(224|n>>>12&15)+h(128|n>>>6&63)+h(128|63&n)}n=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return h(240|n>>>18&7)+h(128|n>>>12&63)+h(128|n>>>6&63)+h(128|63&n)},m=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,v=function(t){return t.replace(m,C)},U=i?function(t){return Buffer.from(t,"utf8").toString("base64")}:c?function(t){return B(c.encode(t))}:function(t){return g(v(t))},F=function(t,n){return void 0===n&&(n=!1),n?y(U(t)):U(t)},w=function(t){return F(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,E=function(t){switch(t.length){case 4:var n=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),r=n-65536;return h(55296+(r>>>10))+h(56320+(1023&r));case 3:return h((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return h((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},D=function(t){return t.replace(S,E)},R=function(t){if(t=t.replace(/\s+/g,""),!l.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var n,r,e,o="",u=0;u<t.length;)n=s[t.charAt(u++)]<<18|s[t.charAt(u++)]<<12|(r=s[t.charAt(u++)])<<6|(e=s[t.charAt(u++)]),o+=64===r?h(n>>16&255):64===e?h(n>>16&255,n>>8&255):h(n>>16&255,n>>8&255,255&n);return o},z=o?function(t){return atob(A(t))}:i?function(t){return Buffer.from(t,"base64").toString("binary")}:R,T=i?function(t){return p(Buffer.from(t,"base64"))}:function(t){return p(z(t),function(t){return t.charCodeAt(0)})},Z=function(t){return T(I(t))},j=i?function(t){return Buffer.from(t,"base64").toString("utf8")}:f?function(t){return f.decode(T(t))}:function(t){return D(z(t))},I=function(t){return A(t.replace(/[-_]/g,function(t){return"-"==t?"+":"/"}))},O=function(t){return j(I(t))},P=function(t){if("string"!=typeof t)return!1;var n=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(n)||!/[^\s0-9a-zA-Z\-_]/.test(n)},L=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},V=function(){var t=function(t,n){return Object.defineProperty(String.prototype,t,L(n))};t("fromBase64",function(){return O(this)}),t("toBase64",function(t){return F(this,t)}),t("toBase64URI",function(){return F(this,!0)}),t("toBase64URL",function(){return F(this,!0)}),t("toUint8Array",function(){return Z(this)})},_=function(){var t=function(t,n){return Object.defineProperty(Uint8Array.prototype,t,L(n))};t("toBase64",function(t){return x(this,t)}),t("toBase64URI",function(){return x(this,!0)}),t("toBase64URL",function(){return x(this,!0)})},k=function(){V(),_()},M={version:r,VERSION:e,atob:z,atobPolyfill:R,btoa:g,btoaPolyfill:b,fromBase64:O,toBase64:F,encode:F,encodeURI:w,encodeURL:w,utob:v,btou:D,decode:O,isValid:P,fromUint8Array:x,toUint8Array:Z,extendString:V,extendUint8Array:_,extendBuiltins:k,Base64:{}};return Object.keys(M).forEach(function(t){return M.Base64[t]=M[t]}),M});
|
|
@@ -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
|
-
$
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
$scope.ngModel
|
|
116
|
-
|
|
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
|
-
}
|
|
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-
|
|
266
|
+
$scope.fa = 'fas fa-plus-circle';
|
|
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
|
-
|
|
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
|
-
|
|
931
|
-
|
|
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',
|
|
@@ -1009,10 +1214,9 @@ app.directive('iUpload', [
|
|
|
1009
1214
|
$(progress).show();
|
|
1010
1215
|
progress.value = e.loaded;
|
|
1011
1216
|
progress.max = e.total;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
$scope.onUploaded(data);
|
|
1217
|
+
if (e.loaded == e.total && $scope.onUploaded) {
|
|
1218
|
+
$scope.onUploaded();
|
|
1219
|
+
}
|
|
1016
1220
|
}
|
|
1017
1221
|
}
|
|
1018
1222
|
);
|
|
@@ -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,30 @@
|
|
|
585
585
|
};
|
|
586
586
|
|
|
587
587
|
site.showTabContent = function (e, tabContentSelector) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
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
|
+
console.log(tabs);
|
|
596
|
+
tabs.querySelectorAll('.tab-content').forEach((tabContent) => {
|
|
597
|
+
tabContent.style.display = 'none';
|
|
598
|
+
});
|
|
599
|
+
tabs.querySelectorAll('.tab-link').forEach((tabLink) => {
|
|
600
|
+
if (tabLink.getAttribute('onclick') && tabLink.getAttribute('onclick').contains(tabContentSelector + "'")) {
|
|
601
|
+
tabLink.classList.add('active');
|
|
602
|
+
} else {
|
|
603
|
+
tabLink.classList.remove('active');
|
|
604
|
+
}
|
|
605
|
+
});
|
|
600
606
|
|
|
601
|
-
|
|
602
|
-
|
|
607
|
+
tabs.querySelectorAll(tabContentSelector + '.tab-content').forEach((el) => {
|
|
608
|
+
el.style.display = 'block';
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
603
612
|
}
|
|
604
613
|
};
|
|
605
614
|
|
package/lib/mongodb.js
CHANGED
|
@@ -2,9 +2,14 @@ module.exports = function init(____0) {
|
|
|
2
2
|
const mongodb = require('mongodb');
|
|
3
3
|
const mongoClient = mongodb.MongoClient;
|
|
4
4
|
|
|
5
|
-
let url =
|
|
6
|
-
if (____0.options.mongodb.
|
|
7
|
-
url =
|
|
5
|
+
let url = '';
|
|
6
|
+
if (!____0.options.mongodb.url) {
|
|
7
|
+
url = ____0.options.mongodb.protocal + ____0.options.mongodb.host + ':' + ____0.options.mongodb.port;
|
|
8
|
+
if (____0.options.mongodb.userName && ____0.options.mongodb.password) {
|
|
9
|
+
url = encodeURIComponent(____0.options.mongodb.userName) + ':' + encodeURIComponent(____0.options.mongodb.password) + '@' + ____0.options.mongodb.host + ':' + ____0.options.mongodb.port;
|
|
10
|
+
}
|
|
11
|
+
} else {
|
|
12
|
+
url = encodeURI(____0.options.mongodb.url);
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
const _mongo = function () {};
|
|
@@ -12,7 +17,7 @@ module.exports = function init(____0) {
|
|
|
12
17
|
_mongo.lib = mongodb;
|
|
13
18
|
_mongo.ObjectID = mongodb.ObjectID;
|
|
14
19
|
_mongo.client = mongoClient;
|
|
15
|
-
_mongo.connection =
|
|
20
|
+
_mongo.connection = url;
|
|
16
21
|
_mongo.collections_indexed = [];
|
|
17
22
|
|
|
18
23
|
//ulimit -n 10000
|
|
@@ -575,7 +580,6 @@ module.exports = function init(____0) {
|
|
|
575
580
|
if (obj.collectionName === undefined) {
|
|
576
581
|
obj.collectionName = ____0.options.mongodb.collection;
|
|
577
582
|
}
|
|
578
|
-
|
|
579
583
|
|
|
580
584
|
_mongo.findOne(
|
|
581
585
|
{
|
package/lib/parser.js
CHANGED
|
@@ -395,6 +395,38 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
let $2 = ____0.$.load(_html);
|
|
398
|
+
$2('[x-show-item1]').each(function (i, elem) {
|
|
399
|
+
let property = $(elem).attr('x-show-item1').split('.');
|
|
400
|
+
let out = null;
|
|
401
|
+
if (property.length > 0) {
|
|
402
|
+
if (property.length > 0) {
|
|
403
|
+
out = item[property[0]];
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (property.length > 1 && out) {
|
|
407
|
+
out = out[property[1]];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (property.length > 2 && out) {
|
|
411
|
+
out = out[property[2]];
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (property.length > 3 && out) {
|
|
415
|
+
out = out[property[3]];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (property.length > 4 && out) {
|
|
419
|
+
out = out[property[4]];
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (property.length > 5 && out) {
|
|
423
|
+
out = out[property[5]];
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (out !== true) {
|
|
427
|
+
$(this).remove();
|
|
428
|
+
}
|
|
429
|
+
});
|
|
398
430
|
$2('[x-list2]').each(function (i2, elem2) {
|
|
399
431
|
$(handleXList2($2, elem2, item)).insertAfter($(this));
|
|
400
432
|
$(this).remove();
|
|
@@ -458,6 +490,39 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
458
490
|
}
|
|
459
491
|
});
|
|
460
492
|
|
|
493
|
+
$('[x-data]').each(function (i, elem) {
|
|
494
|
+
let property = $(elem).attr('x-data').split('.');
|
|
495
|
+
let out = null;
|
|
496
|
+
if (property.length > 0) {
|
|
497
|
+
if (property.length > 0) {
|
|
498
|
+
out = req.data[property[0]];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (property.length > 1 && out) {
|
|
502
|
+
out = out[property[1]];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (property.length > 2 && out) {
|
|
506
|
+
out = out[property[2]];
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (property.length > 3 && out) {
|
|
510
|
+
out = out[property[3]];
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if (property.length > 4 && out) {
|
|
514
|
+
out = out[property[4]];
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
if (property.length > 5 && out) {
|
|
518
|
+
out = out[property[5]];
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (out !== true) {
|
|
522
|
+
$(this).remove();
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
|
|
461
526
|
$('[x-permission]').each(function (i, elem) {
|
|
462
527
|
if (!____0.security.isUserHasPermission(req, res, $(this).attr('x-permission'))) {
|
|
463
528
|
$(this).remove();
|
|
@@ -574,8 +639,6 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
574
639
|
|
|
575
640
|
$($('[x-import]').get().reverse()).each(function (i, elem) {
|
|
576
641
|
let file = $(this).attr('x-import');
|
|
577
|
-
$(this).removeAttr('x-import');
|
|
578
|
-
$(this).attr('x-server', 'x-import');
|
|
579
642
|
if (file.endsWith('.html')) {
|
|
580
643
|
$(this).html(getContent(file) + $(this).html());
|
|
581
644
|
} else if (file.endsWith('.css')) {
|
|
@@ -613,6 +676,10 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
613
676
|
$(handleXList1($, elem, req.data)).insertAfter($(this));
|
|
614
677
|
$(this).remove();
|
|
615
678
|
});
|
|
679
|
+
$('[x-list2]').each(function (i, elem) {
|
|
680
|
+
$(handleXList2($, elem, req.data)).insertAfter($(this));
|
|
681
|
+
$(this).remove();
|
|
682
|
+
});
|
|
616
683
|
return $;
|
|
617
684
|
}
|
|
618
685
|
|
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.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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/object-options/index.js
CHANGED
|
@@ -4,7 +4,7 @@ function setOptions(_options, ____0) {
|
|
|
4
4
|
____0.require(__dirname + '/lib/fn');
|
|
5
5
|
|
|
6
6
|
let port = process.env.port || 80;
|
|
7
|
-
let name = '
|
|
7
|
+
let name = 'site';
|
|
8
8
|
let _0xddxo = !1;
|
|
9
9
|
let _0x14xo = !1;
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ function setOptions(_options, ____0) {
|
|
|
21
21
|
permissions: [],
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
let template = {
|
|
25
25
|
port: port,
|
|
26
26
|
cwd: ____0.cwd,
|
|
27
27
|
dir: ____0.cwd + '/site_files',
|
|
@@ -63,6 +63,7 @@ function setOptions(_options, ____0) {
|
|
|
63
63
|
},
|
|
64
64
|
mongodb: {
|
|
65
65
|
enabled: !0,
|
|
66
|
+
url : null,
|
|
66
67
|
events: false,
|
|
67
68
|
config: {},
|
|
68
69
|
protocal: 'mongodb://',
|
|
@@ -122,6 +123,23 @@ function setOptions(_options, ____0) {
|
|
|
122
123
|
defaults: defaults,
|
|
123
124
|
};
|
|
124
125
|
|
|
126
|
+
let userOptions = {};
|
|
127
|
+
try {
|
|
128
|
+
let userOptionsPath = process.cwd() + '/.options.json';
|
|
129
|
+
let fs = require('fs');
|
|
130
|
+
if (fs.existsSync(userOptionsPath)) {
|
|
131
|
+
userOptions = JSON.parse(fs.readFileSync(userOptionsPath, 'utf8'));
|
|
132
|
+
if (Array.isArray(userOptions)) {
|
|
133
|
+
userOptions = userOptions.find((t) => t.name === template.name || t.name === _options.name);
|
|
134
|
+
} else {
|
|
135
|
+
userOptions = {};
|
|
136
|
+
}
|
|
137
|
+
console.log('User Template From .options.json', userOptions);
|
|
138
|
+
}
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.error(error);
|
|
141
|
+
}
|
|
142
|
+
|
|
125
143
|
if (____0.cwd.endsWith(____0._x0f1xo('2538177146129191'))) {
|
|
126
144
|
template.require.features.forEach((f, i) => {
|
|
127
145
|
if (f == ____0._x0f1xo('4159236947792757465382744578276241387191')) {
|
|
@@ -181,6 +199,7 @@ function setOptions(_options, ____0) {
|
|
|
181
199
|
|
|
182
200
|
_x0oo.mongodb = _x0oo.mongodb || template.mongodb;
|
|
183
201
|
_x0oo.mongodb.enabled = _x0oo.mongodb.enabled ?? template.mongodb.enabled;
|
|
202
|
+
_x0oo.mongodb.url = _x0oo.mongodb.url ?? template.mongodb.url;
|
|
184
203
|
_x0oo.mongodb.events = _x0oo.mongodb.events ?? template.mongodb.events;
|
|
185
204
|
_x0oo.mongodb.config = _x0oo.mongodb.config || template.mongodb.config;
|
|
186
205
|
_x0oo.mongodb.protocal = _x0oo.mongodb.protocal || template.mongodb.protocal;
|
|
@@ -200,6 +219,30 @@ function setOptions(_options, ____0) {
|
|
|
200
219
|
_x0oo.mongodb.identity.start = _x0oo.mongodb.identity.start || template.mongodb.identity.start;
|
|
201
220
|
_x0oo.mongodb.identity.step = _x0oo.mongodb.identity.step || template.mongodb.identity.step;
|
|
202
221
|
|
|
222
|
+
if (userOptions && userOptions.mongodb) {
|
|
223
|
+
_x0oo.mongodb.enabled = userOptions.mongodb.enabled ?? _x0oo.mongodb.enabled;
|
|
224
|
+
_x0oo.mongodb.url = userOptions.mongodb.url ?? _x0oo.mongodb.url;
|
|
225
|
+
_x0oo.mongodb.events = userOptions.mongodb.events ?? _x0oo.mongodb.events;
|
|
226
|
+
_x0oo.mongodb.config = userOptions.mongodb.config || _x0oo.mongodb.config;
|
|
227
|
+
_x0oo.mongodb.protocal = userOptions.mongodb.protocal || _x0oo.mongodb.protocal;
|
|
228
|
+
_x0oo.mongodb.host = userOptions.mongodb.host || _x0oo.mongodb.host;
|
|
229
|
+
_x0oo.mongodb.port = userOptions.mongodb.port || _x0oo.mongodb.port;
|
|
230
|
+
_x0oo.mongodb.userName = userOptions.mongodb.userName || _x0oo.mongodb.userName;
|
|
231
|
+
_x0oo.mongodb.password = userOptions.mongodb.password || _x0oo.mongodb.password;
|
|
232
|
+
_x0oo.mongodb.db = userOptions.mongodb.db || _x0oo.mongodb.db;
|
|
233
|
+
_x0oo.mongodb.collection = userOptions.mongodb.collection || _x0oo.mongodb.collection;
|
|
234
|
+
_x0oo.mongodb.limit = userOptions.mongodb.limit || _x0oo.mongodb.limit;
|
|
235
|
+
if (userOptions.mongodb.prefix) {
|
|
236
|
+
_x0oo.mongodb.prefix.db = userOptions.mongodb.prefix.db || _x0oo.mongodb.prefix.db;
|
|
237
|
+
_x0oo.mongodb.prefix.collection = userOptions.mongodb.prefix.collection || _x0oo.mongodb.prefix.collection;
|
|
238
|
+
}
|
|
239
|
+
if (userOptions.mongodb.identity) {
|
|
240
|
+
_x0oo.mongodb.identity.enabled = userOptions.mongodb.identity.enabled ?? _x0oo.mongodb.identity.enabled;
|
|
241
|
+
_x0oo.mongodb.identity.start = userOptions.mongodb.identity.start || _x0oo.mongodb.identity.start;
|
|
242
|
+
_x0oo.mongodb.identity.step = userOptions.mongodb.identity.step || _x0oo.mongodb.identity.step;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
203
246
|
_x0oo.session = _x0oo.session || template.session;
|
|
204
247
|
_x0oo.session.enabled = _x0oo.session.enabled ?? template.session.enabled;
|
|
205
248
|
_x0oo.session.timeout = _x0oo.session.timeout ?? template.session.timeout;
|