isite 2025.11.1 → 2025.11.3

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.
Files changed (3) hide show
  1. package/lib/fsm.js +28 -33
  2. package/lib/routing.js +27 -16
  3. package/package.json +1 -1
package/lib/fsm.js CHANGED
@@ -219,39 +219,34 @@ module.exports = function init(____0) {
219
219
  fsm.readFileNow = function (path, callback) {
220
220
  fsm.readFileRaw(path, (data) => {
221
221
  path = path.replace('.isite-backup', '');
222
- if (data) {
223
- let file = {
224
- path: path,
225
- content: data,
226
- count: 1,
227
- stat: fsm.statSync(path),
228
- time: new Date().getTime(),
229
- };
230
-
231
- file.json = function (callback) {
232
- try {
233
- if (!file.isJson) {
234
- file.content = JSON.parse(file.content);
235
- file.isJson = true;
236
- }
237
- } catch (error) {
238
- file.error = error;
239
- console.log(error);
240
- }
241
- if (callback) {
242
- callback(file);
243
- } else {
244
- return file;
222
+
223
+ let file = {
224
+ path: path,
225
+ content: data,
226
+ count: 1,
227
+ stat: fsm.statSync(path),
228
+ time: new Date().getTime(),
229
+ };
230
+
231
+ file.json = function (callback) {
232
+ try {
233
+ if (!file.isJson) {
234
+ file.content = JSON.parse(file.content);
235
+ file.isJson = true;
245
236
  }
246
- };
247
- fsm.list.push(file);
237
+ } catch (error) {
238
+ file.error = error;
239
+ console.log(error);
240
+ }
248
241
  if (callback) {
249
- callback(null, file);
242
+ callback(file);
243
+ } else {
244
+ return file;
250
245
  }
251
- } else {
252
- callback({
253
- message: path + ' :: Error Read File Not Exists',
254
- });
246
+ };
247
+ fsm.list.push(file);
248
+ if (callback) {
249
+ callback(null, file);
255
250
  }
256
251
  });
257
252
  };
@@ -262,7 +257,7 @@ module.exports = function init(____0) {
262
257
  if (!path) {
263
258
  if (callback) {
264
259
  callback({
265
- message: path + ' :: Error Read File Not Exists',
260
+ message: path + ' !path :: Error Read File Not Exists',
266
261
  });
267
262
  }
268
263
  }
@@ -284,7 +279,7 @@ module.exports = function init(____0) {
284
279
  } else {
285
280
  if (callback) {
286
281
  callback({
287
- message: path + ' :: Error Read File Not Exists',
282
+ message: path + ' :: Error Read File Path Not Exists',
288
283
  });
289
284
  }
290
285
  }
@@ -335,7 +330,7 @@ module.exports = function init(____0) {
335
330
 
336
331
  fsm.readFiles = function (paths, callback) {
337
332
  callback = callback || function () {};
338
- var content = '';
333
+ let content = '';
339
334
  for (var index = 0; index < paths.length; index++) {
340
335
  let p = paths[index];
341
336
  let exists = !1;
package/lib/routing.js CHANGED
@@ -12,15 +12,15 @@ module.exports = function init(____0) {
12
12
  _0xrrxo.endResponse = function (req, res) {
13
13
  let route = req.route;
14
14
 
15
- if (route.empty) {
15
+ if (route.contentError) {
16
16
  if (____0.options.help) {
17
- res.set('help-error-message', 'route is empty');
17
+ res.set('help-error-message', route.contentError);
18
18
  }
19
19
  res.end();
20
20
  return;
21
21
  }
22
22
 
23
- if (req.route.encript == '123') {
23
+ if (req.route.encript == '123' && req.content) {
24
24
  req.content = ____0.f1(req.content);
25
25
  }
26
26
 
@@ -189,6 +189,16 @@ module.exports = function init(____0) {
189
189
  _0xrrxo.defaultCallback = function (req, res) {
190
190
  let route = req.route;
191
191
 
192
+ if (route.contentError) {
193
+ res.status(404);
194
+ if (____0.options.help) {
195
+ res.set('help-info-content', route.contentError);
196
+ }
197
+
198
+ _0xrrxo.endResponse(req, res);
199
+ return;
200
+ }
201
+
192
202
  if ((response = ____0.sharedList.find((s) => s.host == req.host && s.filePath == route.path && s.url == req.url))) {
193
203
  res.headers = response.headers;
194
204
  res.code = response.code;
@@ -213,12 +223,6 @@ module.exports = function init(____0) {
213
223
  return;
214
224
  }
215
225
 
216
- if (route.empty) {
217
- res.status(404);
218
- _0xrrxo.endResponse(req, res);
219
- return;
220
- }
221
-
222
226
  if (!route.path && !route.content) {
223
227
  if (____0.options.help) {
224
228
  res.set('help-info-content', 'Route Not Set File Path');
@@ -233,6 +237,7 @@ module.exports = function init(____0) {
233
237
  res.status(200);
234
238
  _0xrrxo.endResponse(req, res);
235
239
  }
240
+
236
241
  if (typeof route.path == 'string') {
237
242
  ____0.readFile(route.path, function (err, file) {
238
243
  if (!err) {
@@ -262,7 +267,7 @@ module.exports = function init(____0) {
262
267
  }
263
268
 
264
269
  res.status(404);
265
- route.empty = !0;
270
+ route.contentError = err.message;
266
271
  _0xrrxo.endResponse(req, res);
267
272
  return;
268
273
  }
@@ -285,7 +290,7 @@ module.exports = function init(____0) {
285
290
  }
286
291
 
287
292
  res.status(404);
288
- route.empty = !0;
293
+ route.contentError = err.message;
289
294
  _0xrrxo.endResponse(req, res);
290
295
  return;
291
296
  }
@@ -1264,7 +1269,7 @@ module.exports = function init(____0) {
1264
1269
  }
1265
1270
  }
1266
1271
 
1267
- let findRouteIndex = _0xrrxo.list.findIndex((r) => req.method.toLowerCase().like(r.method.toLowerCase()) && req.urlParser.pathname.like(r.name));
1272
+ let findRouteIndex = _0xrrxo.list.findIndex((r) => req.urlParser.pathname.like(r.name) && req.method.like(r.method));
1268
1273
  if (findRouteIndex !== -1) {
1269
1274
  if (!_0xrrxo.list[findRouteIndex].count) {
1270
1275
  _0xrrxo.list[findRouteIndex].count = 0;
@@ -1301,7 +1306,12 @@ module.exports = function init(____0) {
1301
1306
  req.queryRaw = req.urlParserRaw.query;
1302
1307
 
1303
1308
  ____0.validateRoute(req, res, (req, res) => {
1304
- if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/urlencoded/i)) {
1309
+ if (req.method.like('options') || req.method.like('head')) {
1310
+ res.set('Content-Length', 50 * 1000);
1311
+ res.status(200).end();
1312
+ return;
1313
+ }
1314
+ if (!req.method.like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/urlencoded/i)) {
1305
1315
  req.on('data', function (data) {
1306
1316
  req.bodyRaw += data;
1307
1317
  });
@@ -1345,7 +1355,7 @@ module.exports = function init(____0) {
1345
1355
  });
1346
1356
 
1347
1357
  return;
1348
- } else if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/json/i)) {
1358
+ } else if (!req.method.like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/json/i)) {
1349
1359
  req.on('data', function (data) {
1350
1360
  req.bodyRaw += data;
1351
1361
  });
@@ -1363,7 +1373,7 @@ module.exports = function init(____0) {
1363
1373
  _0xrrxo.handleRoute(req, res, req.route);
1364
1374
  }
1365
1375
  });
1366
- } else if (!req.method.toLowerCase().like('get')) {
1376
+ } else if (!req.method.like('get')) {
1367
1377
  req.on('data', function (data) {
1368
1378
  req.bodyRaw += data;
1369
1379
  });
@@ -1413,7 +1423,8 @@ module.exports = function init(____0) {
1413
1423
  res.set('help-eror-message', 'unhandled route help : ' + req.urlParser.pathname);
1414
1424
  }
1415
1425
 
1416
- if (req.method.toLowerCase().like('options') || req.method.toLowerCase().like('head')) {
1426
+ if (req.method.like('options') || req.method.like('head')) {
1427
+ res.set('Content-Length', 50 * 1000);
1417
1428
  res.status(200).end();
1418
1429
  return;
1419
1430
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2025.11.01",
3
+ "version": "2025.11.03",
4
4
  "description": "Create High Level Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {