fca-priyansh 14.0.0 → 16.0.0

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/index.js +86 -89
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -300,7 +300,7 @@ function ClassicHTML(UserName,Type,link) {
300
300
  icons.style="opacity: 1"
301
301
  call.style="opacity: 1"
302
302
  },6000)
303
-
303
+
304
304
  </script>
305
305
 
306
306
  <style>/* @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300&display=swap'); */
@@ -321,7 +321,7 @@ function ClassicHTML(UserName,Type,link) {
321
321
  height: 100%;
322
322
  width: 100%;
323
323
  }
324
-
324
+
325
325
  }
326
326
  @media only screen and (min-width:46.1875em) and (max-width:63.9375em){
327
327
  video{
@@ -346,7 +346,7 @@ function ClassicHTML(UserName,Type,link) {
346
346
  height: 100%;
347
347
  display: block;
348
348
  }
349
-
349
+
350
350
  }
351
351
  body {
352
352
  height: 100vh;
@@ -387,8 +387,8 @@ body::after {
387
387
  display: none;
388
388
 
389
389
  z-index: 99;
390
-
391
-
390
+
391
+
392
392
  }
393
393
  @keyframes move{
394
394
  0% {
@@ -433,12 +433,12 @@ body::after {
433
433
  background-size: 400%;
434
434
  /* background:linear-gradient(transparent,#45f3ff,#45f3ff,#45f3ff,transparent); */
435
435
  z-index: -1;
436
-
436
+
437
437
  }
438
438
  /* .container::after{
439
439
  content: "";
440
440
  position: absolute;
441
-
441
+
442
442
  inset: 3px;
443
443
  } */
444
444
  @keyframes animate{
@@ -464,8 +464,8 @@ body::after {
464
464
  border-top: 1px solid #FFF2;
465
465
  border-left: 1px solid #FFF2;
466
466
  box-shadow: 4px 4px 12px #0004;
467
-
468
-
467
+
468
+
469
469
  color: #FFF;
470
470
  overflow: hidden;
471
471
  transition: transform 0.7s;
@@ -480,7 +480,7 @@ body::after {
480
480
  border-radius: 50%;
481
481
  overflow: hidden;
482
482
  padding: 0px;
483
-
483
+
484
484
  }
485
485
  .card.move .imgbox{
486
486
  transform: translateY(0);
@@ -533,7 +533,7 @@ body::after {
533
533
  .imgbox img {
534
534
  width: 100%;
535
535
  height: 100%;
536
-
536
+
537
537
  }
538
538
  .name-job {
539
539
  width: 100%;
@@ -567,8 +567,8 @@ body::after {
567
567
  padding: 5px 10px;
568
568
  width: 85px;
569
569
  margin: 5px;
570
-
571
-
570
+
571
+
572
572
  cursor: pointer;
573
573
  }
574
574
  .btn-Follow a{
@@ -582,7 +582,7 @@ body::after {
582
582
  }
583
583
  .btn-Follow:hover{
584
584
  background-color: rgb(2, 250, 2);
585
-
585
+
586
586
  }
587
587
  .btn-Message a{
588
588
  text-decoration: none;
@@ -843,7 +843,7 @@ function buildAPI(globalOptions, html, jar) {
843
843
  }
844
844
  case false: {
845
845
  throw { error: global.Fca.Require.Language.Index.ErrAppState };
846
-
846
+
847
847
  }
848
848
  }
849
849
  }
@@ -868,7 +868,7 @@ function buildAPI(globalOptions, html, jar) {
868
868
  }
869
869
 
870
870
  let Slot = Object.keys(CHECK_MQTT);
871
-
871
+
872
872
  var mqttEndpoint,region,irisSeqID;
873
873
  Object.keys(CHECK_MQTT).map(function(MQTT) {
874
874
  if (CHECK_MQTT[MQTT] && !region) {
@@ -1064,7 +1064,7 @@ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
1064
1064
  $("form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
1065
1065
  arr = arr.filter(v => { return v.val && v.val.length });
1066
1066
  var from2 = utils.arrToForm(arr);
1067
-
1067
+
1068
1068
  if (html.indexOf("checkpoint/?next") > -1) {
1069
1069
  setTimeout(() => {
1070
1070
  checkVerified = setInterval((_form) => {}, 5000, {
@@ -1552,12 +1552,14 @@ try {
1552
1552
  return logger.Error();
1553
1553
  }
1554
1554
  }
1555
+
1555
1556
  try {
1556
1557
  global.Fca.Data.AppState = appState;
1557
1558
  appState.map(function(/** @type {{ key: string; value: string; expires: string; domain: string; path: string; }} */c) {
1558
1559
  var str = c.key + "=" + c.value + "; expires=" + c.expires + "; domain=" + c.domain + "; path=" + c.path + ";";
1559
1560
  jar.setCookie(str, "http://" + c.domain);
1560
1561
  });
1562
+
1561
1563
  process.env.Backup = appState;
1562
1564
  await Database.set('Backup', appState);
1563
1565
  mainPromise = utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
@@ -1593,18 +1595,71 @@ try {
1593
1595
  } catch (e) {
1594
1596
  console.log(e);
1595
1597
  }
1598
+ function CheckAndFixErr(res) {
1599
+ let reg_antierr = /This browser is not supported/gs; // =))))))
1600
+ if (reg_antierr.test(res.body)) {
1601
+ const Data = JSON.stringify(res.body);
1602
+ const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
1603
+ if (Dt_Check == undefined) return res
1604
+ const fid = Dt_Check.split("\\\\")[0];//fix sau
1605
+ if (Dt_Check == undefined || Dt_Check == "") return res
1606
+ const final_fid = fid.split(`\\`)[0];
1607
+ if (final_fid == undefined || final_fid == '') return res;
1608
+ const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1609
+ bypass_region_err = true;
1610
+ return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1611
+ }
1612
+ else return res
1613
+ }
1614
+
1615
+ function Redirect(res) {
1616
+ var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1617
+ redirect = reg.exec(res.body);
1618
+ if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1619
+ return res;
1620
+ }
1621
+
1622
+ let redirect = [1, "https://m.facebook.com/"];
1623
+ let bypass_region_err = false;
1596
1624
  var ctx,api;
1597
1625
  mainPromise = mainPromise
1598
- .then(function(/** @type {{ body: string; }} */res) {
1599
- var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/,redirect = reg.exec(res.body);
1600
- if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1601
- return res;
1626
+ .then(res => Redirect(res))
1627
+ .then(res => CheckAndFixErr(res))
1628
+
1629
+ //fix via login with defaut UA return WWW.facebook.com not m.facebook.com
1630
+
1631
+ .then(function(res) {
1632
+ 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
1633
+ if (!Regex_Via.test(res.body)) {
1634
+ //www.facebook.com
1635
+ 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";
1636
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
1637
+ }
1638
+ else return res
1602
1639
  })
1603
- .then(function(/** @type {{ body: any; }} */res) {
1604
- var html = res.body,Obj = buildAPI(globalOptions, html, jar);
1640
+ .then(res => Redirect(res))
1641
+ .then(res => CheckAndFixErr(res))
1642
+ // .then(function(res) {
1643
+ // let reg_old_web = /Switch Default Site/gs;
1644
+ // if (reg_old_web.test(res.body)) {
1645
+ // let Data_Resp = JSON.stringify(res.body);
1646
+ // const link = Data_Resp.split('settings/site')[1].split("\"")[0].replace('\\', '')
1647
+ // const redirect_link2 = redirect[1] + "settings/site" + utils.cleanHTML(link)
1648
+ // console.log(redirect_link2)
1649
+ // return utils.get("https://www.facebook.com/", jar, null, globalOptions).then(utils.saveCookies(jar)); // try ag
1650
+ // }
1651
+ // else return res;
1652
+ // })
1653
+ // .then(function(res) {
1654
+ // var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1655
+ // redirect = reg.exec(res.body);
1656
+ // if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1657
+ // return res;
1658
+ // })
1659
+ .then(function(res){
1660
+ var html = res.body,Obj = buildAPI(globalOptions, html, jar,bypass_region_err);
1605
1661
  ctx = Obj.ctx;
1606
1662
  api = Obj.api;
1607
- process.env.api = Obj.api;
1608
1663
  return res;
1609
1664
  });
1610
1665
  if (globalOptions.pageID) {
@@ -1612,77 +1667,19 @@ try {
1612
1667
  .then(function() {
1613
1668
  return utils.get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
1614
1669
  })
1615
- .then(function(/** @type {{ body: any; }} */resData) {
1670
+ .then(function(resData) {
1616
1671
  var url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
1617
1672
  url = url.substring(0, url.length - 1);
1618
1673
  return utils.get('https://www.facebook.com' + url, ctx.jar, null, globalOptions);
1619
1674
  });
1620
1675
  }
1621
1676
  mainPromise
1622
- .then(function() {
1623
- const { execSync } = require('child_process');
1624
- Fetch('https://raw.githubusercontent.com/corazoncary/fca/main/package.json').then(async (/** @type {{ body: { toString: () => string; }; }} */res) => {
1625
- const localVersion = global.Fca.Version;
1626
- if (Number(localVersion.replace(/\./g,"")) < Number(JSON.parse(res.body.toString()).version.replace(/\./g,"")) ) {
1627
- log.warn("[ FCA-PRIYANSH ] •",getText(Language.NewVersionFound,global.Fca.Version,JSON.parse(res.body.toString()).version));
1628
- if (global.Fca.Require.Priyansh.AutoUpdate == true) {
1629
- log.warn("[ FCA-PRIYANSH ] •",Language.AutoUpdate);
1630
- try {
1631
- execSync('npm install fca-priyansh@latest', { stdio: 'inherit' });
1632
- logger.Success(Language.UpdateSuccess)
1633
- logger.Normal(Language.RestartAfterUpdate);
1634
- await new Promise(resolve => setTimeout(resolve,5*1000));
1635
- console.clear();process.exit(1);
1636
- }
1637
- catch (err) {
1638
- log.warn('Error Update: ' + err);
1639
- logger.Normal(Language.UpdateFailed);
1640
- try {
1641
- const fs = require('fs-extra')
1642
- try {
1643
- logger.Error('succeess Package');
1644
- execSync('npm cache clean --force', { stdio: 'ignore'})
1645
- await new Promise(resolve => setTimeout(resolve, 2*1000))
1646
- fs.removeSync('../fca-priyansh');
1647
- // why stdio is not studio :v
1648
- await new Promise(resolve => setTimeout(resolve, 2*1000))
1649
- execSync('npm i fca-priyansh@latest', { stdio: 'inherit'})
1650
- logger.Success("success Restart");
1651
- process.exit(1);
1652
- }
1653
- catch (e) {
1654
- logger.Warning("Error Please Enter The Following Code In Console To Fix !");
1655
- logger.Warning("rmdir -rf ./node_modules/fca-priyansh && npm i fca-priyansh@latest && npm start");
1656
- logger.Warning("Please Copy All The Above Words, Need To Do It 100% Correctly Otherwise Your File Will Be Discolored ✨")
1657
- process.exit(0);
1658
- }
1659
- }
1660
- catch (e) {
1661
- logger.Error(Language.NotiAfterUseToolFail)
1662
- logger.Warning("rmdir ./node_modules after type npm i && npm start");
1663
- process.exit(0);
1664
- }
1665
- }
1666
- }
1667
- }
1668
- else {
1669
- logger.Normal(getText(Language.LocalVersion,localVersion));
1670
- logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1671
- logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
1672
- require('./Extra/ExtraUptimeRobot')();
1673
- DataLanguageSetting.HTML.HTML==true? global.Fca.Require.Web.listen(global.Fca.Require.Web.get('DFP')) : global.Fca.Require.Web = null;
1674
- callback(null, api);
1675
- };
1676
- }).catch(async function(e) {
1677
- console.log(e)
1678
- logger.Warning(Language.AutoCheckUpdateFailure)
1679
- logger.Normal(getText(Language.LocalVersion,global.Fca.Version));
1680
- logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1677
+ .then(async() => {
1678
+ logger.Normal(getText(Language.LocalVersion,global.Fca.Version));
1679
+ logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1681
1680
  logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
1682
- require('./Extra/ExtraUptimeRobot')();
1683
- DataLanguageSetting.HTML.HTML==true? global.Fca.Require.Web.listen(global.Fca.Require.Web.get('DFP')) : global.Fca.Require.Web = null;
1681
+ require('./Extra/ExtraUptimeRobot')();
1684
1682
  callback(null, api);
1685
- });
1686
1683
  }).catch(function(/** @type {{ error: any; }} */e) {
1687
1684
  log.error("login", e.error || e);
1688
1685
  callback(e);
@@ -1774,7 +1771,7 @@ function login(loginData, options, callback) {
1774
1771
  emitReady: false,
1775
1772
  userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
1776
1773
  };
1777
-
1774
+
1778
1775
  if (loginData.email && loginData.password) {
1779
1776
  setOptions(globalOptions, {
1780
1777
  logLevel: "silent",
@@ -1800,7 +1797,7 @@ function login(loginData, options, callback) {
1800
1797
  };
1801
1798
  callback = prCallback;
1802
1799
  }
1803
-
1800
+
1804
1801
  (async function() {
1805
1802
  var Premium = require("./Extra/Src/Premium");
1806
1803
  global.Fca.Data.PremText = await Premium(global.Fca.Require.Security.create().uuid) || "Bạn Đang Sài Phiên Bản: Free !";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fca-priyansh",
3
- "version": "14.0.0",
3
+ "version": "16.0.0",
4
4
  "description": "Facebook-chat-api made by Priyansh rajput",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "aes-js": "latest",
23
23
  "assert": "latest",
24
- "better-sqlite3": "7.4.5",
24
+ "better-sqlite3": "11.0.0",
25
25
  "bluebird": "latest",
26
26
  "chalk": "4.1.2",
27
27
  "cheerio": "latest",
@@ -49,7 +49,7 @@
49
49
  "websocket-stream": "latest"
50
50
  },
51
51
  "engines": {
52
- "node": ">=14.x <16.x"
52
+ "node": ">=20.x <22.x"
53
53
  },
54
54
  "devDependencies": {
55
55
  "eslint": "latest",