isite 2024.8.22 → 2024.8.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/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
@@ -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',
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
- ____0.child_process = require('node:child_process');
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/routing.js CHANGED
@@ -62,116 +62,133 @@ module.exports = function init(____0) {
62
62
  }
63
63
  }
64
64
 
65
- let encode = ____0.getFileEncode(route.path);
66
-
67
- if (route.path.endsWith('.css')) {
68
- res.set(____0.strings[7], 'text/css');
69
- if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
70
-
71
- res.end(req.content, encode);
72
- } else if (route.path.endsWith('.js')) {
73
- res.set(____0.strings[7], 'application/javascript');
74
- if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
75
-
76
- res.end(req.content, encode);
77
- } else if (route.path.endsWith('.html')) {
78
- res.set(____0.strings[7], 'text/html');
79
- if (____0.options.cache.enabled && route.cache) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
80
-
81
- res.end(req.content, encode);
82
- } else if (route.path.endsWith('.txt')) {
83
- res.set(____0.strings[7], 'text/plain');
84
- if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
85
-
86
- res.end(req.content, encode);
87
- } else if (route.path.endsWith('.json')) {
88
- res.set(____0.strings[7], 'application/json');
89
- if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
90
-
91
- res.end(req.content, encode);
92
- } else if (route.path.endsWith('.xml')) {
93
- res.set(____0.strings[7], 'text/xml');
94
- if (____0.options.cache.enabled) {
95
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
65
+ if (true) {
66
+ if (route.path.endsWith('.css')) {
67
+ res.set(____0.strings[7], 'text/css');
68
+ if (____0.options.cache.enabled) {
69
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
70
+ }
71
+ } else if (route.path.endsWith('.js')) {
72
+ res.set(____0.strings[7], 'application/javascript');
73
+ if (____0.options.cache.enabled) {
74
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
75
+ }
76
+ } else if (route.path.endsWith('.html')) {
77
+ res.set(____0.strings[7], 'text/html');
78
+ if (____0.options.cache.enabled && route.cache) {
79
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
80
+ }
81
+ } else if (route.path.endsWith('.txt')) {
82
+ res.set(____0.strings[7], 'text/plain');
83
+ if (____0.options.cache.enabled) {
84
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
85
+ }
86
+ } else if (route.path.endsWith('.json')) {
87
+ res.set(____0.strings[7], 'application/json');
88
+ if (____0.options.cache.enabled) {
89
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
90
+ }
91
+ } else if (route.path.endsWith('.xml')) {
92
+ res.set(____0.strings[7], 'text/xml');
93
+ if (____0.options.cache.enabled) {
94
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
95
+ }
96
+ } else if (route.path.endsWith('.woff2')) {
97
+ res.set(____0.strings[7], 'application/font-woff2');
98
+ if (____0.options.cache.enabled) {
99
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
100
+ }
101
+ } else if (route.path.endsWith('.woff')) {
102
+ res.set(____0.strings[7], 'application/font-woff');
103
+ if (____0.options.cache.enabled) {
104
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
105
+ }
106
+ } else if (route.path.endsWith('.ttf')) {
107
+ res.set(____0.strings[7], 'application/font-ttf');
108
+ if (____0.options.cache.enabled) {
109
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
110
+ }
111
+ } else if (route.path.endsWith('.otf')) {
112
+ res.set(____0.strings[7], 'application/font-otf');
113
+ if (____0.options.cache.enabled) {
114
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
115
+ }
116
+ } else if (route.path.endsWith('.eot')) {
117
+ res.set(____0.strings[7], 'application/font-eot');
118
+ if (____0.options.cache.enabled) {
119
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
120
+ }
121
+ } else if (route.path.endsWith('.gif')) {
122
+ res.set(____0.strings[7], 'image/gif');
123
+ if (____0.options.cache.enabled) {
124
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
125
+ }
126
+ } else if (route.path.endsWith('.png')) {
127
+ res.set(____0.strings[7], 'image/png');
128
+ if (____0.options.cache.enabled) {
129
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
130
+ }
131
+ } else if (route.path.endsWith('.jpg')) {
132
+ res.set(____0.strings[7], 'image/jpg');
133
+ if (____0.options.cache.enabled) {
134
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
135
+ }
136
+ } else if (route.path.endsWith('.jpeg')) {
137
+ res.set(____0.strings[7], 'image/jpeg');
138
+ if (____0.options.cache.enabled) {
139
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
140
+ }
141
+ } else if (route.path.endsWith('.ico')) {
142
+ res.set(____0.strings[7], 'image/ico');
143
+ if (____0.options.cache.enabled) {
144
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
145
+ }
146
+ } else if (route.path.endsWith('.bmp')) {
147
+ res.set(____0.strings[7], 'image/bmp');
148
+ if (____0.options.cache.enabled) {
149
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
150
+ }
151
+ } else if (route.path.endsWith('.webp')) {
152
+ res.set(____0.strings[7], 'image/webp');
153
+ if (____0.options.cache.enabled) {
154
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
155
+ }
156
+ } else if (route.path.endsWith('.svg')) {
157
+ res.set(____0.strings[7], 'image/svg+xml');
158
+ if (____0.options.cache.enabled) {
159
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
160
+ }
96
161
  }
162
+ }
163
+
164
+ let response = {
165
+ url: req.url,
166
+ filePath: route.path,
167
+ content: req.content,
168
+ encode: ____0.getFileEncode(route.path),
169
+ headers: res.headers,
170
+ code: res.code,
171
+ };
97
172
 
98
- res.end(req.content, encode);
99
- } else if (route.path.endsWith('.woff2')) {
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);
173
+ if (route.shared && !____0.sharedList.some((s) => s.filePath == response.filePath && s.url == response.url)) {
174
+ ____0.sharedList.push(response);
175
+ }
176
+
177
+ if (typeof response.content == 'object') {
178
+ res.json(response.content);
164
179
  } else {
165
- if (typeof req.content == 'object') {
166
- res.json(req.content);
167
- } else {
168
- res.end(req.content, encode);
169
- }
180
+ res.end(response.content, response.encode);
170
181
  }
171
182
  };
