isite 2021.12.7 → 2022.1.10

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/routing.js CHANGED
@@ -1,5 +1,3 @@
1
- const { registerFormat } = require('archiver');
2
-
3
1
  module.exports = function init(____0) {
4
2
  ____0.on(____0.strings[4], (_) => {
5
3
  if (!_) {
@@ -296,7 +294,28 @@ module.exports = function init(____0) {
296
294
  callback(req, res);
297
295
  }
298
296
  };
299
-
297
+ _0xrrxo.off = function (r) {
298
+ if (!r) {
299
+ return;
300
+ }
301
+ if (typeof r == 'string') {
302
+ r = { name: r };
303
+ }
304
+ for (let i = _0xrrxo.list.length; i--; ) {
305
+ let r0 = _0xrrxo.list[i];
306
+ if (r.name && r.method && r0.name.like(r.name) && r0.method.like(r.method)) {
307
+ _0xrrxo.list.splice(i, 1);
308
+ ____0.fsm.off(r0.path);
309
+ } else if (r.name && r0.name.like(r.name)) {
310
+ _0xrrxo.list.splice(i, 1);
311
+ ____0.fsm.off('*' + r0.name.replace('/', '') + '*');
312
+ ____0.fsm.off(r0.path);
313
+ } else if (r.method && r0.method.like(r.method)) {
314
+ _0xrrxo.list.splice(i, 1);
315
+ ____0.fsm.off(r0.path);
316
+ }
317
+ }
318
+ };
300
319
  _0xrrxo.add = function (r, callback) {
301
320
  if (Array.isArray(r)) {
302
321
  r.forEach((r2) => {
@@ -1072,7 +1091,7 @@ module.exports = function init(____0) {
1072
1091
  }
1073
1092
  });
1074
1093
  } else if (req.method.contains('post') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].contains('multipart')) {
1075
- let form = new ____0.formidable({
1094
+ let form = ____0.formidable({
1076
1095
  multiples: !0,
1077
1096
  uploadDir: ____0.options.upload_dir,
1078
1097
  });
@@ -1191,13 +1210,18 @@ module.exports = function init(____0) {
1191
1210
  }
1192
1211
 
1193
1212
  ports.forEach((p, i) => {
1194
- let index = ____0.servers.length;
1195
- ____0.servers[index] = ____0.http.createServer(_0xrrxo.handleServer);
1196
- ____0.servers[index].listen(p, function () {
1197
- ____0.log('\n-----------------------------------------');
1198
- ____0.log(` ( ${____0.options.name} ) Running on : http://${____0.options.hostname}:${p} `);
1199
- ____0.log('-----------------------------------------\n');
1200
- });
1213
+ try {
1214
+ let server = ____0.http.createServer(_0xrrxo.handleServer);
1215
+ server.listen(p, function () {
1216
+ let index = ____0.servers.length;
1217
+ ____0.servers[index] = server;
1218
+ ____0.log('\n-----------------------------------------');
1219
+ ____0.log(` ( ${____0.options.name} ) Running on : http://${____0.options.hostname}:${p} `);
1220
+ ____0.log('-----------------------------------------\n');
1221
+ });
1222
+ } catch (error) {
1223
+ console.error(error);
1224
+ }
1201
1225
  });
1202
1226
 
1203
1227
  if (____0.options.https.enabled) {
@@ -1226,10 +1250,12 @@ module.exports = function init(____0) {
1226
1250
 
1227
1251
  ____0.server = ____0.servers[0];
1228
1252
 
1229
- if (callback) {
1230
- callback(____0.servers);
1231
- }
1232
- ____0.call(____0.strings[9]);
1253
+ setTimeout(() => {
1254
+ if (callback) {
1255
+ callback(____0.servers);
1256
+ }
1257
+ ____0.call(____0.strings[9]);
1258
+ }, 1000 * 1);
1233
1259
 
1234
1260
  return ____0.server;
1235
1261
  };