isite 2023.8.11 → 2023.9.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/client-side/site_files/css/bootstrap5-addon.css +9 -3
- package/apps/client-side/site_files/html/directive/i-list.html +1 -1
- package/apps/client-side/site_files/js/app.js +4 -0
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +10 -4
- package/apps/client-side/site_files/js/site.js +58 -4
- package/index.js +17 -0
- package/lib/parser.js +41 -36
- package/lib/routing.js +30 -11
- package/lib/security.js +3 -48
- package/lib/session.js +2 -1
- package/object-options/index.js +2 -0
- package/package.json +1 -1
|
@@ -151,16 +151,22 @@ i-datetime input {
|
|
|
151
151
|
|
|
152
152
|
.modal-content {
|
|
153
153
|
width: 75vw;
|
|
154
|
-
height:
|
|
154
|
+
height: auto;
|
|
155
|
+
max-height: 100vh;
|
|
156
|
+
}
|
|
157
|
+
.modal-content:has(i-list) {
|
|
158
|
+
min-height: 75vh;
|
|
155
159
|
}
|
|
156
160
|
.full .modal-content {
|
|
157
161
|
width: 95vw;
|
|
158
|
-
height:
|
|
162
|
+
height: auto;
|
|
163
|
+
max-height: 100vh;
|
|
159
164
|
}
|
|
160
165
|
.modal-body {
|
|
161
166
|
padding: 1rem;
|
|
162
167
|
display: block;
|
|
163
|
-
overflow:
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
overflow-y: auto;
|
|
164
170
|
}
|
|
165
171
|
.modal-footer {
|
|
166
172
|
display: block;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div class="row center padding pointer">
|
|
17
|
-
<a class="btn red" ng-click="updateModel(
|
|
17
|
+
<a class="btn red" ng-click="updateModel(null)"> <i class="fa fa-trash"></i> Clear </a>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
@@ -3,6 +3,10 @@ app.config(function ($sceDelegateProvider) {
|
|
|
3
3
|
$sceDelegateProvider.resourceUrlWhitelist(['self', 'https://www.youtube.com/**']);
|
|
4
4
|
});
|
|
5
5
|
|
|
6
|
+
app.config(function ($sceProvider) {
|
|
7
|
+
$sceProvider.enabled(false);
|
|
8
|
+
});
|
|
9
|
+
|
|
6
10
|
site.connectScope = app.connectScope = function (_scope, callback) {
|
|
7
11
|
if (!_scope) {
|
|
8
12
|
_scope = {};
|
|
@@ -465,12 +465,18 @@ app.directive('iList', [
|
|
|
465
465
|
});
|
|
466
466
|
|
|
467
467
|
$scope.updateModel = function (item) {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
468
|
+
if (item) {
|
|
469
|
+
$scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
|
|
470
|
+
if ($scope.display2) {
|
|
471
|
+
input.val($scope.getNgModelValue($scope.ngModel) + $scope.space + $scope.getNgModelValue2($scope.ngModel));
|
|
472
|
+
} else {
|
|
473
|
+
input.val($scope.getNgModelValue($scope.ngModel));
|
|
474
|
+
}
|
|
471
475
|
} else {
|
|
472
|
-
|
|
476
|
+
$scope.ngModel = null;
|
|
477
|
+
input.val('');
|
|
473
478
|
}
|
|
479
|
+
|
|
474
480
|
$timeout(() => {
|
|
475
481
|
if ($scope.ngChange) {
|
|
476
482
|
$scope.ngChange();
|
|
@@ -115,9 +115,6 @@
|
|
|
115
115
|
localStorage.setItem('zoomNumber', site.zoomNumber.toString());
|
|
116
116
|
document.body.style.zoom = site.zoomNumber + '%';
|
|
117
117
|
};
|
|
118
|
-
site.onLoad(() => {
|
|
119
|
-
site.zoom('0');
|
|
120
|
-
});
|
|
121
118
|
|
|
122
119
|
site.printerList = [];
|
|
123
120
|
site.getPrinters = function () {
|
|
@@ -366,7 +363,7 @@
|
|
|
366
363
|
op.mode = 'cors';
|
|
367
364
|
op.url = site.handle_url(op.url);
|
|
368
365
|
|
|
369
|
-
if (
|
|
366
|
+
if (window.SOCIALBROWSER && window.SOCIALBROWSER.fetchJson) {
|
|
370
367
|
SOCIALBROWSER.fetchJson(op, (data) => {
|
|
371
368
|
callback(data);
|
|
372
369
|
});
|
|
@@ -1299,5 +1296,62 @@
|
|
|
1299
1296
|
XLSX.writeFile(excelFile, (data.id || data.tagName) + '.' + type);
|
|
1300
1297
|
};
|
|
1301
1298
|
|
|
1299
|
+
site.isSPA = false;
|
|
1300
|
+
site.routeContainer = '[router]';
|
|
1301
|
+
site.routeList = [];
|
|
1302
|
+
site.getRoute = (name) => {
|
|
1303
|
+
return site.routeList.find((r) => r.name == name) || { name: name, url: name };
|
|
1304
|
+
};
|
|
1305
|
+
site.route = (event) => {
|
|
1306
|
+
event.preventDefault();
|
|
1307
|
+
site.setRoute(site.getRoute(event.target.href));
|
|
1308
|
+
};
|
|
1309
|
+
site.setRoute = function (route) {
|
|
1310
|
+
if (typeof route === 'string') {
|
|
1311
|
+
route = site.getRoute(route);
|
|
1312
|
+
}
|
|
1313
|
+
window.history.pushState({}, '', route.name);
|
|
1314
|
+
};
|
|
1315
|
+
site.getRouteContent = async (route) => {
|
|
1316
|
+
if (typeof route === 'string') {
|
|
1317
|
+
route = site.getRoute(route);
|
|
1318
|
+
}
|
|
1319
|
+
return await fetch(route.url).then((data) => data.text());
|
|
1320
|
+
};
|
|
1321
|
+
site.showRouteContent = function (selector, route) {
|
|
1322
|
+
if (typeof route === 'string') {
|
|
1323
|
+
route = site.getRoute(route);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
site.setRoute(route.name);
|
|
1327
|
+
site.getRouteContent(route.url).then((html) => {
|
|
1328
|
+
document.querySelector(selector).innerHTML = html;
|
|
1329
|
+
});
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
document.addEventListener('click', (e) => {
|
|
1333
|
+
if (!site.isSPA) {
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
if (e.target.hasAttribute('route')) {
|
|
1337
|
+
e.preventDefault();
|
|
1338
|
+
let route = e.target.getAttribute('route') || e.target.getAttribute('href');
|
|
1339
|
+
site.showRouteContent(site.routeContainer, route);
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
window.addEventListener('hashchange', (e) => {
|
|
1343
|
+
if (!site.isSPA) {
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
let route = window.location.hash.replace('#', '');
|
|
1347
|
+
if (!route) {
|
|
1348
|
+
route = '/';
|
|
1349
|
+
}
|
|
1350
|
+
site.showRouteContent(site.routeContainer, route);
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
if (document.querySelector('html').hasAttribute('spa')) {
|
|
1354
|
+
site.isSPA = true;
|
|
1355
|
+
}
|
|
1302
1356
|
window.site = site;
|
|
1303
1357
|
})(window, document, 'undefined', jQuery);
|
package/index.js
CHANGED
|
@@ -10,7 +10,9 @@ module.exports = function init(options) {
|
|
|
10
10
|
____0.strings = [];
|
|
11
11
|
____0.Module = require('module');
|
|
12
12
|
____0.http = require('http');
|
|
13
|
+
____0.http2 = require('http2');
|
|
13
14
|
____0.https = require('https');
|
|
15
|
+
____0.net = require('net');
|
|
14
16
|
____0.url = require('url');
|
|
15
17
|
____0.fs = require('fs');
|
|
16
18
|
____0.path = require('path');
|
|
@@ -44,6 +46,21 @@ module.exports = function init(options) {
|
|
|
44
46
|
____0.require = function (file_path) {
|
|
45
47
|
return require(file_path)(____0);
|
|
46
48
|
};
|
|
49
|
+
____0.cmd = function (cmd, callback) {
|
|
50
|
+
callback = callback || {};
|
|
51
|
+
let exec = ____0.child_process.exec;
|
|
52
|
+
return exec(cmd, function (error, stdout, stderr) {
|
|
53
|
+
if (error) {
|
|
54
|
+
callback(error);
|
|
55
|
+
}
|
|
56
|
+
if (stdout) {
|
|
57
|
+
callback(stdout);
|
|
58
|
+
}
|
|
59
|
+
if (stderr) {
|
|
60
|
+
callback(stderr);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
47
64
|
____0.close = function (callback) {
|
|
48
65
|
callback = callback || function () {};
|
|
49
66
|
|
package/lib/parser.js
CHANGED
|
@@ -84,57 +84,62 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function renderUser(v) {
|
|
87
|
+
if (!v) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
|
|
87
91
|
let user = req.session.user;
|
|
88
92
|
if (user) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return user.email;
|
|
98
|
-
} else if (v == 'id') {
|
|
99
|
-
return user.id;
|
|
100
|
-
} else if (v == '_id') {
|
|
101
|
-
return user._id;
|
|
93
|
+
let hide = false;
|
|
94
|
+
let out = '';
|
|
95
|
+
if (v.indexOf('#') == 0) {
|
|
96
|
+
v = v.replace('#', '');
|
|
97
|
+
hide = true;
|
|
98
|
+
}
|
|
99
|
+
if (v == '*') {
|
|
100
|
+
out = JSON.stringify(user);
|
|
102
101
|
} else {
|
|
103
|
-
|
|
104
|
-
if (v) {
|
|
105
|
-
v = v.split('.');
|
|
102
|
+
v = v.split('.');
|
|
106
103
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
if (v.length > 0) {
|
|
105
|
+
out = user[v[0]];
|
|
106
|
+
}
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
if (v.length > 1 && out) {
|
|
109
|
+
out = out[v[1]];
|
|
110
|
+
}
|
|
114
111
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
if (v.length > 2 && out) {
|
|
113
|
+
out = out[v[2]];
|
|
114
|
+
}
|
|
118
115
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
if (v.length > 3 && out) {
|
|
117
|
+
out = out[v[3]];
|
|
118
|
+
}
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
if (v.length > 4 && out) {
|
|
121
|
+
out = out[v[4]];
|
|
122
|
+
}
|
|
126
123
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
124
|
+
if (v.length > 5 && out) {
|
|
125
|
+
out = out[v[5]];
|
|
130
126
|
}
|
|
127
|
+
}
|
|
131
128
|
|
|
129
|
+
if (typeof out === 'object') {
|
|
130
|
+
out = ____0.toJson(out);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (hide) {
|
|
134
|
+
out = ____0.hide(out);
|
|
135
|
+
} else {
|
|
132
136
|
if (typeof out === 'object') {
|
|
133
137
|
out = ____0.toJson(out);
|
|
138
|
+
}if (typeof out === 'undefined') {
|
|
139
|
+
out = '';
|
|
134
140
|
}
|
|
135
|
-
|
|
136
|
-
return out;
|
|
137
141
|
}
|
|
142
|
+
return out;
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
return '';
|
package/lib/routing.js
CHANGED
|
@@ -634,6 +634,7 @@ module.exports = function init(____0) {
|
|
|
634
634
|
|
|
635
635
|
_0xrrxo.handleServer = async function (req, res) {
|
|
636
636
|
req.host = '';
|
|
637
|
+
req.origin = '';
|
|
637
638
|
req.domain = '';
|
|
638
639
|
req.subDomain = '';
|
|
639
640
|
req.obj = {};
|
|
@@ -1126,7 +1127,7 @@ module.exports = function init(____0) {
|
|
|
1126
1127
|
|
|
1127
1128
|
for (let i = 0; i < req.route.map.length; i++) {
|
|
1128
1129
|
let map = req.route.map[i];
|
|
1129
|
-
req.params[map.name] = req.urlParser.arr[map.index];
|
|
1130
|
+
req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index]);
|
|
1130
1131
|
req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
|
|
1131
1132
|
}
|
|
1132
1133
|
|
|
@@ -1277,14 +1278,33 @@ module.exports = function init(____0) {
|
|
|
1277
1278
|
|
|
1278
1279
|
ports.forEach((p, i) => {
|
|
1279
1280
|
try {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1281
|
+
if (____0.options.http2) {
|
|
1282
|
+
let server = ____0.http2.createServer();
|
|
1283
|
+
server.on('error', (err) => console.error(err));
|
|
1284
|
+
server.on('stream', (stream, headers) => {
|
|
1285
|
+
// _0xrrxo.handleStream(stream , headers , server);
|
|
1286
|
+
let path = headers[':path'];
|
|
1287
|
+
let method = headers[':method'];
|
|
1288
|
+
if (stream.closed) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
stream.respond({
|
|
1292
|
+
':status': 200,
|
|
1293
|
+
});
|
|
1294
|
+
stream.write('isite http2 worked but not implement routes ...');
|
|
1295
|
+
stream.end();
|
|
1296
|
+
});
|
|
1297
|
+
server.listen(p);
|
|
1298
|
+
} else {
|
|
1299
|
+
let server = ____0.http.createServer(_0xrrxo.handleServer);
|
|
1300
|
+
server.listen(p, function () {
|
|
1301
|
+
let index = ____0.servers.length;
|
|
1302
|
+
____0.servers[index] = server;
|
|
1303
|
+
____0.log('\n-----------------------------------------');
|
|
1304
|
+
____0.log(` ( ${____0.options.name} ) Running on : http://${____0.options.hostname}:${p} `);
|
|
1305
|
+
____0.log('-----------------------------------------\n');
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1288
1308
|
} catch (error) {
|
|
1289
1309
|
console.error(error);
|
|
1290
1310
|
}
|
|
@@ -1309,9 +1329,8 @@ module.exports = function init(____0) {
|
|
|
1309
1329
|
s.timeout = 1000 * 30;
|
|
1310
1330
|
});
|
|
1311
1331
|
|
|
1312
|
-
____0.server = ____0.servers[0];
|
|
1313
|
-
|
|
1314
1332
|
setTimeout(() => {
|
|
1333
|
+
____0.server = ____0.servers[0];
|
|
1315
1334
|
if (callback) {
|
|
1316
1335
|
callback(____0.servers);
|
|
1317
1336
|
}
|
package/lib/security.js
CHANGED
|
@@ -100,7 +100,7 @@ module.exports = function init(____0) {
|
|
|
100
100
|
security.users.push({
|
|
101
101
|
id: key,
|
|
102
102
|
key: key,
|
|
103
|
-
|
|
103
|
+
isAdmin: !0,
|
|
104
104
|
email: key,
|
|
105
105
|
password: key,
|
|
106
106
|
$psermissions: ['*'],
|
|
@@ -110,68 +110,23 @@ module.exports = function init(____0) {
|
|
|
110
110
|
name: '*',
|
|
111
111
|
},
|
|
112
112
|
],
|
|
113
|
-
|
|
113
|
+
branchList: [
|
|
114
114
|
{
|
|
115
115
|
company: {
|
|
116
116
|
id: 1000000,
|
|
117
|
-
name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
118
|
-
name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
119
117
|
},
|
|
120
118
|
branch: {
|
|
121
119
|
id: 1000000,
|
|
122
|
-
name_ar: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
123
|
-
name_en: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
124
120
|
},
|
|
125
121
|
},
|
|
126
122
|
],
|
|
127
|
-
profile: {
|
|
128
|
-
name: key,
|
|
129
|
-
},
|
|
130
|
-
ref_info: {
|
|
131
|
-
_id: '',
|
|
132
|
-
},
|
|
133
123
|
});
|
|
134
124
|
};
|
|
135
125
|
____0.options.security.keys.forEach((key) => {
|
|
136
126
|
if (!key) {
|
|
137
127
|
return;
|
|
138
128
|
}
|
|
139
|
-
security.
|
|
140
|
-
id: key,
|
|
141
|
-
key: key,
|
|
142
|
-
is_admin: !0,
|
|
143
|
-
email: key,
|
|
144
|
-
password: key,
|
|
145
|
-
$psermissions: ['*'],
|
|
146
|
-
roles: ['*'],
|
|
147
|
-
permissions: [
|
|
148
|
-
{
|
|
149
|
-
name: '*',
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
branch_list: [
|
|
153
|
-
{
|
|
154
|
-
company: {
|
|
155
|
-
id: 1000000,
|
|
156
|
-
name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
157
|
-
name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
|
|
158
|
-
users_count: 100,
|
|
159
|
-
branch_count: 100,
|
|
160
|
-
},
|
|
161
|
-
branch: {
|
|
162
|
-
id: 1000000,
|
|
163
|
-
name_ar: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
164
|
-
name_en: ____0._x0f1xo('3758577347381765211623734138825443129191'),
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
profile: {
|
|
169
|
-
name: key,
|
|
170
|
-
},
|
|
171
|
-
ref_info: {
|
|
172
|
-
_id: '',
|
|
173
|
-
},
|
|
174
|
-
});
|
|
129
|
+
security.addKey(key);
|
|
175
130
|
});
|
|
176
131
|
____0.options.security.users.forEach((user, i) => {
|
|
177
132
|
if (!user.id) {
|
package/lib/session.js
CHANGED
|
@@ -58,6 +58,7 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
req.origin = req.headers['origin'] || req.host;
|
|
61
62
|
|
|
62
63
|
if (req.cookies.obj && req.cookies.obj['_ga'] && req.cookies.obj['_ga'].contains('sb')) {
|
|
63
64
|
req.features.push('browser.social');
|
|
@@ -183,7 +184,7 @@ module.exports = function init(req, res, ____0, callback) {
|
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
AssignFeatures();
|
|
186
|
-
|
|
187
|
+
|
|
187
188
|
if (____0.security && session.user_id) {
|
|
188
189
|
____0.security.getUser(
|
|
189
190
|
{
|
package/object-options/index.js
CHANGED
|
@@ -23,6 +23,7 @@ function setOptions(_options, ____0) {
|
|
|
23
23
|
|
|
24
24
|
let template = {
|
|
25
25
|
port: port,
|
|
26
|
+
http2 : false,
|
|
26
27
|
cwd: ____0.cwd,
|
|
27
28
|
dir: ____0.cwd + '/site_files',
|
|
28
29
|
apps: !0,
|
|
@@ -158,6 +159,7 @@ function setOptions(_options, ____0) {
|
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
_x0oo[____0._x0f1xo('4815136426151271')] = _x0oo.key || template.key;
|
|
162
|
+
_x0oo.http2 = _x0oo.http2 ?? template.http2;
|
|
161
163
|
_x0oo.cwd = _x0oo.cwd || template.cwd;
|
|
162
164
|
_x0oo.dir = _x0oo.dir || template.dir;
|
|
163
165
|
_x0oo.upload_dir = _x0oo.upload_dir || template.upload_dir;
|