172
183
 
173
184
  _0xrrxo.defaultCallback = function (req, res) {
174
185
  let route = req.route;
186
+ if ((response = ____0.sharedList.find((s) => s.filePath == route.path && s.url == req.url))) {
187
+ res.headers = response.headers;
188
+ res.code = response.code;
189
+ res.setHeader('x-shared', ____0.sharedList.length + ' - ' + ____0.options.port);
190
+ return res.end(response.content, response.encode);
191
+ }
175
192
 
176
193
  if (route.cache && route.content) {
177
194
  if (____0.options.help) {
@@ -357,6 +374,7 @@ module.exports = function init(____0) {
357
374
  route.cache = !0;
358
375
  route.hide = !1;
359
376
  route.compress = !1;
377
+ route.shared = !1;
360
378
  route.content = null;
361
379
  route.headers = null;
362
380
  route.map = [];
@@ -387,6 +405,7 @@ module.exports = function init(____0) {
387
405
  route.hide = r.hide ?? !1;
388
406
  route.encript = r.encript;
389
407
  route.compress = r.compress ?? !1;
408
+ route.shared = r.shared ?? !1;
390
409
  route.map = r.map || [];
391
410
  route.callback = callback || r.callback || _0xrrxo.defaultCallback;
392
411
 
@@ -773,7 +792,7 @@ module.exports = function init(____0) {
773
792
  return res.end(arg2, arg3, arg4);
774
793
  } else {
775
794
  if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
776
- res.set(____0.strings[7], 'text/plain');
795
+ res.set(____0.strings[7], 'text/html');
777
796
  }
778
797
 
779
798
  if (
@@ -903,6 +922,13 @@ module.exports = function init(____0) {
903
922
  } else {
904
923
  filePath = file;
905
924
  }
925
+
926
+ if ((response = ____0.sharedList.find((s) => s.filePath == filePath && s.url == req.url))) {
927
+ res.headers = response.headers;
928
+ res.code = response.code;
929
+ res.setHeader('x-shared', ____0.sharedList.length + ' - ' + ____0.options.port);
930
+ return res.end(response.content, response.encode);
931
+ }
906
932
  ____0.fsm.getContent(filePath, (content) => {
907
933
  if (!content) {
908
934
  if (_data && _data.html) {
@@ -1021,7 +1047,21 @@ module.exports = function init(____0) {
1021
1047
  res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1022
1048
  }
1023
1049
  }
1024
- res.end(req.content, ____0.getFileEncode(filePath));
1050
+
1051
+ let response = {
1052
+ url: req.url,
1053
+ filePath: filePath,
1054
+ content: req.content,
1055
+ encode: ____0.getFileEncode(filePath),
1056
+ headers: res.headers,
1057
+ code: res.code,
1058
+ };
1059
+
1060
+ if (options.shared && !____0.sharedList.some((s) => s.filePath == response.filePath && s.url == response.url)) {
1061
+ ____0.sharedList.push(response);
1062
+ }
1063
+
1064
+ res.end(response.content, response.encode);
1025
1065
  });
1026
1066
  };
1027
1067
 
@@ -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 = process.env.port || 80;
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2024.08.22",
3
+ "version": "2024.08.23",
4
4
  "description": "Create High Level Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {