isite 2022.9.20 → 2022.9.23

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/lib/data.js ADDED
@@ -0,0 +1,118 @@
1
+ module.exports = function init(____0) {
2
+ ____0.mimeTypes = {
3
+ a: 'application/octet-stream',
4
+ ai: 'application/postscript',
5
+ aif: 'audio/x-aiff',
6
+ aifc: 'audio/x-aiff',
7
+ aiff: 'audio/x-aiff',
8
+ au: 'audio/basic',
9
+ avi: 'video/x-msvideo',
10
+ bat: 'text/plain',
11
+ bin: 'application/octet-stream',
12
+ bmp: 'image/x-ms-bmp',
13
+ c: 'text/plain',
14
+ cdf: 'application/x-cdf',
15
+ csh: 'application/x-csh',
16
+ css: 'text/css',
17
+ dll: 'application/octet-stream',
18
+ doc: 'application/msword',
19
+ dot: 'application/msword',
20
+ dvi: 'application/x-dvi',
21
+ eml: 'message/rfc822',
22
+ eps: 'application/postscript',
23
+ etx: 'text/x-setext',
24
+ exe: 'application/octet-stream',
25
+ gif: 'image/gif',
26
+ gtar: 'application/x-gtar',
27
+ h: 'text/plain',
28
+ hdf: 'application/x-hdf',
29
+ htm: 'text/html',
30
+ html: 'text/html',
31
+ jpe: 'image/jpeg',
32
+ jpeg: 'image/jpeg',
33
+ jpg: 'image/jpeg',
34
+ js: 'application/x-javascript',
35
+ ksh: 'text/plain',
36
+ latex: 'application/x-latex',
37
+ m1v: 'video/mpeg',
38
+ man: 'application/x-troff-man',
39
+ me: 'application/x-troff-me',
40
+ mht: 'message/rfc822',
41
+ mhtml: 'message/rfc822',
42
+ mif: 'application/x-mif',
43
+ mov: 'video/quicktime',
44
+ movie: 'video/x-sgi-movie',
45
+ mp2: 'audio/mpeg',
46
+ mp3: 'audio/mpeg',
47
+ mp4: 'video/mp4',
48
+ mpa: 'video/mpeg',
49
+ mpe: 'video/mpeg',
50
+ mpeg: 'video/mpeg',
51
+ mpg: 'video/mpeg',
52
+ ms: 'application/x-troff-ms',
53
+ nc: 'application/x-netcdf',
54
+ nws: 'message/rfc822',
55
+ o: 'application/octet-stream',
56
+ obj: 'application/octet-stream',
57
+ oda: 'application/oda',
58
+ pbm: 'image/x-portable-bitmap',
59
+ pdf: 'application/pdf',
60
+ pfx: 'application/x-pkcs12',
61
+ pgm: 'image/x-portable-graymap',
62
+ png: 'image/png',
63
+ pnm: 'image/x-portable-anymap',
64
+ pot: 'application/vnd.ms-powerpoint',
65
+ ppa: 'application/vnd.ms-powerpoint',
66
+ ppm: 'image/x-portable-pixmap',
67
+ pps: 'application/vnd.ms-powerpoint',
68
+ ppt: 'application/vnd.ms-powerpoint',
69
+ pptx: 'application/vnd.ms-powerpoint',
70
+ ps: 'application/postscript',
71
+ pwz: 'application/vnd.ms-powerpoint',
72
+ py: 'text/x-python',
73
+ pyc: 'application/x-python-code',
74
+ pyo: 'application/x-python-code',
75
+ qt: 'video/quicktime',
76
+ ra: 'audio/x-pn-realaudio',
77
+ ram: 'application/x-pn-realaudio',
78
+ ras: 'image/x-cmu-raster',
79
+ rdf: 'application/xml',
80
+ rgb: 'image/x-rgb',
81
+ roff: 'application/x-troff',
82
+ rtx: 'text/richtext',
83
+ sgm: 'text/x-sgml',
84
+ sgml: 'text/x-sgml',
85
+ sh: 'application/x-sh',
86
+ shar: 'application/x-shar',
87
+ snd: 'audio/basic',
88
+ so: 'application/octet-stream',
89
+ src: 'application/x-wais-source',
90
+ swf: 'application/x-shockwave-flash',
91
+ t: 'application/x-troff',
92
+ tar: 'application/x-tar',
93
+ tcl: 'application/x-tcl',
94
+ tex: 'application/x-tex',
95
+ texi: 'application/x-texinfo',
96
+ texinfo: 'application/x-texinfo',
97
+ tif: 'image/tiff',
98
+ tiff: 'image/tiff',
99
+ tr: 'application/x-troff',
100
+ tsv: 'text/tab-separated-values',
101
+ txt: 'text/plain',
102
+ ustar: 'application/x-ustar',
103
+ vcf: 'text/x-vcard',
104
+ wav: 'audio/x-wav',
105
+ wiz: 'application/msword',
106
+ wsdl: 'application/xml',
107
+ xbm: 'image/x-xbitmap',
108
+ xlb: 'application/vnd.ms-excel',
109
+ xls: 'application/vnd.ms-excel',
110
+ xlsx: 'application/vnd.ms-excel',
111
+ xml: 'text/xml',
112
+ xpdl: 'application/xml',
113
+ xpm: 'image/x-xpixmap',
114
+ xsl: 'application/xml',
115
+ xwd: 'image/x-xwindowdump',
116
+ zip: 'application/zip',
117
+ };
118
+ };
package/lib/helper.js ADDED
@@ -0,0 +1,43 @@
1
+ module.exports = function init(____0) {
2
+ ____0.backupDB = function (options, callback) {
3
+ options = options || {};
4
+ callback = callback || function () {};
5
+
6
+ options.db = options.db || ____0.options.mongodb.db;
7
+ options.path = options.path || ____0.options.backup_dir;
8
+ if (!options.path.like('*.gz')) {
9
+ options.path += '/' + options.db + '.gz';
10
+ }
11
+ options.path = ____0.path.resolve(options.path);
12
+ options.cmd = 'mongodump --db=' + options.db + ' --archive=' + options.path + ' --gzip';
13
+ let subProcess = ____0.child_process.spawn('mongodump', ['--db=' + options.db, '--archive=' + options.path, '--gzip']);
14
+
15
+ subProcess.on('exit', (code, signal) => {
16
+ if (code || signal) {
17
+ callback({ message: `Exit With Code [ ${code} ] and signal [ ${signal} ] ` }, options);
18
+ } else {
19
+ callback(null, options);
20
+ }
21
+ });
22
+ };
23
+ ____0.restoreDB = function (options, callback) {
24
+ options = options || {};
25
+ callback = callback || function () {};
26
+
27
+ options.db = options.db || ____0.options.mongodb.db;
28
+ options.path = options.path || ____0.options.backup_dir;
29
+ if (!options.path.like('*.gz')) {
30
+ options.path += '/' + options.db + '.gz';
31
+ }
32
+ options.path = ____0.path.resolve(options.path);
33
+ options.cmd = 'mongorestore --db=' + options.db + ' --archive=' + options.path + ' --gzip --drop';
34
+ let subProcess = ____0.child_process.spawn('mongorestore', ['--db=' + options.db, '--archive=' + options.path, '--gzip' , '--drop']);
35
+ subProcess.on('exit', (code, signal) => {
36
+ if (code || signal) {
37
+ callback({ message: `Exit With Code [ ${code} ] and signal [ ${signal} ] ` }, options);
38
+ } else {
39
+ callback(null, options);
40
+ }
41
+ });
42
+ };
43
+ };
package/lib/routing.js CHANGED
@@ -626,6 +626,9 @@ module.exports = function init(____0) {
626
626
  };
