isite 2024.12.1 → 2024.12.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.
package/lib/routing.js CHANGED
@@ -291,7 +291,7 @@ module.exports = function init(____0) {
291
291
  callback =
292
292
  callback ||
293
293
  function (req, res) {
294
- console.log('No CallBack set For : ', r);
294
+ ____0.log('No CallBack set For : ', r);
295
295
  res.end();
296
296
  };
297
297
  if (typeof r === 'string') {
@@ -595,10 +595,14 @@ module.exports = function init(____0) {
595
595
  };
596
596
 
597
597
  _0xrrxo.handleRoute = async function (req, res, route) {
598
+ if (route.language) {
599
+ req.session.language = { ...route.language };
600
+ }
598
601
 
599
602
  if (route.lang) {
600
- req.session.language = { id: route.lang };
603
+ req.session.language.id = route.lang;
601
604
  }
605
+
602
606
  if (!route.public) {
603
607
  if (!route.name.like(____0.strings[15]) && route.require.features.length > 0) {
604
608
  let ok = !0;
@@ -664,717 +668,748 @@ module.exports = function init(____0) {
664
668
  }
665
669
  }
666
670
  }
671
+
667
672
  route.callback(req, res);
668
673
  };
669
674
 
670
- _0xrrxo.handleServer = async function (req, res) {
671
- req.host = req.headers['host'] || '';
672
- req.origin = req.headers['origin'] || req.host;
673
- req.referer = req.headers['referer'] || '';
674
- req.domain = '';
675
- req.subDomain = '';
676
- req.obj = {};
677
- req.query = {};
678
- req.queryRaw = {};
679
- req.data = req.body = {};
680
- req.bodyRaw = '';
681
- req.params = {};
682
- req.paramsRaw = {};
683
- req.features = [];
684
-
685
- res.setTimeout(1000 * ____0.options.responseTimeout, () => {
686
- if (req.url.like('*api*')) {
687
- return res.json({
688
- done: false,
689
- error: ____0.strings[19],
690
- });
691
- } else {
692
- res.end(503);
693
- }
694
- });
675
+ ____0.validateServerRequest = async function (req, res, next) {
676
+ next(req, res);
677
+ };
695
678
 
696
- req.addFeature = function (name) {
697
- req.features.push(name);
698
- };
679
+ ____0.validateRequest = async function (req, res, next) {
680
+ next(req, res);
681
+ };
682
+ ____0.validateRoute = async function (req, res, next) {
683
+ next(req, res);
684
+ };
699
685
 
700
- req.hasFeature = function (name) {
701
- return req.features.some((f) => f.like(name));
702
- };
686
+ ____0.validateSession = async function (req, res, next) {
687
+ next(req, res);
688
+ };
703
689
 
704
- req.removeFeature = function (name) {
705
- req.features.forEach((f, i) => {
706
- if (f.like(name)) {
707
- req.features.splice(i, 1);
690
+ _0xrrxo.handleServer = async function (req, res) {
691
+ ____0.validateServerRequest(req, res, (req, res) => {
692
+ req.host = req.headers['host'] || '';
693
+ req.origin = req.headers['origin'] || req.host;
694
+ req.referer = req.headers['referer'] || '';
695
+ req.domain = '';
696
+ req.subDomain = '';
697
+ req.obj = {};
698
+ req.query = {};
699
+ req.queryRaw = {};
700
+ req.data = req.body = {};
701
+ req.bodyRaw = '';
702
+ req.params = {};
703
+ req.paramsRaw = {};
704
+ req.features = [];
705
+
706
+ res.setTimeout(1000 * ____0.options.responseTimeout, () => {
707
+ if (req.url.like('*api*')) {
708
+ return res.json({
709
+ done: false,
710
+ error: ____0.strings[19],
711
+ });
712
+ } else {
713
+ res.end(503);
708
714
  }
709
715
  });
710
- };
711
716
 
712
- req.getUserFinger = function () {
713
- let userFinger = {
714
- id: null,
715
- email: null,
716
- date: new Date(),
717
- ip: null,
717
+ req.addFeature = function (name) {
718
+ req.features.push(name);
718
719
  };
719
720
 
720
- if (req && req.session && req.session.user) {
721
- req.session.user.profile = req.session.user.profile || {};
722
- userFinger.id = req.session.user.id;
723
- userFinger.email = req.session.user.email;
724
- userFinger.name = req.session.user.profile.name || userFinger.email;
725
- userFinger.name_ar = req.session.user.profile.name_ar || userFinger.email;
726
- userFinger.name_en = req.session.user.profile.name_en || userFinger.email;
727
- userFinger.ip = req.ip;
728
- } else {
729
- }
721
+ req.hasFeature = function (name) {
722
+ return req.features.some((f) => f.like(name));
723
+ };
730
724
 
731
- return userFinger;
732
- };
725
+ req.removeFeature = function (name) {
726
+ req.features.forEach((f, i) => {
727
+ if (f.like(name)) {
728
+ req.features.splice(i, 1);
729
+ }
730
+ });
731
+ };
733
732
 
734
- req.word = function (name) {
735
- let w = ____0.word(name);
736
- if (!w.hostList) {
737
- return w[req.session.language.id] || name;
738
- } else {
739
- if ((w2 = w.hostList.find((h) => req.host.like(h.name)))) {
740
- return w2[req.session.language.id] || name;
733
+ req.getUserFinger = function () {
734
+ let userFinger = {
735
+ id: null,
736
+ email: null,
737
+ date: new Date(),
738
+ ip: null,
739
+ };
740
+
741
+ if (req && req.session && req.session.user) {
742
+ req.session.user.profile = req.session.user.profile || {};
743
+ userFinger.id = req.session.user.id;
744
+ userFinger.email = req.session.user.email;
745
+ userFinger.name = req.session.user.profile.name || userFinger.email;
746
+ userFinger.name_ar = req.session.user.profile.name_ar || userFinger.email;
747
+ userFinger.name_en = req.session.user.profile.name_en || userFinger.email;
748
+ userFinger.ip = req.ip;
749
+ } else {
741
750
  }
742
- }
743
- return w[req.session.language.id] || name;
744
- };
745
751
 
746
- res.code = null;
747
- req.socket.remoteAddress = req.socket.remoteAddress || '';
748
- req.acceptEncoding = req.headers[____0.strings[5]] ? req.headers[____0.strings[5]] : '';
749
- res.ip = req.ip = req.headers[____0.strings[6]] ? req.headers[____0.strings[6]] : req.socket.remoteAddress?.replace('::ffff:', '');
750
- if (req.ip == '::1') {
751
- req.ip = '127.0.0.1';
752
- }
753
- res.ip2 = req.ip2 = req.socket.localAddress.replace('::ffff:', '');
754
- res.port = req.port = req.socket.remotePort;
755
- res.port2 = req.port2 = req.socket.localPort;
756
- res.cookies = res.cookie = req.cookies = req.cookie = ____0.cookie(req, res, ____0);
752
+ return userFinger;
753
+ };
757
754
 
758
- req.urlRaw = req.url;
759
- req.urlParserRaw = ____0.url.parse(req.urlRaw, !0);
760
- req.urlParser = ____0.url.parse(req.urlRaw.toLowerCase(), !0);
755
+ req.word = function (name) {
756
+ let w = ____0.word(name);
757
+ if (!w.hostList) {
758
+ return w[req.session.language.id] || name;
759
+ } else {
760
+ if ((w2 = w.hostList.find((h) => req.host.like(h.name)))) {
761
+ return w2[req.session.language.id] || name;
762
+ }
763
+ }
764
+ return w[req.session.language.id] || name;
765
+ };
761
766
 
762
- res.set = (a, b, c) => {
763
- if (res.writeHeadEnabled === !1 || res.finished === !0 || res.headersSent) {
764
- return res;
765
- }
766
- if (typeof b == 'string') {
767
- res.headers = res.headers || [];
768
- res.headers[a] = b.toLowerCase();
767
+ res.code = null;
768
+ req.socket.remoteAddress = req.socket.remoteAddress || '';
769
+ req.acceptEncoding = req.headers[____0.strings[5]] ? req.headers[____0.strings[5]] : '';
770
+ res.ip = req.ip = req.headers[____0.strings[6]] ? req.headers[____0.strings[6]] : req.socket.remoteAddress?.replace('::ffff:', '');
771
+ if (req.ip == '::1') {
772
+ req.ip = '127.0.0.1';
769
773
  }
774
+ res.ip2 = req.ip2 = req.socket.localAddress.replace('::ffff:', '');
775
+ res.port = req.port = req.socket.remotePort;
776
+ res.port2 = req.port2 = req.socket.localPort;
777
+ res.cookies = res.cookie = req.cookies = req.cookie = ____0.cookie(req, res, ____0);
778
+
779
+ req.urlRaw = req.url;
780
+ req.urlParserRaw = ____0.url.parse(req.urlRaw, !0);
781
+ req.urlParser = ____0.url.parse(req.urlRaw.toLowerCase(), !0);
782
+
783
+ res.set = (a, b, c) => {
784
+ if (res.writeHeadEnabled === !1 || res.finished === !0 || res.headersSent) {
785
+ return res;
786
+ }
787
+ if (typeof b == 'string') {
788
+ res.headers = res.headers || [];
789
+ res.headers[a] = b.toLowerCase();
790
+ }
770
791
 
771
- res.setHeader(a, b, c);
772
- return res;
773
- };
774
-
775
- res.delete = res.remove = res.removeHeader;
776
- res.writeHead0 = res.writeHead;
777
- res.writeHeadEnabled = !0;
778
-
779
- res.writeHead = (code, obj) => {
780
- if (res.writeHeadEnabled === !1 || res.finished === !0) {
792
+ res.setHeader(a, b, c);
781
793
  return res;
782
- }
783
- res.cookie.write();
784
- res.writeHeadEnabled = !1;
785
- res.writeHead0(code, obj);
786
- return res;
787
- };
794
+ };
788
795
 
789
- res.ending = (time, ...data) => {
790
- if (!time) {
791
- time = 0;
792
- }
793
- setTimeout(function () {
794
- res.end(...data);
795
- }, time);
796
- };
796
+ res.delete = res.remove = res.removeHeader;
797
+ res.writeHead0 = res.writeHead;
798
+ res.writeHeadEnabled = !0;
797
799
 
798
- res.end0 = res.end;
799
- res.end = function (arg1, arg2, arg3, arg4) {
800
- if (res.ended) {
801
- return;
802
- }
800
+ res.writeHead = (code, obj) => {
801
+ if (res.writeHeadEnabled === !1 || res.finished === !0) {
802
+ return res;
803
+ }
804
+ res.cookie.write();
805
+ res.writeHeadEnabled = !1;
806
+ res.writeHead0(code, obj);
807
+ return res;
808
+ };
803
809
 
804
- if (typeof arg1 === 'number') {
805
- res.writeHead(arg1);
806
- return res.end(arg2, arg3, arg4);
807
- } else {
808
- if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
809
- res.set(____0.strings[7], 'text/html');
810
+ res.ending = (time, ...data) => {
811
+ if (!time) {
812
+ time = 0;
810
813
  }
814
+ setTimeout(function () {
815
+ res.end(...data);
816
+ }, time);
817
+ };
811
818
 
812
- if (
813
- arg1 &&
814
- res.headers &&
815
- res.headers[____0.strings[7]] &&
816
- (res.headers[____0.strings[7]].like('*text/css*') ||
817
- res.headers[____0.strings[7]].like('*application/javascript*') ||
818
- res.headers[____0.strings[7]].like('*text/html*') ||
819
- res.headers[____0.strings[7]].like('*text/plain*') ||
820
- res.headers[____0.strings[7]].like('*application/json*'))
821
- ) {
822
- if (req.acceptEncoding.like('*gzip*') && typeof arg1 === 'string') {
823
- res.set(____0.strings[8], 'gzip');
824
- res.set('Vary', ____0.strings[5]);
825
- arg1 = ____0.zlib.gzipSync(Buffer.from(arg1));
826
- } else if (req.acceptEncoding.like('*deflate*') && typeof arg1 === 'string') {
827
- res.set(____0.strings[8], 'deflate');
828
- res.set('Vary', ____0.strings[5]);
829
- arg1 = ____0.zlib.deflateSync(Buffer.from(arg1));
830
- } else {
831
- // ____0.log(typeof arg1)
832
- }
819
+ res.end0 = res.end;
820
+ res.end = function (arg1, arg2, arg3, arg4) {
821
+ if (res.ended) {
822
+ return;
833
823
  }
834
824
 
835
- res.writeHead(res.code || res.statusCode || 200);
836
- arg1 = arg1 || ' ';
837
- res.ended = true;
838
- return res.end0(arg1, arg2, arg3, arg4);
839
- }
840
- };
825
+ if (typeof arg1 === 'number') {
826
+ res.writeHead(arg1);
827
+ return res.end(arg2, arg3, arg4);
828
+ } else {
829
+ if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
830
+ res.set(____0.strings[7], 'text/html');
831
+ }
841
832
 
842
- res.status = (code) => {
843
- if (!res.code) {
844
- res.code = code || 200;
845
- }
846
- return res;
847
- };
833
+ if (
834
+ arg1 &&
835
+ res.headers &&
836
+ res.headers[____0.strings[7]] &&
837
+ (res.headers[____0.strings[7]].like('*text/css*') ||
838
+ res.headers[____0.strings[7]].like('*application/javascript*') ||
839
+ res.headers[____0.strings[7]].like('*text/html*') ||
840
+ res.headers[____0.strings[7]].like('*text/plain*') ||
841
+ res.headers[____0.strings[7]].like('*application/json*'))
842
+ ) {
843
+ if (req.acceptEncoding.like('*gzip*') && typeof arg1 === 'string') {
844
+ res.set(____0.strings[8], 'gzip');
845
+ res.set('Vary', ____0.strings[5]);
846
+ arg1 = ____0.zlib.gzipSync(Buffer.from(arg1));
847
+ } else if (req.acceptEncoding.like('*deflate*') && typeof arg1 === 'string') {
848
+ res.set(____0.strings[8], 'deflate');
849
+ res.set('Vary', ____0.strings[5]);
850
+ arg1 = ____0.zlib.deflateSync(Buffer.from(arg1));
851
+ } else {
852
+ // ____0.log(typeof arg1)
853
+ }
854
+ }
848
855
 
849
- res.error = (code) => {
850
- res.status(code || 404).end();
851
- };
856
+ res.writeHead(res.code || res.statusCode || 200);
857
+ arg1 = arg1 || ' ';
858
+ res.ended = true;
859
+ return res.end0(arg1, arg2, arg3, arg4);
860
+ }
861
+ };
852
862
 
853
- res.download2 = (path, name) => {
854
- if (____0.isFileExistsSync(path)) {
855
- var stat = ____0.fileStatSync(path);
856
- if (stat && stat.isFile()) {
857
- res.writeHead(200, {
858
- 'Content-Type': ____0.getContentType(path),
859
- 'Content-Length': stat.size,
860
- 'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
861
- });
862
- var readStream = ____0.fs.createReadStream(path);
863
- readStream.on('end', function () {
864
- readStream.close();
865
- });
866
- res.on(____0.strings[10], function () {
867
- readStream.close();
868
- });
869
- readStream.pipe(res);
870
- } else {
871
- res.error();
863
+ res.status = (code) => {
864
+ if (!res.code) {
865
+ res.code = code || 200;
872
866
  }
873
- } else {
874
- res.error();
875
- }
876
- };
867
+ return res;
868
+ };
869
+
870
+ res.error = (code) => {
871
+ res.status(code || 404).end();
872
+ };
877
873
 
878
- res.download = function (path, name) {
879
- if (____0.isFileExistsSync(path)) {
880
- const stat = ____0.fileStatSync(path);
881
- if (stat && stat.isFile()) {
882
- const fileSize = stat.size;
883
- const range = req.headers.range;
884
- if (range) {
885
- const parts = range.replace(/bytes=/, '').split('-');
886
- const start = parseInt(parts[0], 10);
887
- const end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
888
-
889
- const chunksize = end - start + 1;
890
- const readStream = ____0.fs.createReadStream(path, {
891
- start,
892
- end,
874
+ res.download2 = (path, name) => {
875
+ if (____0.isFileExistsSync(path)) {
876
+ var stat = ____0.fileStatSync(path);
877
+ if (stat && stat.isFile()) {
878
+ res.writeHead(200, {
879
+ 'Content-Type': ____0.getContentType(path),
880
+ 'Content-Length': stat.size,
881
+ 'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
893
882
  });
883
+ var readStream = ____0.fs.createReadStream(path);
894
884
  readStream.on('end', function () {
895
885
  readStream.close();
896
886
  });
897
887
  res.on(____0.strings[10], function () {
898
888
  readStream.close();
899
889
  });
900
- res.writeHead(206, {
901
- 'Content-Range': `bytes ${start}-${end}/${fileSize}`,
902
- 'Accept-Ranges': 'bytes',
903
- 'Content-Length': chunksize,
904
- 'Content-Type': ____0.getContentType(path),
905
- });
906
890
  readStream.pipe(res);
907
891
  } else {
908
- const readStream = ____0.fs.createReadStream(path);
909
- readStream.on('end', function () {
910
- readStream.close();
911
- });
912
- res.on(____0.strings[10], function () {
913
- readStream.close();
914
- });
915
-
916
- res.writeHead(200, {
917
- 'Content-Length': fileSize,
918
- 'Content-Type': ____0.getContentType(path),
919
- 'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
920
- });
921
- ____0.fs.createReadStream(path).pipe(res);
892
+ res.error();
922
893
  }
923
894
  } else {
924
895
  res.error();
925
896
  }
926
- } else {
927
- res.error();
928
- }
929
- };
930
-
931
- res.html = res.render = function (file, _data = null, options = {}) {
932
- let filePath = '';
933
- if (typeof file === 'object') {
934
- filePath = file.path;
935
- options = { ...options, ...file };
936
- } else {
937
- filePath = file;
938
- }
897
+ };
939
898
 
940
- if ((response = ____0.sharedList.find((s) => s.host == req.host && s.filePath == filePath && s.url == req.url))) {
941
- res.headers = response.headers;
942
- res.code = response.code;
943
- res.set('x-shared', '-host=' + req.host + ' -port=' + ____0.options.port + ' -index=' + ____0.sharedList.length+ ' -count=' + req.route.count);
944
- return res.end(response.content, response.encode);
945
- }
946
- ____0.fsm.getContent(filePath, (content) => {
947
- if (!content) {
948
- if (_data && _data.html) {
949
- return res.status(404).htmlContent(_data.html);
899
+ res.download = function (path, name) {
900
+ if (____0.isFileExistsSync(path)) {
901
+ const stat = ____0.fileStatSync(path);
902
+ if (stat && stat.isFile()) {
903
+ const fileSize = stat.size;
904
+ const range = req.headers.range;
905
+ if (range) {
906
+ const parts = range.replace(/bytes=/, '').split('-');
907
+ const start = parseInt(parts[0], 10);
908
+ const end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
909
+
910
+ const chunksize = end - start + 1;
911
+ const readStream = ____0.fs.createReadStream(path, {
912
+ start,
913
+ end,
914
+ });
915
+ readStream.on('end', function () {
916
+ readStream.close();
917
+ });
918
+ res.on(____0.strings[10], function () {
919
+ readStream.close();
920
+ });
921
+ res.writeHead(206, {
922
+ 'Content-Range': `bytes ${start}-${end}/${fileSize}`,
923
+ 'Accept-Ranges': 'bytes',
924
+ 'Content-Length': chunksize,
925
+ 'Content-Type': ____0.getContentType(path),
926
+ });
927
+ readStream.pipe(res);
928
+ } else {
929
+ const readStream = ____0.fs.createReadStream(path);
930
+ readStream.on('end', function () {
931
+ readStream.close();
932
+ });
933
+ res.on(____0.strings[10], function () {
934
+ readStream.close();
935
+ });
936
+
937
+ res.writeHead(200, {
938
+ 'Content-Length': fileSize,
939
+ 'Content-Type': ____0.getContentType(path),
940
+ 'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
941
+ });
942
+ ____0.fs.createReadStream(path).pipe(res);
943
+ }
950
944
  } else {
951
- return res.status(404).end();
945
+ res.error();
952
946
  }
947
+ } else {
948
+ res.error();
953
949
  }
950
+ };
954
951
 
955
- req.content = content;
956
- req.data = { ...req.data, ..._data };
957
- let route = { ...req.route, ...options };
958
-
959
- if (route.encript == '123') {
960
- req.content = ____0.f1(req.content);
952
+ res.html = res.render = function (file, _data = null, options = {}) {
953
+ let filePath = '';
954
+ if (typeof file === 'object') {
955
+ filePath = file.path;
956
+ options = { ...options, ...file };
957
+ } else {
958
+ filePath = file;
961
959
  }
962
960
 
963
- if (route.parser) {
964
- req.content = ____0.parser(req, res, ____0, route).html(req.content);
961
+ if ((response = ____0.sharedList.find((s) => s.host == req.host && s.filePath == filePath && s.url == req.url))) {
962
+ res.headers = response.headers;
963
+ res.code = response.code;
964
+ res.set('x-shared', '-host=' + req.host + ' -port=' + ____0.options.port + ' -index=' + ____0.sharedList.length + ' -count=' + req.route.count);
965
+ return res.end(response.content, response.encode);
965
966
  }
967
+ ____0.fsm.getContent(filePath, (content) => {
968
+ if (!content) {
969
+ if (_data && _data.html) {
970
+ return res.status(404).htmlContent(_data.html);
971
+ } else {
972
+ return res.status(404).end();
973
+ }
974
+ }
966
975
 
967
- if (route.compress) {
968
- req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
969
- }
976
+ req.content = content;
977
+ req.data = { ...req.data, ..._data };
978
+ let route = { ...req.route, ...options };
970
979
 
971
- res.status(options.code || 200);
972
- if (filePath.endsWith('.css')) {
973
- res.set(____0.strings[7], 'text/css');
974
- if (____0.options.cache.enabled && route.cache) {
975
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
976
- }
977
- } else if (filePath.endsWith('.js')) {
978
- res.set(____0.strings[7], 'application/javascript');
979
- if (____0.options.cache.enabled && route.cache) {
980
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
981
- }
982
- } else if (filePath.endsWith('.html')) {
983
- res.set(____0.strings[7], 'text/html');
984
- if (____0.options.cache.enabled && route.cache) {
985
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
986
- }
987
- } else if (filePath.endsWith('.txt')) {
988
- res.set(____0.strings[7], 'text/plain');
989
- if (____0.options.cache.enabled && route.cache) {
990
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
991
- }
992
- } else if (filePath.endsWith('.json')) {
993
- res.set(____0.strings[7], 'application/json');
994
- if (____0.options.cache.enabled && route.cache) {
995
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
996
- }
997
- } else if (filePath.endsWith('.xml')) {
998
- res.set(____0.strings[7], 'text/xml');
999
- if (____0.options.cache.enabled && route.cache) {
1000
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
1001
- }
1002
- } else if (filePath.endsWith('.woff2')) {
1003
- res.set(____0.strings[7], 'application/font-woff2');
1004
- if (____0.options.cache.enabled && route.cache) {
1005
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
980
+ if (route.encript == '123') {
981
+ req.content = ____0.f1(req.content);
1006
982
  }
1007
- } else if (filePath.endsWith('.woff')) {
1008
- res.set(____0.strings[7], 'application/font-woff');
1009
- if (____0.options.cache.enabled && route.cache) {
1010
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
983
+
984
+ if (route.parser) {
985
+ req.content = ____0.parser(req, res, ____0, route).html(req.content);
1011
986
  }
1012
- } else if (filePath.endsWith('.ttf')) {
1013
- res.set(____0.strings[7], 'application/font-ttf');
1014
- if (____0.options.cache.enabled && route.cache) {
1015
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
987
+
988
+ if (route.compress) {
989
+ req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
1016
990
  }
1017
- } else if (filePath.endsWith('.svg')) {
1018
- res.set(____0.strings[7], 'application/font-svg');
1019
- if (____0.options.cache.enabled && route.cache) {
1020
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
991
+
992
+ res.status(options.code || 200);
993
+ if (filePath.endsWith('.css')) {
994
+ res.set(____0.strings[7], 'text/css');
995
+ if (____0.options.cache.enabled && route.cache) {
996
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
997
+ }
998
+ } else if (filePath.endsWith('.js')) {
999
+ res.set(____0.strings[7], 'application/javascript');
1000
+ if (____0.options.cache.enabled && route.cache) {
1001
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
1002
+ }
1003
+ } else if (filePath.endsWith('.html')) {
1004
+ res.set(____0.strings[7], 'text/html');
1005
+ if (____0.options.cache.enabled && route.cache) {
1006
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
1007
+ }
1008
+ } else if (filePath.endsWith('.txt')) {
1009
+ res.set(____0.strings[7], 'text/plain');
1010
+ if (____0.options.cache.enabled && route.cache) {
1011
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
1012
+ }
1013
+ } else if (filePath.endsWith('.json')) {
1014
+ res.set(____0.strings[7], 'application/json');
1015
+ if (____0.options.cache.enabled && route.cache) {
1016
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
1017
+ }
1018
+ } else if (filePath.endsWith('.xml')) {
1019
+ res.set(____0.strings[7], 'text/xml');
1020
+ if (____0.options.cache.enabled && route.cache) {
1021
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
1022
+ }
1023
+ } else if (filePath.endsWith('.woff2')) {
1024
+ res.set(____0.strings[7], 'application/font-woff2');
1025
+ if (____0.options.cache.enabled && route.cache) {
1026
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1027
+ }
1028
+ } else if (filePath.endsWith('.woff')) {
1029
+ res.set(____0.strings[7], 'application/font-woff');
1030
+ if (____0.options.cache.enabled && route.cache) {
1031
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1032
+ }
1033
+ } else if (filePath.endsWith('.ttf')) {
1034
+ res.set(____0.strings[7], 'application/font-ttf');
1035
+ if (____0.options.cache.enabled && route.cache) {
1036
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1037
+ }
1038
+ } else if (filePath.endsWith('.svg')) {
1039
+ res.set(____0.strings[7], 'application/font-svg');
1040
+ if (____0.options.cache.enabled && route.cache) {
1041
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1042
+ }
1043
+ } else if (filePath.endsWith('.otf')) {
1044
+ res.set(____0.strings[7], 'application/font-otf');
1045
+ if (____0.options.cache.enabled && route.cache) {
1046
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1047
+ }
1048
+ } else if (filePath.endsWith('.eot')) {
1049
+ res.set(____0.strings[7], 'application/font-eot');
1050
+ if (____0.options.cache.enabled && route.cache) {
1051
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1052
+ }
1053
+ } else if (filePath.endsWith('.gif')) {
1054
+ res.set(____0.strings[7], 'image/gif');
1055
+ if (____0.options.cache.enabled && route.cache) {
1056
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1057
+ }
1058
+ } else if (filePath.endsWith('.png')) {
1059
+ res.set(____0.strings[7], 'image/png');
1060
+ if (____0.options.cache.enabled && route.cache) {
1061
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1062
+ }
1063
+ } else if (filePath.endsWith('.jpg')) {
1064
+ res.set(____0.strings[7], 'image/jpg');
1065
+ if (____0.options.cache.enabled && route.cache) {
1066
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1067
+ }
1068
+ } else if (filePath.endsWith('.jpeg')) {
1069
+ res.set(____0.strings[7], 'image/jpeg');
1070
+ if (____0.options.cache.enabled && route.cache) {
1071
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1072
+ }
1073
+ } else if (filePath.endsWith('.ico')) {
1074
+ res.set(____0.strings[7], 'image/ico');
1075
+ if (____0.options.cache.enabled && route.cache) {
1076
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1077
+ }
1078
+ } else if (filePath.endsWith('.bmp')) {
1079
+ res.set(____0.strings[7], 'image/bmp');
1080
+ if (____0.options.cache.enabled && route.cache) {
1081
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1082
+ }
1083
+ } else if (filePath.endsWith('.webp')) {
1084
+ res.set(____0.strings[7], 'image/webp');
1085
+ if (____0.options.cache.enabled && route.cache) {
1086
+ res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1087
+ }
1021
1088
  }
1022
- } else if (filePath.endsWith('.otf')) {
1023
- res.set(____0.strings[7], 'application/font-otf');
1024
- if (____0.options.cache.enabled && route.cache) {
1025
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1089
+
1090
+ let response = {
1091
+ host: req.host,
1092
+ url: req.url,
1093
+ filePath: filePath,
1094
+ content: req.content,
1095
+ encode: ____0.getFileEncode(filePath),
1096
+ headers: res.headers,
1097
+ code: res.code,
1098
+ };
1099
+
1100
+ if (options.shared && !____0.sharedList.some((s) => s.host == req.host && s.filePath == response.filePath && s.url == response.url)) {
1101
+ ____0.sharedList.push(response);
1026
1102
  }
1027
- } else if (filePath.endsWith('.eot')) {
1028
- res.set(____0.strings[7], 'application/font-eot');
1029
- if (____0.options.cache.enabled && route.cache) {
1030
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
1103
+
1104
+ res.end(response.content, response.encode);
1105
+ });
1106
+ };
1107
+
1108
+ res.txt = (name, _data) => {
1109
+ ____0.fsm.getContent(name, (content) => {
1110
+ if (!content) {
1111
+ return res.status(404).end();
1031
1112
  }
1032
- } else if (filePath.endsWith('.gif')) {
1033
- res.set(____0.strings[7], 'image/gif');
1034
- if (____0.options.cache.enabled && route.cache) {
1035
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1113
+ req.route.content = content;
1114
+ if (req.route.encript === '123') {
1115
+ req.route.content = ____0.f1(req.route.content);
1036
1116
  }
1037
- } else if (filePath.endsWith('.png')) {
1038
- res.set(____0.strings[7], 'image/png');
1039
- if (____0.options.cache.enabled && route.cache) {
1040
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1117
+ req.data = { ...req.data, ..._data };
1118
+ req.route.parser = 'txt';
1119
+ let out = ____0.parser(req, res, ____0, req.route).txt(req.route.content);
1120
+ res.set(____0.strings[7], 'text/plain');
1121
+ res.status(200).end(out);
1122
+ });
1123
+ };
1124
+
1125
+ res.css = (name, _data) => {
1126
+ ____0.fsm.getContent(name, (content) => {
1127
+ if (!content) {
1128
+ return res.status(404).end();
1041
1129
  }
1042
- } else if (filePath.endsWith('.jpg')) {
1043
- res.set(____0.strings[7], 'image/jpg');
1044
- if (____0.options.cache.enabled && route.cache) {
1045
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1130
+ req.route.content = content;
1131
+ if (req.route.encript === '123') {
1132
+ req.route.content = ____0.f1(req.route.content);
1046
1133
  }
1047
- } else if (filePath.endsWith('.jpeg')) {
1048
- res.set(____0.strings[7], 'image/jpeg');
1049
- if (____0.options.cache.enabled && route.cache) {
1050
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1134
+ req.data = { ...req.data, ..._data };
1135
+ req.route.parser = 'css';
1136
+ let out = ____0.parser(req, res, ____0, req.route).css(req.route.content);
1137
+ res.set(____0.strings[7], 'text/css');
1138
+ res.status(200).end(out);
1139
+ });
1140
+ };
1141
+
1142
+ res.js = (name, _data) => {
1143
+ ____0.fsm.getContent(name, (content) => {
1144
+ if (!content) {
1145
+ return res.status(404).end();
1051
1146
  }
1052
- } else if (filePath.endsWith('.ico')) {
1053
- res.set(____0.strings[7], 'image/ico');
1054
- if (____0.options.cache.enabled && route.cache) {
1055
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1147
+ req.route.content = content;
1148
+ if (req.route.encript === '123') {
1149
+ req.route.content = ____0.f1(req.route.content);
1056
1150
  }
1057
- } else if (filePath.endsWith('.bmp')) {
1058
- res.set(____0.strings[7], 'image/bmp');
1059
- if (____0.options.cache.enabled && route.cache) {
1060
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1151
+ req.data = { ...req.data, ..._data };
1152
+ req.route.parser = 'js';
1153
+ let out = ____0.parser(req, res, ____0, req.route).js(req.route.content);
1154
+ res.set(____0.strings[7], 'text/javascript');
1155
+ res.status(200).end(out);
1156
+ });
1157
+ };
1158
+
1159
+ res.jsonFile = (name, _data) => {
1160
+ ____0.fsm.getContent(name, (content) => {
1161
+ if (!content) {
1162
+ return res.status(404).end();
1061
1163
  }
1062
- } else if (filePath.endsWith('.webp')) {
1063
- res.set(____0.strings[7], 'image/webp');
1064
- if (____0.options.cache.enabled && route.cache) {
1065
- res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
1164
+ req.route.content = content;
1165
+ if (req.route.encript === '123') {
1166
+ req.route.content = ____0.f1(req.route.content);
1066
1167
  }
1067
- }
1068
-
1069
- let response = {
1070
- host: req.host,
1071
- url: req.url,
1072
- filePath: filePath,
1073
- content: req.content,
1074
- encode: ____0.getFileEncode(filePath),
1075
- headers: res.headers,
1076
- code: res.code,
1077
- };
1078
-
1079
- if (options.shared && !____0.sharedList.some((s) => s.host == req.host && s.filePath == response.filePath && s.url == response.url)) {
1080
- ____0.sharedList.push(response);
1081
- }
1082
-
1083
- res.end(response.content, response.encode);
1084
- });
1085
- };
1168
+ req.data = { ...req.data, ..._data };
1169
+ req.route.parser = 'json';
1170
+ let out = ____0.parser(req, res, ____0, req.route).html(req.route.content);
1171
+ res.set(____0.strings[7], 'application/json');
1172
+ res.status(200).end(out);
1173
+ });
1174
+ };
1086
1175
 
1087
- res.txt = (name, _data) => {
1088
- ____0.fsm.getContent(name, (content) => {
1089
- if (!content) {
1090
- return res.status(404).end();
1176
+ res.htmlContent =
1177
+ res.send =
1178
+ res.sendHTML =
1179
+ (text) => {
1180
+ if (typeof text === 'string') {
1181
+ res.set(____0.strings[7], 'text/html');
1182
+ res.status(200).end(text);
1183
+ } else {
1184
+ res.json(text);
1185
+ }
1186
+ };
1187
+ res.textContent = res.sendTEXT = (text) => {
1188
+ if (typeof text === 'string') {
1189
+ res.set(____0.strings[7], 'text/plain');
1190
+ res.status(200).end(text);
1191
+ } else {
1192
+ res.json(text);
1091
1193
  }
1092
- req.route.content = content;
1093
- if (req.route.encript === '123') {
1094
- req.route.content = ____0.f1(req.route.content);
1194
+ };
1195
+ res.json = (obj, time) => {
1196
+ if (typeof obj === 'string') {
1197
+ return res.jsonFile(obj);
1198
+ } else {
1199
+ res.set(____0.strings[7], 'application/json');
1200
+ obj = ____0.toJson(obj);
1201
+ res.status(200).ending(time || 0, obj);
1202
+ obj = null;
1203
+ return res;
1095
1204
  }
1096
- req.data = { ...req.data, ..._data };
1097
- req.route.parser = 'txt';
1098
- let out = ____0.parser(req, res, ____0, req.route).txt(req.route.content);
1099
- res.set(____0.strings[7], 'text/plain');
1100
- res.status(200).end(out);
1101
- });
1102
- };
1205
+ };
1103
1206
 
1104
- res.css = (name, _data) => {
1105
- ____0.fsm.getContent(name, (content) => {
1106
- if (!content) {
1107
- return res.status(404).end();
1108
- }
1109
- req.route.content = content;
1110
- if (req.route.encript === '123') {
1111
- req.route.content = ____0.f1(req.route.content);
1112
- }
1113
- req.data = { ...req.data, ..._data };
1114
- req.route.parser = 'css';
1115
- let out = ____0.parser(req, res, ____0, req.route).css(req.route.content);
1116
- res.set(____0.strings[7], 'text/css');
1117
- res.status(200).end(out);
1118
- });
1119
- };
1207
+ res.redirect = (url, code = 302) => {
1208
+ res.set('Location', url);
1209
+ res.status(code).end();
1210
+ };
1120
1211
 
1121
- res.js = (name, _data) => {
1122
- ____0.fsm.getContent(name, (content) => {
1123
- if (!content) {
1124
- return res.status(404).end();
1125
- }
1126
- req.route.content = content;
1127
- if (req.route.encript === '123') {
1128
- req.route.content = ____0.f1(req.route.content);
1129
- }
1130
- req.data = { ...req.data, ..._data };
1131
- req.route.parser = 'js';
1132
- let out = ____0.parser(req, res, ____0, req.route).js(req.route.content);
1133
- res.set(____0.strings[7], 'text/javascript');
1134
- res.status(200).end(out);
1135
- });
1136
- };
1212
+ res.set('CharSet', 'UTF-8');
1213
+ res.set('Access-Control-Allow-Credentials', 'true');
1214
+ res.set('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept , Access-Token , Authorization');
1215
+ res.set('Access-Control-Allow-Methods', req.headers['access-control-request-method'] || 'POST,GET,DELETE,PUT,OPTIONS,VIEW,HEAD,CONNECT,TRACE');
1216
+ res.set('Access-Control-Allow-Origin', req.referer || '*');
1217
+ if (req.origin) {
1218
+ res.set('Access-Control-Allow-Origin', req.origin);
1219
+ }
1137
1220
 
1138
- res.jsonFile = (name, _data) => {
1139
- ____0.fsm.getContent(name, (content) => {
1140
- if (!content) {
1141
- return res.status(404).end();
1142
- }
1143
- req.route.content = content;
1144
- if (req.route.encript === '123') {
1145
- req.route.content = ____0.f1(req.route.content);
1221
+ ____0.validateRequest(req, res, (req, res) => {
1222
+ if (____0.options.www === false && req.host.contains('www')) {
1223
+ res.redirect('//' + req.host.replace('www.', '') + req.url, 301);
1224
+ return;
1146
1225
  }
1147
- req.data = { ...req.data, ..._data };
1148
- req.route.parser = 'json';
1149
- let out = ____0.parser(req, res, ____0, req.route).html(req.route.content);
1150
- res.set(____0.strings[7], 'application/json');
1151
- res.status(200).end(out);
1152
- });
1153
- };
1154
1226
 
1155
- res.htmlContent =
1156
- res.send =
1157
- res.sendHTML =
1158
- (text) => {
1159
- if (typeof text === 'string') {
1160
- res.set(____0.strings[7], 'text/html');
1161
- res.status(200).end(text);
1162
- } else {
1163
- res.json(text);
1227
+ if (!req.urlParser.pathname.like(____0.strings[0])) {
1228
+ if (!____0._0_a405) {
1229
+ res.status(405);
1230
+ res.end();
1231
+ return;
1164
1232
  }
1165
- };
1166
- res.textContent = res.sendTEXT = (text) => {
1167
- if (typeof text === 'string') {
1168
- res.set(____0.strings[7], 'text/plain');
1169
- res.status(200).end(text);
1170
- } else {
1171
- res.json(text);
1172
- }
1173
- };
1174
- res.json = (obj, time) => {
1175
- if (typeof obj === 'string') {
1176
- return res.jsonFile(obj);
1177
- } else {
1178
- res.set(____0.strings[7], 'application/json');
1179
- obj = ____0.toJson(obj);
1180
- res.status(200).ending(time || 0, obj);
1181
- obj = null;
1182
- return res;
1183
- }
1184
- };
1185
-
1186
- res.redirect = (url, code = 302) => {
1187
- res.set('Location', url);
1188
- res.status(code).end();
1189
- };
1190
-
1191
- res.set('CharSet', 'UTF-8');
1192
- res.set('Access-Control-Allow-Credentials', 'true');
1193
- res.set('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept , Access-Token , Authorization');
1194
- res.set('Access-Control-Allow-Methods', req.headers['access-control-request-method'] || 'POST,GET,DELETE,PUT,OPTIONS,VIEW,HEAD,CONNECT,TRACE');
1195
- res.set('Access-Control-Allow-Origin', req.referer || '*');
1196
- if (req.origin) {
1197
- res.set('Access-Control-Allow-Origin', req.origin);
1198
- }
1199
1233
 
1200
- if (____0.options.www === false && req.host.contains('www')) {
1201
- res.redirect('//' + req.host.replace('www.', '') + req.url, 301);
1202
- return;
1203
- }
1204
-
1205
- if (!req.urlParser.pathname.like(____0.strings[0])) {
1206
- if (!____0._0_a405) {
1207
- res.status(405);
1208
- res.end();
1209
- return;
1210
- }
1211
-
1212
- if (!____0._0_ar2_0_) {
1213
- res.set(____0.strings[1], 'true');
1214
- res.status(402);
1215
- if (req.url.like('*api*')) {
1216
- return res.json({
1217
- done: false,
1218
- error: ____0.strings[3],
1219
- });
1220
- } else {
1221
- return res.render(
1222
- ____0.strings[2],
1223
- {
1224
- html: ____0.strings[3],
1225
- },
1226
- {
1227
- parser: ____0.strings[17],
1234
+ if (!____0._0_ar2_0_) {
1235
+ res.set(____0.strings[1], 'true');
1236
+ res.status(402);
1237
+ if (req.url.like('*api*')) {
1238
+ return res.json({
1239
+ done: false,
1240
+ error: ____0.strings[3],
1241
+ });
1242
+ } else {
1243
+ return res.render(
1244
+ ____0.strings[2],
1245
+ {
1246
+ html: ____0.strings[3],
1247
+ },
1248
+ {
1249
+ parser: ____0.strings[17],
1250
+ }
1251
+ );
1228
1252
  }
1229
- );
1253
+ }
1230
1254
  }
1231
- }
1232
- }
1233
1255
 
1234
- let findRouteIndex = _0xrrxo.list.findIndex((r) => req.method.toLowerCase().like(r.method.toLowerCase()) && req.urlParser.pathname.like(r.name));
1235
- if (findRouteIndex !== -1) {
1236
-
1237
- if (!_0xrrxo.list[findRouteIndex].count) {
1238
- _0xrrxo.list[findRouteIndex].count = 0;
1239
- }
1240
- _0xrrxo.list[findRouteIndex].count++;
1241
- if (____0.options.help) {
1242
- res.set('help-request-count', _0xrrxo.list[findRouteIndex].count);
1243
- }
1256
+ let findRouteIndex = _0xrrxo.list.findIndex((r) => req.method.toLowerCase().like(r.method.toLowerCase()) && req.urlParser.pathname.like(r.name));
1257
+ if (findRouteIndex !== -1) {
1258
+ if (!_0xrrxo.list[findRouteIndex].count) {
1259
+ _0xrrxo.list[findRouteIndex].count = 0;
1260
+ }
1261
+ _0xrrxo.list[findRouteIndex].count++;
1262
+ if (____0.options.help) {
1263
+ res.set('help-request-count', _0xrrxo.list[findRouteIndex].count);
1264
+ }
1244
1265
 
1245
- req.route = _0xrrxo.list[findRouteIndex];
1266
+ req.route = _0xrrxo.list[findRouteIndex];
1246
1267
 
1247
- req.urlParser.arr = req.urlParser.pathname.split('/');
1248
- req.urlParserRaw.arr = req.urlParserRaw.pathname.split('/');
1268
+ req.urlParser.arr = req.urlParser.pathname.split('/');
1269
+ req.urlParserRaw.arr = req.urlParserRaw.pathname.split('/');
1249
1270
 
1250
- for (let i = 0; i < req.route.map.length; i++) {
1251
- let map = req.route.map[i];
1252
- if (typeof req.urlParser.arr[map.index] === 'string') {
1253
- try {
1254
- req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index].replace(/\+/g, ' '));
1255
- } catch (error) {
1256
- req.params[map.name] = req.urlParser.arr[map.index].replace(/\+/g, ' ');
1271
+ for (let i = 0; i < req.route.map.length; i++) {
1272
+ let map = req.route.map[i];
1273
+ if (typeof req.urlParser.arr[map.index] === 'string') {
1274
+ try {
1275
+ req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index].replace(/\+/g, ' '));
1276
+ } catch (error) {
1277
+ req.params[map.name] = req.urlParser.arr[map.index].replace(/\+/g, ' ');
1278
+ }
1279
+ req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
1280
+ }
1257
1281
  }
1258
- req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
1259
- }
1260
- }
1261
- req.session = {
1262
- $save: () => {},
1263
- accessToken: 'SHARED',
1264
- language: ____0.options.language || { id: 'en', dir: 'ltr' },
1265
- lang: ____0.options.language?.id || ____0.options.lang || 'en',
1266
- };
1282
+ req.session = {
1283
+ $save: () => {},
1284
+ accessToken: 'SHARED',
1285
+ language: ____0.options.language || { id: 'En', dir: 'ltr', text: 'left' },
1286
+ lang: ____0.options.language?.id || ____0.options.lang || 'En',
1287
+ };
1288
+
1289
+ req.query = req.urlParser.query;
1290
+ req.queryRaw = req.urlParserRaw.query;
1291
+
1292
+ ____0.validateRoute(req, res, (req, res) => {
1293
+ if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/urlencoded/i)) {
1294
+ req.on('data', function (data) {
1295
+ req.bodyRaw += data;
1296
+ });
1297
+ req.on('end', function () {
1298
+ req.dataRaw = req.bodyRaw;
1299
+ req.data = req.body = ____0.querystring.parse(req.bodyRaw);
1300
+ if (____0.options.session.enabled) {
1301
+ ____0.session(req, res, ____0, function (session) {
1302
+ req.session = session;
1303
+ ____0.validateSession(req, res, (req, res) => {
1304
+ _0xrrxo.handleRoute(req, res, req.route);
1305
+ });
1306
+ });
1307
+ } else {
1308
+ _0xrrxo.handleRoute(req, res, req.route);
1309
+ }
1310
+ });
1311
+ } else if (req.method.contains('post') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].contains('multipart')) {
1312
+ let form = ____0.formidable({
1313
+ multiples: !0,
1314
+ uploadDir: ____0.options.upload_dir,
1315
+ });
1316
+
1317
+ form.parse(req, (err, fields, files) => {
1318
+ if (err) {
1319
+ ____0.log(err);
1320
+ }
1321
+ req.form = { err, fields, files };
1322
+ req.data = req.body = fields || {};
1323
+ req.files = files;
1324
+ if (____0.options.session.enabled) {
1325
+ ____0.session(req, res, ____0, function (session) {
1326
+ req.session = session;
1327
+ ____0.validateSession(req, res, (req, res) => {
1328
+ _0xrrxo.handleRoute(req, res, req.route);
1329
+ });
1330
+ });
1331
+ } else {
1332
+ _0xrrxo.handleRoute(req, res, req.route);
1333
+ }
1334
+ });
1267
1335
 
1268
- req.query = req.urlParser.query;
1269
- req.queryRaw = req.urlParserRaw.query;
1336
+ return;
1337
+ } else if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/json/i)) {
1338
+ req.on('data', function (data) {
1339
+ req.bodyRaw += data;
1340
+ });
1341
+ req.on('end', function () {
1342
+ req.dataRaw = req.bodyRaw;
1343
+ req.data = req.body = ____0.fromJson(req.bodyRaw);
1344
+ if (____0.options.session.enabled) {
1345
+ ____0.session(req, res, ____0, function (session) {
1346
+ req.session = session;
1347
+ ____0.validateSession(req, res, (req, res) => {
1348
+ _0xrrxo.handleRoute(req, res, req.route);
1349
+ });
1350
+ });
1351
+ } else {
1352
+ _0xrrxo.handleRoute(req, res, req.route);
1353
+ }
1354
+ });
1355
+ } else if (!req.method.toLowerCase().like('get')) {
1356
+ req.on('data', function (data) {
1357
+ req.bodyRaw += data;
1358
+ });
1359
+ req.on('end', function () {
1360
+ req.dataRaw = req.bodyRaw;
1361
+ req.data = req.body = ____0.fromJson(req.bodyRaw);
1362
+ if (____0.options.session.enabled) {
1363
+ ____0.session(req, res, ____0, function (session) {
1364
+ req.session = session;
1365
+ ____0.validateSession(req, res, (req, res) => {
1366
+ _0xrrxo.handleRoute(req, res, req.route);
1367
+ });
1368
+ });
1369
+ } else {
1370
+ _0xrrxo.handleRoute(req, res, req.route);
1371
+ }
1372
+ });
1373
+ } else {
1374
+ req.body = req.data = req.query;
1375
+ req.bodyRaw = req.dataRaw = req.queryRaw;
1376
+
1377
+ if (____0.options.session.enabled) {
1378
+ ____0.session(req, res, ____0, function (session) {
1379
+ req.session = session;
1380
+ ____0.validateSession(req, res, (req, res) => {
1381
+ _0xrrxo.handleRoute(req, res, req.route);
1382
+ });
1383
+ });
1384
+ } else {
1385
+ _0xrrxo.handleRoute(req, res, req.route);
1386
+ }
1387
+ return;
1388
+ }
1389
+ });
1270
1390
 
1271
- if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/urlencoded/i)) {
1272
- req.on('data', function (data) {
1273
- req.bodyRaw += data;
1274
- });
1275
- req.on('end', function () {
1276
- req.dataRaw = req.bodyRaw;
1277
- req.data = req.body = ____0.querystring.parse(req.bodyRaw);
1278
- if (____0.options.session.enabled) {
1279
- ____0.session(req, res, ____0, function (session) {
1280
- req.session = session;
1281
- _0xrrxo.handleRoute(req, res, req.route);
1282
- });
1283
- } else {
1284
- _0xrrxo.handleRoute(req, res, req.route);
1391
+ return;
1392
+ } else {
1393
+ if (req.urlParser.pathname == '/') {
1394
+ if (____0.options.help) {
1395
+ res.set('help-eror-message', 'unhandled route root : ' + req.urlParser.pathname);
1396
+ }
1397
+ res.htmlContent("<h1 align='center'>Base Route / Not Set</h1>");
1398
+ return;
1285
1399
  }
1286
- });
1287
- } else if (req.method.contains('post') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].contains('multipart')) {
1288
- let form = ____0.formidable({
1289
- multiples: !0,
1290
- uploadDir: ____0.options.upload_dir,
1291
- });
1292
1400
 
1293
- form.parse(req, (err, fields, files) => {
1294
- if (err) {
1295
- ____0.log(err);
1296
- }
1297
- req.form = { err, fields, files };
1298
- req.data = req.body = fields || {};
1299
- req.files = files;
1300
- if (____0.options.session.enabled) {
1301
- ____0.session(req, res, ____0, function (session) {
1302
- req.session = session;
1303
- _0xrrxo.handleRoute(req, res, req.route);
1304
- });
1305
- } else {
1306
- _0xrrxo.handleRoute(req, res, req.route);
1401
+ if (____0.options.help) {
1402
+ res.set('help-eror-message', 'unhandled route help : ' + req.urlParser.pathname);
1307
1403
  }
1308
- });
1309
1404
 
1310
- return;
1311
- } else if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/json/i)) {
1312
- req.on('data', function (data) {
1313
- req.bodyRaw += data;
1314
- });
1315
- req.on('end', function () {
1316
- req.dataRaw = req.bodyRaw;
1317
- req.data = req.body = ____0.fromJson(req.bodyRaw);
1318
- if (____0.options.session.enabled) {
1319
- ____0.session(req, res, ____0, function (session) {
1320
- req.session = session;
1321
- _0xrrxo.handleRoute(req, res, req.route);
1322
- });
1323
- } else {
1324
- _0xrrxo.handleRoute(req, res, req.route);
1325
- }
1326
- });
1327
- } else if (!req.method.toLowerCase().like('get')) {
1328
- req.on('data', function (data) {
1329
- req.bodyRaw += data;
1330
- });
1331
- req.on('end', function () {
1332
- req.dataRaw = req.bodyRaw;
1333
- req.data = req.body = ____0.fromJson(req.bodyRaw);
1334
- if (____0.options.session.enabled) {
1335
- ____0.session(req, res, ____0, function (session) {
1336
- req.session = session;
1337
- _0xrrxo.handleRoute(req, res, req.route);
1338
- });
1339
- } else {
1340
- _0xrrxo.handleRoute(req, res, req.route);
1405
+ if (req.method.toLowerCase().like('options') || req.method.toLowerCase().like('head')) {
1406
+ res.status(200).end();
1407
+ return;
1341
1408
  }
1342
- });
1343
- } else {
1344
- req.body = req.data = req.query;
1345
- req.bodyRaw = req.dataRaw = req.queryRaw;
1346
-
1347
- if (____0.options.session.enabled) {
1348
- ____0.session(req, res, ____0, function (session) {
1349
- req.session = session;
1350
- _0xrrxo.handleRoute(req, res, req.route);
1351
- });
1352
- } else {
1353
- _0xrrxo.handleRoute(req, res, req.route);
1354
- }
1355
- return;
1356
- }
1357
-
1358
- return;
1359
- } else {
1360
- if (req.urlParser.pathname == '/') {
1361
- if (____0.options.help) {
1362
- res.set('help-eror-message', 'unhandled route root : ' + req.urlParser.pathname);
1409
+ ____0.handleNotRoute(req, res);
1363
1410
  }
1364
- res.htmlContent("<h1 align='center'>Base Route / Not Set</h1>");
1365
- return;
1366
- }
1367
-
1368
- if (____0.options.help) {
1369
- res.set('help-eror-message', 'unhandled route help : ' + req.urlParser.pathname);
1370
- }
1371
-
1372
- if (req.method.toLowerCase().like('options') || req.method.toLowerCase().like('head')) {
1373
- res.status(200).end();
1374
- return;
1375
- }
1376
- ____0.handleNotRoute(req, res);
1377
- }
1411
+ });
1412
+ });
1378
1413
  };
1379
1414
 
1380
1415
  ____0.handleNotRoute = function (req, res) {
@@ -1418,7 +1453,7 @@ module.exports = function init(____0) {
1418
1453
  try {
1419
1454
  if (____0.options.http2) {
1420
1455
  let server = ____0.http2.createServer();
1421
- server.on('error', (err) => console.error(err));
1456
+ server.on('error', (err) => ____0.log(err));
1422
1457
  server.on('stream', (stream, headers) => {
1423
1458
  // _0xrrxo.handleStream(stream , headers , server);
1424
1459
  let path = headers[':path'];
@@ -1439,7 +1474,7 @@ module.exports = function init(____0) {
1439
1474
  server.timeout = 1000 * ____0.options.responseTimeout;
1440
1475
  server.on('error', (e) => {
1441
1476
  if (e.code === 'EADDRINUSE') {
1442
- console.error('Address in use, Closing Server : ' + p);
1477
+ ____0.log('Address in use, Closing Server : ' + p);
1443
1478
  server.close();
1444
1479
  }
1445
1480
  });
@@ -1460,7 +1495,7 @@ module.exports = function init(____0) {
1460
1495
  });
1461
1496
  }
1462
1497
  } catch (error) {
1463
- console.error(error);
1498
+ ____0.log(error);
1464
1499
  }
1465
1500
  });
1466
1501
 
@@ -1477,7 +1512,7 @@ module.exports = function init(____0) {
1477
1512
  server.timeout = 1000 * ____0.options.responseTimeout;
1478
1513
  server.on('error', (e) => {
1479
1514
  if (e.code === 'EADDRINUSE') {
1480
- console.error('Address in use, Closing Server : ' + p);
1515
+ ____0.log('Address in use, Closing Server : ' + p);
1481
1516
  server.close();
1482
1517
  }
1483
1518
  });