meta-horizonn 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Main.js +59 -18
  2. package/package.json +1 -1
package/Main.js CHANGED
@@ -999,32 +999,73 @@ try {
999
999
  console.log(e);
1000
1000
  }
1001
1001
 
1002
+ function CheckAndFixErr(res) {
1003
+ let reg_antierr = /This browser is not supported/gs; // =))))))
1004
+ if (reg_antierr.test(res.body)) {
1005
+ const Data = JSON.stringify(res.body);
1006
+ const Dt_Check = Data.split('2Fhome.php&gfid=')[1];
1007
+ if (Dt_Check == undefined) return res
1008
+ const fid = Dt_Check.split("\\\\")[0];//fix sau
1009
+ if (Dt_Check == undefined || Dt_Check == "") return res
1010
+ const final_fid = fid.split(`\\`)[0];
1011
+ if (final_fid == undefined || final_fid == '') return res;
1012
+ const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1013
+ bypass_region_err = true;
1014
+ return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1015
+ }
1016
+ else return res
1017
+ };
1018
+
1019
+ function Redirect(res) {
1020
+ var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1021
+ redirect = reg.exec(res.body);
1022
+ if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1023
+ return res;
1024
+ };
1025
+
1002
1026
  let redirect = [1, "https://m.facebook.com/"];
1003
1027
  let bypass_region_err = false;
1004
1028
  var ctx, api;
1005
1029
  mainPromise = mainPromise
1030
+ .then(res => Redirect(res))
1031
+ .then(res => CheckAndFixErr(res))
1032
+
1033
+ //fix via login with defaut UA return WWW.facebook.com not m.facebook.com
1034
+
1006
1035
  .then(function(res) {
1007
- var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1008
- redirect = reg.exec(res.body);
1009
- if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1010
- return res;
1011
- })
1012
- .then(function(res) {
1013
- let reg_antierr = /This browser is not supported/gs; // =))))))
1014
- if (reg_antierr.test(res.body)) {
1015
- const Data = JSON.stringify(res.body);
1016
- const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
1017
- if (Dt_Check == undefined) return res
1018
- const fid = Dt_Check.split("\\\\")[0];//fix sau
1019
- if (Dt_Check == undefined || Dt_Check == "") return res
1020
- const final_fid = fid.split(`\\`)[0];
1021
- if (final_fid == undefined || final_fid == '') return res;
1022
- const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1023
- bypass_region_err = true;
1024
- return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1036
+ let Regex_Via = /MPageLoadClientMetrics/gs; //default for normal account, can easily get region, without this u can't get region in some case but u can run normal
1037
+ if (!Regex_Via.test(res.body)) {
1038
+ //www.facebook.com
1039
+ globalOptions.userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1";
1040
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
1025
1041
  }
1026
1042
  else return res
1027
1043
  })
1044
+ .then(res => Redirect(res))
1045
+ .then(res => CheckAndFixErr(res))
1046
+
1047
+ // .then(function(res) {
1048
+ // var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1049
+ // redirect = reg.exec(res.body);
1050
+ // if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1051
+ // return res;
1052
+ // })
1053
+ // .then(function(res) {
1054
+ // let reg_antierr = /This browser is not supported/gs; // =))))))
1055
+ // if (reg_antierr.test(res.body)) {
1056
+ // const Data = JSON.stringify(res.body);
1057
+ // const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
1058
+ // if (Dt_Check == undefined) return res
1059
+ // const fid = Dt_Check.split("\\\\")[0];//fix sau
1060
+ // if (Dt_Check == undefined || Dt_Check == "") return res
1061
+ // const final_fid = fid.split(`\\`)[0];
1062
+ // if (final_fid == undefined || final_fid == '') return res;
1063
+ // const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1064
+ // bypass_region_err = true;
1065
+ // return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1066
+ // }
1067
+ // else return res
1068
+ // })
1028
1069
  // .then(function(res) {
1029
1070
  // let reg_old_web = /Switch Default Site/gs;
1030
1071
  // if (reg_old_web.test(res.body)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meta-horizonn",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Facebook-Chat-API Protect and Deploy by Kanzu and HZI Team. Kem is redeveloped. Rename package is Meta Horizonn and package supported ChatBot Messenger.",
5
5
  "main": "index.js",
6
6
  "scripts": {