627
627
 
628
628
  _0xrrxo.handleServer = async function (req, res) {
629
+ req.host = '';
630
+ req.domain = '';
631
+ req.subDomain = '';
629
632
  req.obj = {};
630
633
  req.query = {};
631
634
  req.queryRaw = {};
@@ -705,7 +708,11 @@ module.exports = function init(____0) {
705
708
  arg1 &&
706
709
  res.headers &&
707
710
  res.headers[____0.strings[7]] &&
708
- (res.headers[____0.strings[7]].like('*text/css*') || res.headers[____0.strings[7]].like('*application/javascript*') || res.headers[____0.strings[7]].like('*text/html*') || res.headers[____0.strings[7]].like('*text/plain*') || res.headers[____0.strings[7]].like('*application/json*'))
711
+ (res.headers[____0.strings[7]].like('*text/css*') ||
712
+ res.headers[____0.strings[7]].like('*application/javascript*') ||
713
+ res.headers[____0.strings[7]].like('*text/html*') ||
714
+ res.headers[____0.strings[7]].like('*text/plain*') ||
715
+ res.headers[____0.strings[7]].like('*application/json*'))
709
716
  ) {
710
717
  if (req.acceptEncoding.match(/\bdeflate\b/) && typeof arg1 === 'string') {
711
718
  res.set(____0.strings[8], 'deflate');
@@ -973,7 +980,7 @@ module.exports = function init(____0) {
973
980
  req.data = { ...req.data, ..._data };
974
981
  req.route.parser = 'js';
975
982
  let out = ____0.parser(req, res, ____0, req.route).js(req.route.content);
976
- res.set(____0.strings[7], 'text/js');
983
+ res.set(____0.strings[7], 'text/javascript');
977
984
  res.status(200).end(out);
978
985
  });
979
986
  };
@@ -1201,7 +1208,7 @@ module.exports = function init(____0) {
1201
1208
  ____0.startTime = Date.now();
1202
1209
 
1203
1210
  ____0.https.globalAgent.options = {
1204
- key: ____0.fs.readFileSync( ____0.options.https.key || __dirname + '/../ssl/key.pem'),
1211
+ key: ____0.fs.readFileSync(____0.options.https.key || __dirname + '/../ssl/key.pem'),
1205
1212
  cert: ____0.fs.readFileSync(____0.options.https.cert || __dirname + '/../ssl/cert.pem'),
1206
1213
  };
1207
1214
 
package/lib/security.js CHANGED
@@ -155,6 +155,8 @@ module.exports = function init(____0) {
155
155
  id: 1000000,
156
156
  name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
157
157
  name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
158
+ users_count : 100,
159
+ branch_count : 100
158
160
  },
159
161
  branch: {
160
162
  id: 1000000,
@@ -171,9 +173,43 @@ module.exports = function init(____0) {
171
173
  },
172
174
  });
173
175
  });
