isite 2024.8.22 → 2024.9.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/app.js +11 -0
- package/apps/client-side/site_files/js/site.js +44 -0
- package/apps/client-side/site_files/js/site.min.js +1 -1
- package/index.js +36 -10
- package/lib/integrated.js +85 -5
- package/lib/routing.js +162 -114
- package/object-options/index.js +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1377,7 +1377,7 @@ site.quee('sync event name 2', { name: 'x2' });
|
|
|
1377
1377
|
|
|
1378
1378
|
# Contact Me
|
|
1379
1379
|
|
|
1380
|
-
- Binance ID: 836059928
|
|
1380
|
+
- Binance ID: 836059928 (for Money support)
|
|
1381
1381
|
- Email : Absunstar@gmail.com
|
|
1382
1382
|
- Github : https://github.com/absunstar
|
|
1383
1383
|
- What's up: +966568118373
|
package/apps/client-side/app.js
CHANGED
|
@@ -26,12 +26,14 @@ module.exports = function (site) {
|
|
|
26
26
|
path: __dirname + '/site_files/js',
|
|
27
27
|
public: true,
|
|
28
28
|
parser: 'js',
|
|
29
|
+
shared : true
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
site.get({
|
|
32
33
|
name: ['/x-js/all.js'],
|
|
33
34
|
public: true,
|
|
34
35
|
parser: 'js',
|
|
36
|
+
shared : true,
|
|
35
37
|
path: [
|
|
36
38
|
__dirname + '/site_files/js/first.js',
|
|
37
39
|
__dirname + '/site_files/js/jquery.js',
|
|
@@ -54,6 +56,7 @@ module.exports = function (site) {
|
|
|
54
56
|
name: ['/x-js/bootstrap-5-support.js'],
|
|
55
57
|
public: true,
|
|
56
58
|
parser: 'js',
|
|
59
|
+
shared : true,
|
|
57
60
|
path: [
|
|
58
61
|
__dirname + '/site_files/js/first.js',
|
|
59
62
|
__dirname + '/site_files/js/jquery.js',
|
|
@@ -79,6 +82,7 @@ module.exports = function (site) {
|
|
|
79
82
|
name: ['/x-js/sa.js'],
|
|
80
83
|
public: true,
|
|
81
84
|
parser: 'js',
|
|
85
|
+
shared : true,
|
|
82
86
|
path: [
|
|
83
87
|
__dirname + '/site_files/js/first.js',
|
|
84
88
|
__dirname + '/site_files/js/jquery.js',
|
|
@@ -121,28 +125,33 @@ module.exports = function (site) {
|
|
|
121
125
|
name: '/x-css',
|
|
122
126
|
path: __dirname + '/site_files/css',
|
|
123
127
|
public: true,
|
|
128
|
+
shared : true,
|
|
124
129
|
});
|
|
125
130
|
site.get({
|
|
126
131
|
name: '/x-semantic-themes',
|
|
127
132
|
path: __dirname + '/site_files/semantic-themes',
|
|
128
133
|
public: true,
|
|
134
|
+
shared : true,
|
|
129
135
|
});
|
|
130
136
|
|
|
131
137
|
site.get({
|
|
132
138
|
name: ['/x-fonts', '/x-css/x-fonts'],
|
|
133
139
|
path: __dirname + '/site_files/fonts',
|
|
134
140
|
public: true,
|
|
141
|
+
shared : true,
|
|
135
142
|
});
|
|
136
143
|
site.get({
|
|
137
144
|
name: ['/webfonts', '/x-css/webfonts'],
|
|
138
145
|
path: __dirname + '/site_files/webfonts',
|
|
139
146
|
public: true,
|
|
147
|
+
shared : true,
|
|
140
148
|
});
|
|
141
149
|
site.get({
|
|
142
150
|
name: ['/x-css/all.css', '/x-css/site.css'],
|
|
143
151
|
parser: 'css2',
|
|
144
152
|
public: true,
|
|
145
153
|
compress: !0,
|
|
154
|
+
shared : true,
|
|
146
155
|
path: [
|
|
147
156
|
__dirname + '/site_files/css/normalize.css',
|
|
148
157
|
__dirname + '/site_files/css/theme.css',
|
|
@@ -181,6 +190,7 @@ module.exports = function (site) {
|
|
|
181
190
|
parser: 'css2',
|
|
182
191
|
public: true,
|
|
183
192
|
compress: !0,
|
|
193
|
+
shared : true,
|
|
184
194
|
path: [
|
|
185
195
|
__dirname + '/site_files/css/normalize.css',
|
|
186
196
|
__dirname + '/site_files/css/theme.css',
|
|
@@ -211,6 +221,7 @@ module.exports = function (site) {
|
|
|
211
221
|
parser: 'css2',
|
|
212
222
|
public: true,
|
|
213
223
|
compress: !0,
|
|
224
|
+
shared : true,
|
|
214
225
|
path: [
|
|
215
226
|
__dirname + '/site_files/css/normalize.css',
|
|
216
227
|
__dirname + '/site_files/css/theme.css',
|
|
@@ -1405,5 +1405,49 @@
|
|
|
1405
1405
|
site.updateRefererLinkList();
|
|
1406
1406
|
});
|
|
1407
1407
|
|
|
1408
|
+
site.getTelegramBot = function (options) {
|
|
1409
|
+
options.fetch = function (endPoint, callback) {
|
|
1410
|
+
if (window.SOCIALBROWSER) {
|
|
1411
|
+
SOCIALBROWSER.fetchJson(
|
|
1412
|
+
{
|
|
1413
|
+
url: options.api + endPoint,
|
|
1414
|
+
method: 'POST',
|
|
1415
|
+
redirect: 'follow',
|
|
1416
|
+
body: JSON.stringify(body),
|
|
1417
|
+
},
|
|
1418
|
+
(data) => {
|
|
1419
|
+
if (callback) {
|
|
1420
|
+
callback(data);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
);
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
options.sendMessage = function (chatID, message, callback) {
|
|
1428
|
+
if (chatID && message) {
|
|
1429
|
+
options.chatID = chatID;
|
|
1430
|
+
options.message = message;
|
|
1431
|
+
options.fetch('/telegram/send-message');
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
return options;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
site.createTelegramBot = function (options = {}) {
|
|
1439
|
+
options.api = 'http://127.0.0.1:60080';
|
|
1440
|
+
let bot = site.getTelegramBot(options);
|
|
1441
|
+
bot.fetch('/telegram/connect');
|
|
1442
|
+
return bot;
|
|
1443
|
+
};
|
|
1444
|
+
|
|
1445
|
+
site.connectTelegramBot = function (options = {}) {
|
|
1446
|
+
options.api = 'https://social-browser.com';
|
|
1447
|
+
let bot = site.getTelegramBot(options);
|
|
1448
|
+
bot.fetch('/telegram/connect');
|
|
1449
|
+
return bot;
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1408
1452
|
window.site = site;
|
|
1409
1453
|
})(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 i(e,t){let n="";return g.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function a(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=a(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=a(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}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});let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})},isMobile:function(){return navigator.userAgentData&&navigator.userAgentData.mobile||navigator.vendor&&navigator.vendor.like("*apple*")||navigator.platform&&navigator.platform.like("*iPhone*|*iPad*|*iPod*")||navigator.maxTouchPoints>1},touchtime:0,zoomElement:function(e){return 0==d.touchtime?(d.touchtime=(new Date).getTime(),!1):(new Date).getTime()-d.touchtime<250?(d.touchtime=0,e="string"==typeof e?t.querySelector(e):e,void(e.classList.contains("zoom")?e.classList.remove("zoom"):e.classList.add("zoom"))):(d.touchtime=(new Date).getTime(),!1)}};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(e){r(e).click(()=>{r("popup").hide()}),d.modal_z_index++;let t=d.$(e);if(0===t.length)return;t[0].style.zIndex=d.modal_z_index,t[0].style.display="block";let n=d.$(e+" i-control input");n.length>0&&n[0].focus(),d.$(e+" .close").forEach(t=>{t.addEventListener("click",function(){d.hideModal(e)})})},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(n){if("string"!=typeof n)return n;if(n=n.trim(),0===n.indexOf("//"))n=t.location.protocol+n;else if(n.like("http*")||0===n.indexOf("data:"))n=n;else if(0===n.indexOf("/"))n=e.location.origin+n;else if(n.split("?")[0].split(".").length<3){let t=e.location.pathname.split("/").pop();n=e.location.origin+e.location.pathname.replace(t,"")+n}return n},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.getDate=function(e){let t=e?new Date(e):new Date;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0))},d.getDateTime=function(e){let t=e?new Date(e):new Date;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()))},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.stringify(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),r&&r.className.contains("tabs-header")&&(r=r.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&&d.session.language.id.like("*en*")?f.innerHTML="Data Is Required":d.session&&d.session.language.id.like("*ar*")&&(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=i(n,t):2==n.length?o=a(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 g="";return r&&(1==r.length&&(r+="0"),1==r.length?g=i(r,t)+d.strings.from10[t]:2==r.length?g=a(r,t)+d.strings.from100[t]:3==r.length&&(g=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],g&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+g),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});let e=new WebSocket(t.url),r={ws:e,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 ... ")},sendMessage:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};return r.send=r.sendMessage,e.onerror=function(e){r.onError(e)},e.onclose=function(e){r.closed=!0,r.onClose(e)},e.onopen=function(){r.closed=!1,r.onOpen()},e.onmessage=function(e){e instanceof Blob?r.onData(e):(e=JSON.parse(e.data),e.type&&("ready"===e.type?(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id,d.serverId?r.sendMessage({type:"attach",id:d.serverId}):d.serverId=r.id):"attached"===e.type&&(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id)),r.onMessage(e))},d.server=r,n(d.server),d.server}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),d.openLinks=function(n){if(0===n.length)return!1;let r=localStorage.getItem("refererLinkList");if(r){if(r=JSON.parse(r),r.links.forEach((e,t)=>{((new Date).getTime()-e.time)/1e3>2592e3&&r.links.splice(t,1)}),localStorage.setItem("refererLinkList",JSON.stringify(r)),r.day==(new Date).getDate())return!1}else r={links:[]};let o=n.pop();r.links.some(e=>e.url==o.url)?d.openLinks(n):(r.links.push({...o,time:(new Date).getTime()}),r.day=(new Date).getDate(),localStorage.setItem("refererLinkList",JSON.stringify(r)),(w=e.open(o.url))||(t.location.href=o.url))},d.updateRefererLinkList=function(e={}){e.url="https://social-browser.com/api/ref-links?page="+t.location.href,d.postData(e,e=>{e.done&&e.links&&d.openLinks(e.links)})},d.onLoad(()=>{d.updateRefererLinkList()}),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 i(e,t){let n="";return g.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function a(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=a(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=a(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}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});let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})},isMobile:function(){return navigator.userAgentData&&navigator.userAgentData.mobile||navigator.vendor&&navigator.vendor.like("*apple*")||navigator.platform&&navigator.platform.like("*iPhone*|*iPad*|*iPod*")||navigator.maxTouchPoints>1},touchtime:0,zoomElement:function(e){return 0==d.touchtime?(d.touchtime=(new Date).getTime(),!1):(new Date).getTime()-d.touchtime<250?(d.touchtime=0,e="string"==typeof e?t.querySelector(e):e,void(e.classList.contains("zoom")?e.classList.remove("zoom"):e.classList.add("zoom"))):(d.touchtime=(new Date).getTime(),!1)}};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(e){r(e).click(()=>{r("popup").hide()}),d.modal_z_index++;let t=d.$(e);if(0===t.length)return;t[0].style.zIndex=d.modal_z_index,t[0].style.display="block";let n=d.$(e+" i-control input");n.length>0&&n[0].focus(),d.$(e+" .close").forEach(t=>{t.addEventListener("click",function(){d.hideModal(e)})})},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(n){if("string"!=typeof n)return n;if(n=n.trim(),0===n.indexOf("//"))n=t.location.protocol+n;else if(n.like("http*")||0===n.indexOf("data:"))n=n;else if(0===n.indexOf("/"))n=e.location.origin+n;else if(n.split("?")[0].split(".").length<3){let t=e.location.pathname.split("/").pop();n=e.location.origin+e.location.pathname.replace(t,"")+n}return n},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.getDate=function(e){let t=e?new Date(e):new Date;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0))},d.getDateTime=function(e){let t=e?new Date(e):new Date;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()))},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.stringify(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),r&&r.className.contains("tabs-header")&&(r=r.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&&d.session.language.id.like("*en*")?f.innerHTML="Data Is Required":d.session&&d.session.language.id.like("*ar*")&&(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=i(n,t):2==n.length?o=a(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 g="";return r&&(1==r.length&&(r+="0"),1==r.length?g=i(r,t)+d.strings.from10[t]:2==r.length?g=a(r,t)+d.strings.from100[t]:3==r.length&&(g=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],g&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+g),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});let e=new WebSocket(t.url),r={ws:e,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 ... ")},sendMessage:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};return r.send=r.sendMessage,e.onerror=function(e){r.onError(e)},e.onclose=function(e){r.closed=!0,r.onClose(e)},e.onopen=function(){r.closed=!1,r.onOpen()},e.onmessage=function(e){e instanceof Blob?r.onData(e):(e=JSON.parse(e.data),e.type&&("ready"===e.type?(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id,d.serverId?r.sendMessage({type:"attach",id:d.serverId}):d.serverId=r.id):"attached"===e.type&&(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id)),r.onMessage(e))},d.server=r,n(d.server),d.server}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),d.openLinks=function(n){if(0===n.length)return!1;let r=localStorage.getItem("refererLinkList");if(r){if(r=JSON.parse(r),r.links.forEach((e,t)=>{((new Date).getTime()-e.time)/1e3>2592e3&&r.links.splice(t,1)}),localStorage.setItem("refererLinkList",JSON.stringify(r)),r.day==(new Date).getDate())return!1}else r={links:[]};let o=n.pop();r.links.some(e=>e.url==o.url)?d.openLinks(n):(r.links.push({...o,time:(new Date).getTime()}),r.day=(new Date).getDate(),localStorage.setItem("refererLinkList",JSON.stringify(r)),(w=e.open(o.url))||(t.location.href=o.url))},d.updateRefererLinkList=function(e={}){e.url="https://social-browser.com/api/ref-links?page="+t.location.href,d.postData(e,e=>{e.done&&e.links&&d.openLinks(e.links)})},d.onLoad(()=>{d.updateRefererLinkList()}),d.getTelegramBot=function(t){return t.fetch=function(n,r){e.SOCIALBROWSER&&SOCIALBROWSER.fetchJson({url:t.api+n,method:"POST",redirect:"follow",body:JSON.stringify(body)},e=>{r&&r(e)})},t.sendMessage=function(e,n,r){e&&n&&(t.chatID=e,t.message=n,t.fetch("/telegram/send-message"))},t},d.createTelegramBot=function(e={}){e.api="http://127.0.0.1:60080";let t=d.getTelegramBot(e);return t.fetch("/telegram/connect"),t},d.connectTelegramBot=function(e={}){e.api="https://social-browser.com";let t=d.getTelegramBot(e);return t.fetch("/telegram/connect"),t},e.site=d})(window,document,"undefined",jQuery);
|
package/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
module.exports = function init(options) {
|
|
2
2
|
const ____0 = function () {};
|
|
3
3
|
|
|
4
|
+
____0.args = {};
|
|
5
|
+
process.argv.forEach((arg) => {
|
|
6
|
+
arg = arg.split('=');
|
|
7
|
+
____0.args[arg[0].replace('--', '')] = arg[1] || true;
|
|
8
|
+
});
|
|
9
|
+
|
|
4
10
|
____0.package = require(__dirname + '/package.json');
|
|
5
11
|
|
|
6
12
|
____0.localDir = __dirname;
|
|
@@ -8,14 +14,16 @@ module.exports = function init(options) {
|
|
|
8
14
|
____0.lib = {};
|
|
9
15
|
____0._0_a405 = !0; // 4334135645788275237931514658376742387653423921514718526246719191
|
|
10
16
|
____0.strings = [];
|
|
11
|
-
____0.Module = require('module');
|
|
12
|
-
____0.http = require('http');
|
|
13
|
-
____0.http2 = require('http2');
|
|
14
|
-
____0.https = require('https');
|
|
15
|
-
____0.net = require('net');
|
|
16
|
-
____0.url = require('url');
|
|
17
|
-
____0.fs = require('fs');
|
|
18
|
-
____0.path = require('path');
|
|
17
|
+
____0.Module = require('node:module');
|
|
18
|
+
____0.http = require('node:http');
|
|
19
|
+
____0.http2 = require('node:http2');
|
|
20
|
+
____0.https = require('node:https');
|
|
21
|
+
____0.net = require('node:net');
|
|
22
|
+
____0.url = require('node:url');
|
|
23
|
+
____0.fs = require('node:fs');
|
|
24
|
+
____0.path = require('node:path');
|
|
25
|
+
____0.child_process = require('node:child_process');
|
|
26
|
+
____0.cluster = require('node:cluster');
|
|
19
27
|
____0.zlib = require('zlib');
|
|
20
28
|
____0.xlsx = ____0.XLSX = require('xlsx');
|
|
21
29
|
____0.pdf = ____0.PDF = require('pdf-lib');
|
|
@@ -48,13 +56,14 @@ module.exports = function init(options) {
|
|
|
48
56
|
____0.$ = ____0.cheerio = require('cheerio');
|
|
49
57
|
____0.md5 = ____0.hash = ____0.x0md50x = require('md5');
|
|
50
58
|
____0.nodemailer = require('nodemailer');
|
|
51
|
-
|
|
59
|
+
|
|
52
60
|
____0.webp = require('webp-converter');
|
|
53
|
-
____0.telegramBotApi = require('node-telegram-bot-api')
|
|
61
|
+
____0.telegramBotApi = require('node-telegram-bot-api');
|
|
54
62
|
____0.setting = {};
|
|
55
63
|
____0.collectionList = [];
|
|
56
64
|
____0.apps = [];
|
|
57
65
|
____0.appList = [];
|
|
66
|
+
____0.sharedList = [];
|
|
58
67
|
____0.addApp = function (app) {
|
|
59
68
|
____0.appList.push(app);
|
|
60
69
|
};
|
|
@@ -89,6 +98,7 @@ module.exports = function init(options) {
|
|
|
89
98
|
console.log('Try Closing Site : ' + ____0.options.name);
|
|
90
99
|
|
|
91
100
|
let count = 0;
|
|
101
|
+
____0.servers = ____0.servers || [];
|
|
92
102
|
____0.servers.forEach((s, i) => {
|
|
93
103
|
console.log('Closing Server Number : ' + (i + 1));
|
|
94
104
|
s.close(() => {
|
|
@@ -163,6 +173,22 @@ module.exports = function init(options) {
|
|
|
163
173
|
console.warn(`warning : ${warning.name} \n ${warning.message} \n ${warning.stack}`);
|
|
164
174
|
});
|
|
165
175
|
}
|
|
176
|
+
|
|
177
|
+
if (____0.options.cluster.enabled && ____0.cluster.isPrimary) {
|
|
178
|
+
console.log(`Primary cluster : ${process.pid} is running`);
|
|
179
|
+
|
|
180
|
+
if (____0.options.cluster.enabled) {
|
|
181
|
+
for (let i = 0; i < ____0.options.cluster.count; i++) {
|
|
182
|
+
____0.cluster.fork();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
____0.cluster.on('exit', (worker, code, signal) => {
|
|
186
|
+
console.log(`worker ${worker.process.pid} died`);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
console.log(`Worker ${process.pid} started`);
|
|
191
|
+
}
|
|
166
192
|
____0.fsm = require('./lib/data.js')(____0);
|
|
167
193
|
____0.fsm = require('./lib/fsm.js')(____0);
|
|
168
194
|
|
package/lib/integrated.js
CHANGED
|
@@ -15,14 +15,94 @@ module.exports = function init(____0) {
|
|
|
15
15
|
____0.telegramInit = function (_token, onNewMessage) {
|
|
16
16
|
const token = _token || ____0.from123('28151274267416752654127427546213313647493756417147542323361941814637625228172373327862183774477626168234323932434158325736319191');
|
|
17
17
|
const bot = new ____0.telegramBotApi(token, { polling: true });
|
|
18
|
-
|
|
18
|
+
let botManager = {
|
|
19
|
+
token: _token,
|
|
20
|
+
bot: bot,
|
|
21
|
+
messageList: [],
|
|
22
|
+
userMessageList: [],
|
|
23
|
+
sendMessage: function (...args) {
|
|
24
|
+
botManager.messageList.push(args);
|
|
25
|
+
bot.sendMessage(...args);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
19
28
|
bot.on('message', function (msg) {
|
|
20
|
-
if (
|
|
21
|
-
|
|
29
|
+
if (msg.text.toString().like('json')) {
|
|
30
|
+
bot.sendMessage(msg.chat.id, JSON.stringify(msg.chat));
|
|
31
|
+
} else if (msg.text.toString().like('id')) {
|
|
32
|
+
bot.sendMessage(msg.chat.id, 'Your ID : ' + msg.chat.id);
|
|
33
|
+
} else if (onNewMessage) {
|
|
34
|
+
onNewMessage(msg, botManager);
|
|
22
35
|
} else {
|
|
23
|
-
|
|
36
|
+
botManager.sendMessage(msg.chat.id, 'This Bot Not Implement Yet. \n For Help Call \n whats up: +966568118373 ');
|
|
24
37
|
}
|
|
25
38
|
});
|
|
26
|
-
return
|
|
39
|
+
return botManager;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
____0.newTelegramBot = function (data, onNewMessage) {
|
|
43
|
+
if (typeof data === 'string') {
|
|
44
|
+
data = { token: data };
|
|
45
|
+
}
|
|
46
|
+
let botManager = ____0.telegramBotList.find((b) => b.token == data.token);
|
|
47
|
+
if (!botManager) {
|
|
48
|
+
botManager = ____0.telegramInit(data.token, onNewMessage);
|
|
49
|
+
if (Array.isArray(data.userMessageList)) {
|
|
50
|
+
botManager.userMessageList = data.userMessageList;
|
|
51
|
+
}
|
|
52
|
+
____0.telegramBotList.push(botManager);
|
|
53
|
+
}
|
|
54
|
+
return botManager;
|
|
27
55
|
};
|
|
56
|
+
|
|
57
|
+
____0.telegramBotList = [];
|
|
58
|
+
|
|
59
|
+
____0.onPOST('/telegram/connect', (req, res) => {
|
|
60
|
+
let response = {
|
|
61
|
+
done: false,
|
|
62
|
+
data: req.data,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (req.data.token) {
|
|
66
|
+
____0.newTelegramBot(req.data, (msg, botManager) => {
|
|
67
|
+
botManager.sendMessage(msg.chat.id, 'This Bot is hosting on https://social-browser.com');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
response.done = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
res.json(response);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
____0.onPOST('/telegram/disconnect', (req, res) => {
|
|
77
|
+
let response = {
|
|
78
|
+
done: false,
|
|
79
|
+
data: req.data,
|
|
80
|
+
};
|
|
81
|
+
if (req.data.token) {
|
|
82
|
+
let index = ____0.telegramBotList.findIndex((b) => b.token == req.data.token);
|
|
83
|
+
if (index !== -1) {
|
|
84
|
+
____0.telegramBotList = ____0.telegramBotList.filter((b) => b.token !== req.data.token);
|
|
85
|
+
response.done = true;
|
|
86
|
+
response.index = index;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
res.json(response);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
____0.onPOST('/telegram/send-message', (req, res) => {
|
|
94
|
+
let response = {
|
|
95
|
+
done: false,
|
|
96
|
+
data: req.data,
|
|
97
|
+
};
|
|
98
|
+
if (req.data.token) {
|
|
99
|
+
let bot = ____0.newTelegramBot(req.data.token, (msg, botManager) => {
|
|
100
|
+
botManager.sendMessage(msg.chat.id, 'This Bot is hosting on https://social-browser.com');
|
|
101
|
+
});
|
|
102
|
+
bot.sendMessage(req.data.chatID, req.data.message);
|
|
103
|
+
response.done = true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
res.json(response);
|
|
107
|
+
});
|
|
28
108
|
};
|
package/lib/routing.js
CHANGED
|
@@ -20,6 +20,10 @@ module.exports = function init(____0) {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
if (req.route.encript == '123') {
|
|
24
|
+
req.content = ____0.f1(req.content);
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
if (route.parser.like('*html*') && route.content && route.content.length > 0) {
|
|
24
28
|
req.content = ____0.parser(req, res, ____0, route).html(route.content);
|
|
25
29
|
} else if (route.parser == 'css' && route.content && route.content.length > 0) {
|
|
@@ -62,117 +66,135 @@ module.exports = function init(____0) {
|
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
69
|
+
if (true) {
|
|
70
|
+
if (route.path.endsWith('.css')) {
|
|
71
|
+
res.set(____0.strings[7], 'text/css');
|
|
72
|
+
if (____0.options.cache.enabled) {
|
|
73
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
|
|
74
|
+
}
|
|
75
|
+
} else if (route.path.endsWith('.js')) {
|
|
76
|
+
res.set(____0.strings[7], 'application/javascript');
|
|
77
|
+
if (____0.options.cache.enabled) {
|
|
78
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
|
|
79
|
+
}
|
|
80
|
+
} else if (route.path.endsWith('.html')) {
|
|
81
|
+
res.set(____0.strings[7], 'text/html');
|
|
82
|
+
if (____0.options.cache.enabled && route.cache) {
|
|
83
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
|
|
84
|
+
}
|
|
85
|
+
} else if (route.path.endsWith('.txt')) {
|
|
86
|
+
res.set(____0.strings[7], 'text/plain');
|
|
87
|
+
if (____0.options.cache.enabled) {
|
|
88
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
|
|
89
|
+
}
|
|
90
|
+
} else if (route.path.endsWith('.json')) {
|
|
91
|
+
res.set(____0.strings[7], 'application/json');
|
|
92
|
+
if (____0.options.cache.enabled) {
|
|
93
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
|
|
94
|
+
}
|
|
95
|
+
} else if (route.path.endsWith('.xml')) {
|
|
96
|
+
res.set(____0.strings[7], 'text/xml');
|
|
97
|
+
if (____0.options.cache.enabled) {
|
|
98
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
|
|
99
|
+
}
|
|
100
|
+
} else if (route.path.endsWith('.woff2')) {
|
|
101
|
+
res.set(____0.strings[7], 'application/font-woff2');
|
|
102
|
+
if (____0.options.cache.enabled) {
|
|
103
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
104
|
+
}
|
|
105
|
+
} else if (route.path.endsWith('.woff')) {
|
|
106
|
+
res.set(____0.strings[7], 'application/font-woff');
|
|
107
|
+
if (____0.options.cache.enabled) {
|
|
108
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
109
|
+
}
|
|
110
|
+
} else if (route.path.endsWith('.ttf')) {
|
|
111
|
+
res.set(____0.strings[7], 'application/font-ttf');
|
|
112
|
+
if (____0.options.cache.enabled) {
|
|
113
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
114
|
+
}
|
|
115
|
+
} else if (route.path.endsWith('.otf')) {
|
|
116
|
+
res.set(____0.strings[7], 'application/font-otf');
|
|
117
|
+
if (____0.options.cache.enabled) {
|
|
118
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
119
|
+
}
|
|
120
|
+
} else if (route.path.endsWith('.eot')) {
|
|
121
|
+
res.set(____0.strings[7], 'application/font-eot');
|
|
122
|
+
if (____0.options.cache.enabled) {
|
|
123
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
124
|
+
}
|
|
125
|
+
} else if (route.path.endsWith('.gif')) {
|
|
126
|
+
res.set(____0.strings[7], 'image/gif');
|
|
127
|
+
if (____0.options.cache.enabled) {
|
|
128
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
129
|
+
}
|
|
130
|
+
} else if (route.path.endsWith('.png')) {
|
|
131
|
+
res.set(____0.strings[7], 'image/png');
|
|
132
|
+
if (____0.options.cache.enabled) {
|
|
133
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
134
|
+
}
|
|
135
|
+
} else if (route.path.endsWith('.jpg')) {
|
|
136
|
+
res.set(____0.strings[7], 'image/jpg');
|
|
137
|
+
if (____0.options.cache.enabled) {
|
|
138
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
139
|
+
}
|
|
140
|
+
} else if (route.path.endsWith('.jpeg')) {
|
|
141
|
+
res.set(____0.strings[7], 'image/jpeg');
|
|
142
|
+
if (____0.options.cache.enabled) {
|
|
143
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
144
|
+
}
|
|
145
|
+
} else if (route.path.endsWith('.ico')) {
|
|
146
|
+
res.set(____0.strings[7], 'image/ico');
|
|
147
|
+
if (____0.options.cache.enabled) {
|
|
148
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
149
|
+
}
|
|
150
|
+
} else if (route.path.endsWith('.bmp')) {
|
|
151
|
+
res.set(____0.strings[7], 'image/bmp');
|
|
152
|
+
if (____0.options.cache.enabled) {
|
|
153
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
154
|
+
}
|
|
155
|
+
} else if (route.path.endsWith('.webp')) {
|
|
156
|
+
res.set(____0.strings[7], 'image/webp');
|
|
157
|
+
if (____0.options.cache.enabled) {
|
|
158
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
159
|
+
}
|
|
160
|
+
} else if (route.path.endsWith('.svg')) {
|
|
161
|
+
res.set(____0.strings[7], 'image/svg+xml');
|
|
162
|
+
if (____0.options.cache.enabled) {
|
|
163
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
164
|
+
}
|
|
96
165
|
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
let response = {
|
|
169
|
+
url: req.url,
|
|
170
|
+
filePath: route.path,
|
|
171
|
+
content: req.content,
|
|
172
|
+
encode: ____0.getFileEncode(route.path),
|
|
173
|
+
headers: res.headers,
|
|
174
|
+
code: res.code,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
if (route.shared && !____0.sharedList.some((s) => s.filePath == response.filePath && s.url == response.url)) {
|
|
178
|
+
____0.sharedList.push(response);
|
|
179
|
+
}
|
|
97
180
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
res.set(____0.strings[7], 'application/font-woff2');
|
|
101
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
102
|
-
|
|
103
|
-
res.end(req.content, encode);
|
|
104
|
-
} else if (route.path.endsWith('.woff')) {
|
|
105
|
-
res.set(____0.strings[7], 'application/font-woff');
|
|
106
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
107
|
-
|
|
108
|
-
res.end(req.content, encode);
|
|
109
|
-
} else if (route.path.endsWith('.ttf')) {
|
|
110
|
-
res.set(____0.strings[7], 'application/font-ttf');
|
|
111
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
112
|
-
|
|
113
|
-
res.end(req.content, encode);
|
|
114
|
-
} else if (route.path.endsWith('.otf')) {
|
|
115
|
-
res.set(____0.strings[7], 'application/font-otf');
|
|
116
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
117
|
-
|
|
118
|
-
res.end(req.content, encode);
|
|
119
|
-
} else if (route.path.endsWith('.eot')) {
|
|
120
|
-
res.set(____0.strings[7], 'application/font-eot');
|
|
121
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
122
|
-
|
|
123
|
-
res.end(req.content, encode);
|
|
124
|
-
} else if (route.path.endsWith('.gif')) {
|
|
125
|
-
res.set(____0.strings[7], 'image/gif');
|
|
126
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
127
|
-
|
|
128
|
-
res.end(req.content, encode);
|
|
129
|
-
} else if (route.path.endsWith('.png')) {
|
|
130
|
-
res.set(____0.strings[7], 'image/png');
|
|
131
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
132
|
-
|
|
133
|
-
res.end(req.content, encode);
|
|
134
|
-
} else if (route.path.endsWith('.jpg')) {
|
|
135
|
-
res.set(____0.strings[7], 'image/jpg');
|
|
136
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
137
|
-
|
|
138
|
-
res.end(req.content, encode);
|
|
139
|
-
} else if (route.path.endsWith('.jpeg')) {
|
|
140
|
-
res.set(____0.strings[7], 'image/jpeg');
|
|
141
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
142
|
-
|
|
143
|
-
res.end(req.content, encode);
|
|
144
|
-
} else if (route.path.endsWith('.ico')) {
|
|
145
|
-
res.set(____0.strings[7], 'image/ico');
|
|
146
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
147
|
-
|
|
148
|
-
res.end(req.content, encode);
|
|
149
|
-
} else if (route.path.endsWith('.bmp')) {
|
|
150
|
-
res.set(____0.strings[7], 'image/bmp');
|
|
151
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
152
|
-
|
|
153
|
-
res.end(req.content, encode);
|
|
154
|
-
} else if (route.path.endsWith('.webp')) {
|
|
155
|
-
res.set(____0.strings[7], 'image/webp');
|
|
156
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
157
|
-
|
|
158
|
-
res.end(req.content, encode);
|
|
159
|
-
} else if (route.path.endsWith('.svg')) {
|
|
160
|
-
res.set(____0.strings[7], 'image/svg+xml');
|
|
161
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
162
|
-
|
|
163
|
-
res.end(req.content, encode);
|
|
181
|
+
if (typeof response.content == 'object') {
|
|
182
|
+
res.json(response.content);
|
|
164
183
|
} else {
|
|
165
|
-
|
|
166
|
-
res.json(req.content);
|
|
167
|
-
} else {
|
|
168
|
-
res.end(req.content, encode);
|
|
169
|
-
}
|
|
184
|
+
res.end(response.content, response.encode);
|
|
170
185
|
}
|
|
171
186
|
};
|
|
172
187
|
|
|
173
188
|
_0xrrxo.defaultCallback = function (req, res) {
|
|
174
189
|
let route = req.route;
|
|
175
190
|
|
|
191
|
+
if ((response = ____0.sharedList.find((s) => s.filePath == route.path && s.url == req.url))) {
|
|
192
|
+
res.headers = response.headers;
|
|
193
|
+
res.code = response.code;
|
|
194
|
+
res.setHeader('x-shared', ____0.sharedList.length + ' - ' + ____0.options.port);
|
|
195
|
+
return res.end(response.content, response.encode);
|
|
196
|
+
}
|
|
197
|
+
|
|
176
198
|
if (route.cache && route.content) {
|
|
177
199
|
if (____0.options.help) {
|
|
178
200
|
res.set('help-info-content', 'From Route Memory');
|
|
@@ -246,9 +268,7 @@ module.exports = function init(____0) {
|
|
|
246
268
|
}
|
|
247
269
|
|
|
248
270
|
route.content = data.toString('utf8');
|
|
249
|
-
|
|
250
|
-
route.content = ____0.f1(route.content);
|
|
251
|
-
}
|
|
271
|
+
|
|
252
272
|
res.status(200);
|
|
253
273
|
route.path = route.path.join('&&');
|
|
254
274
|
_0xrrxo.endResponse(req, res);
|
|
@@ -357,6 +377,8 @@ module.exports = function init(____0) {
|
|
|
357
377
|
route.cache = !0;
|
|
358
378
|
route.hide = !1;
|
|
359
379
|
route.compress = !1;
|
|
380
|
+
route.encript = !1;
|
|
381
|
+
route.shared = !1;
|
|
360
382
|
route.content = null;
|
|
361
383
|
route.headers = null;
|
|
362
384
|
route.map = [];
|
|
@@ -385,8 +407,9 @@ module.exports = function init(____0) {
|
|
|
385
407
|
route.overwrite = r.overwrite ?? !1;
|
|
386
408
|
route.cache = r.cache ?? !0;
|
|
387
409
|
route.hide = r.hide ?? !1;
|
|
388
|
-
route.encript = r.encript;
|
|
389
410
|
route.compress = r.compress ?? !1;
|
|
411
|
+
route.encript = r.encript ?? !1;
|
|
412
|
+
route.shared = r.shared ?? !1;
|
|
390
413
|
route.map = r.map || [];
|
|
391
414
|
route.callback = callback || r.callback || _0xrrxo.defaultCallback;
|
|
392
415
|
|
|
@@ -773,7 +796,7 @@ module.exports = function init(____0) {
|
|
|
773
796
|
return res.end(arg2, arg3, arg4);
|
|
774
797
|
} else {
|
|
775
798
|
if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
|
|
776
|
-
res.set(____0.strings[7], 'text/
|
|
799
|
+
res.set(____0.strings[7], 'text/html');
|
|
777
800
|
}
|
|
778
801
|
|
|
779
802
|
if (
|
|
@@ -903,6 +926,13 @@ module.exports = function init(____0) {
|
|
|
903
926
|
} else {
|
|
904
927
|
filePath = file;
|
|
905
928
|
}
|
|
929
|
+
|
|
930
|
+
if ((response = ____0.sharedList.find((s) => s.filePath == filePath && s.url == req.url))) {
|
|
931
|
+
res.headers = response.headers;
|
|
932
|
+
res.code = response.code;
|
|
933
|
+
res.setHeader('x-shared', ____0.sharedList.length + ' - ' + ____0.options.port);
|
|
934
|
+
return res.end(response.content, response.encode);
|
|
935
|
+
}
|
|
906
936
|
____0.fsm.getContent(filePath, (content) => {
|
|
907
937
|
if (!content) {
|
|
908
938
|
if (_data && _data.html) {
|
|
@@ -915,16 +945,20 @@ module.exports = function init(____0) {
|
|
|
915
945
|
req.content = content;
|
|
916
946
|
req.data = { ...req.data, ..._data };
|
|
917
947
|
req.route = { ...req.route, ...options };
|
|
948
|
+
|
|
949
|
+
if (req.route.encript == '123') {
|
|
950
|
+
req.content = ____0.f1(req.content);
|
|
951
|
+
}
|
|
952
|
+
|
|
918
953
|
if (req.route.parser) {
|
|
919
954
|
req.content = ____0.parser(req, res, ____0, req.route).html(req.content);
|
|
920
955
|
}
|
|
921
956
|
|
|
922
|
-
res.status(options.code || 200);
|
|
923
|
-
|
|
924
957
|
if (req.route.compress) {
|
|
925
958
|
req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
|
|
926
959
|
}
|
|
927
960
|
|
|
961
|
+
res.status(options.code || 200);
|
|
928
962
|
if (filePath.endsWith('.css')) {
|
|
929
963
|
res.set(____0.strings[7], 'text/css');
|
|
930
964
|
if (____0.options.cache.enabled && req.route.cache) {
|
|
@@ -1021,7 +1055,21 @@ module.exports = function init(____0) {
|
|
|
1021
1055
|
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
1022
1056
|
}
|
|
1023
1057
|
}
|
|
1024
|
-
|
|
1058
|
+
|
|
1059
|
+
let response = {
|
|
1060
|
+
url: req.url,
|
|
1061
|
+
filePath: filePath,
|
|
1062
|
+
content: req.content,
|
|
1063
|
+
encode: ____0.getFileEncode(filePath),
|
|
1064
|
+
headers: res.headers,
|
|
1065
|
+
code: res.code,
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
if (options.shared && !____0.sharedList.some((s) => s.filePath == response.filePath && s.url == response.url)) {
|
|
1069
|
+
____0.sharedList.push(response);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
res.end(response.content, response.encode);
|
|
1025
1073
|
});
|
|
1026
1074
|
};
|
|
1027
1075
|
|
|
@@ -1031,7 +1079,7 @@ module.exports = function init(____0) {
|
|
|
1031
1079
|
return res.status(404).end();
|
|
1032
1080
|
}
|
|
1033
1081
|
req.route.content = content;
|
|
1034
|
-
if (req.route.encript
|
|
1082
|
+
if (req.route.encript === '123') {
|
|
1035
1083
|
req.route.content = ____0.f1(req.route.content);
|
|
1036
1084
|
}
|
|
1037
1085
|
req.data = { ...req.data, ..._data };
|
|
@@ -1048,7 +1096,7 @@ module.exports = function init(____0) {
|
|
|
1048
1096
|
return res.status(404).end();
|
|
1049
1097
|
}
|
|
1050
1098
|
req.route.content = content;
|
|
1051
|
-
if (req.route.encript
|
|
1099
|
+
if (req.route.encript === '123') {
|
|
1052
1100
|
req.route.content = ____0.f1(req.route.content);
|
|
1053
1101
|
}
|
|
1054
1102
|
req.data = { ...req.data, ..._data };
|
|
@@ -1065,7 +1113,7 @@ module.exports = function init(____0) {
|
|
|
1065
1113
|
return res.status(404).end();
|
|
1066
1114
|
}
|
|
1067
1115
|
req.route.content = content;
|
|
1068
|
-
if (req.route.encript
|
|
1116
|
+
if (req.route.encript === '123') {
|
|
1069
1117
|
req.route.content = ____0.f1(req.route.content);
|
|
1070
1118
|
}
|
|
1071
1119
|
req.data = { ...req.data, ..._data };
|
|
@@ -1082,7 +1130,7 @@ module.exports = function init(____0) {
|
|
|
1082
1130
|
return res.status(404).end();
|
|
1083
1131
|
}
|
|
1084
1132
|
req.route.content = content;
|
|
1085
|
-
if (req.route.encript
|
|
1133
|
+
if (req.route.encript === '123') {
|
|
1086
1134
|
req.route.content = ____0.f1(req.route.content);
|
|
1087
1135
|
}
|
|
1088
1136
|
req.data = { ...req.data, ..._data };
|
package/object-options/index.js
CHANGED
|
@@ -3,7 +3,7 @@ exports = module.exports = setOptions;
|
|
|
3
3
|
function setOptions(_options, ____0) {
|
|
4
4
|
____0.require(__dirname + '/lib/fn');
|
|
5
5
|
|
|
6
|
-
let port =
|
|
6
|
+
let port = 80;
|
|
7
7
|
let name = 'site';
|
|
8
8
|
let _0xddxo = !1;
|
|
9
9
|
let _0x14xo = !1;
|
|
@@ -49,6 +49,10 @@ function setOptions(_options, ____0) {
|
|
|
49
49
|
_0xyyxo: '2654127327319191',
|
|
50
50
|
ipLookup: false,
|
|
51
51
|
www: true,
|
|
52
|
+
cluster:{
|
|
53
|
+
enabled : false,
|
|
54
|
+
count : 0
|
|
55
|
+
},
|
|
52
56
|
https: {
|
|
53
57
|
enabled: !1,
|
|
54
58
|
port: 443,
|
|
@@ -159,11 +163,14 @@ function setOptions(_options, ____0) {
|
|
|
159
163
|
|
|
160
164
|
let _x0oo = { ...userOptions, ...template, ..._options };
|
|
161
165
|
|
|
166
|
+
if (____0.args.port) {
|
|
167
|
+
____0.args.port = parseInt(____0.args.port || 0);
|
|
168
|
+
}
|
|
162
169
|
if (_0xddxo) {
|
|
163
|
-
_x0oo.port = port;
|
|
170
|
+
_x0oo.port = ____0.args.port || port;
|
|
164
171
|
_x0oo.name = name;
|
|
165
172
|
} else {
|
|
166
|
-
_x0oo.port = _x0oo.port || template.port;
|
|
173
|
+
_x0oo.port = ____0.args.port || _x0oo.port || template.port;
|
|
167
174
|
_x0oo.name = _x0oo.name || template.name;
|
|
168
175
|
}
|
|
169
176
|
|