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