174
- ____0.options.security.users.forEach((user) => {
175
- user.key = user.key || ____0.options.security.key;
176
- security.users.push(____0.options.security.users[i]);
176
+ ____0.options.security.users.forEach((user, i) => {
177
+ if (!user.id) {
178
+ user.id = security.users.length + 1;
179
+ }
180
+ security.users.push({
181
+ is_admin: !0,
182
+ $psermissions: ['*'],
183
+ roles: ['*'],
184
+ permissions: [
185
+ {
186
+ name: '*',
187
+ },
188
+ ],
189
+ branch_list: [
190
+ {
191
+ company: {
192
+ id: 1000000,
193
+ name_ar: ____0._x0f1xo('3758577347381765211627694539135245595691'),
194
+ name_en: ____0._x0f1xo('3758577347381765211627694539135245595691'),
195
+ users_count : 100,
196
+ branch_count : 100
197
+ },
198
+ branch: {
199
+ id: 1000000,
200
+ name_ar: ____0._x0f1xo('3758577347381765211623734138825443129191'),
201
+ name_en: ____0._x0f1xo('3758577347381765211623734138825443129191'),
202
+ },
203
+ },
204
+ ],
205
+ profile: {
206
+ name: user.email,
207
+ },
208
+ ref_info: {
209
+ _id: '',
210
+ },
211
+ ...user,
212
+ });
177
213
  });
178
214
 
179
215
  security.addPermissions = function (list, callback) {
package/lib/session.js CHANGED
@@ -1,11 +1,15 @@
1
1
  module.exports = function init(req, res, ____0, callback) {
2
- ____0.getSession({ accessToken: req.cookie('access_token') || req.headers['Access-Token'] || req.headers['access-token'] }, (session) => {
2
+ ____0.getSession({ accessToken: req.cookie('access_token') || req.headers['Access-Token'] || req.headers['access-token'] || req.query['access-token'] }, (session) => {
3
3
  if (!session.accessToken) {
4
4
  session.accessToken = new Date().getTime().toString() + '_' + Math.random() * (10000 - 1000) + 1000;
5
5
  session.accessToken = ____0.x0md50x(session.accessToken);
6
6
  res.cookie('access_token', session.accessToken);
7
7
  res.set('Access-Token', session.accessToken);
8
8
  }
9
+ if (req.query['access-token']) {
10
+ res.cookie('access_token', session.accessToken);
11
+ res.set('Access-Token', session.accessToken);
12
+ }
9
13
 
10
14
  session.ip = req.ip;
11
15
  session.modifiedTime = new Date().getTime();
@@ -24,10 +28,35 @@ module.exports = function init(req, res, ____0, callback) {
24
28
  req.features.push('ip.' + req.ip);
25
29
 
26
30
  if (req.headers['host']) {
27
- req.features.push('host.' + req.headers['host']);
28
- req.headers['host'].split('.').forEach((h) => {
29
- req.features.push('host.' + h);
30
- });
31
+ req.host = req.headers['host'];
32
+ req.hostArray = req.host.split(':')[0].split('.').reverse();
33
+ if (req.hostArray[0] == 'localhost') {
34
+ req.domain = req.hostArray[0];
35
+ req.features.push('host.' + req.hostArray[0]);
36
+ if (req.hostArray[1]) {
37
+ req.subDomain = req.hostArray[1];
38
+ req.features.push('host.' + req.hostArray[1]);
39
+ }
40
+ } else {
41
+ if (req.hostArray.length == 2) {
42
+ req.domain = req.hostArray[1] + '.' + req.hostArray[0];
43
+ req.features.push('host.' + req.hostArray[0]);
44
+ req.features.push('host.' + req.hostArray[1]);
45
+ } else if (req.hostArray.length == 3) {
46
+ req.domain = req.hostArray[1] + '.' + req.hostArray[0];
47
+ req.subDomain = req.hostArray[2];
48
+ req.features.push('host.' + req.hostArray[0]);
49
+ req.features.push('host.' + req.hostArray[1]);
50
+ req.features.push('host.' + req.hostArray[2]);
51
+ } else if (req.hostArray.length == 4) {
52
+ req.domain = req.hostArray[1] + '.' + req.hostArray[0];
53
+ req.subDomain = req.hostArray[2];
54
+ req.features.push('host.' + req.hostArray[0]);
55
+ req.features.push('host.' + req.hostArray[1]);
56
+ req.features.push('host.' + req.hostArray[2]);
57
+ req.features.push('host.' + req.hostArray[3]);
58
+ }
59
+ }
31
60
  }
32
61
 
33
62
  if (req.cookies.obj && req.cookies.obj['_ga'] && req.cookies.obj['_ga'].contains('sb')) {
@@ -154,7 +183,6 @@ module.exports = function init(req, res, ____0, callback) {
154
183
  }
155
184
 
156
185
  AssignFeatures();
157
-
158
186
  if (____0.security && session.user_id) {
159
187
  ____0.security.getUser(
160
188
  {