fca-horidai-remastered 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -74,7 +74,7 @@ global.Fca = new Object({
74
74
  },
75
75
  "LogFile": {
76
76
  "Use": false,
77
- "Explain": "Record memory usage logs to fix errors. Default location: Horizon_Database/memory.logs"
77
+ "Explain": "Record memory usage logs to fix errors. Default location: main/database_fca/memory.logs"
78
78
  }
79
79
  }
80
80
  },
@@ -166,25 +166,25 @@ try {
166
166
  let All_Variable = Boolean_Fca.concat(String_Fca,Number_Fca,Object_Fca);
167
167
 
168
168
 
169
- if (!global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
170
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
169
+ if (!global.Fca.Require.fs.existsSync(process.cwd() + '/main/json/configfca.json')) {
170
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
171
171
  process.exit(1);
172
172
  }
173
173
 
174
174
  try {
175
- var Data_Setting = require(process.cwd() + "/FastConfigFca.json");
175
+ var Data_Setting = require(process.cwd() + "/main/json/configfca.json");
176
176
  }
177
177
  catch (e) {
178
178
  global.Fca.Require.logger.Error('Detect Your FastConfigFca Settings Invalid!, Carry out default restoration');
179
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
179
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Data.ObjFastConfig, null, "\t"));
180
180
  process.exit(1)
181
181
  }
182
- if (global.Fca.Require.fs.existsSync(process.cwd() + '/FastConfigFca.json')) {
182
+ if (global.Fca.Require.fs.existsSync(process.cwd() + '/main/json/configfca.json')) {
183
183
 
184
184
  for (let i of All_Variable) {
185
185
  if (Data_Setting[i] == undefined) {
186
186
  Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
187
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
187
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
188
188
  }
189
189
  else continue;
190
190
  } //Check Variable
@@ -205,7 +205,7 @@ catch (e) {
205
205
  else if (Object_Fca.includes(i)) {
206
206
  if (global.Fca.Require.utils.getType(Data_Setting[i]) != "Object") {
207
207
  Data_Setting[i] = global.Fca.Data.ObjFastConfig[i];
208
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
208
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
209
209
  }
210
210
  else continue;
211
211
  }
@@ -217,7 +217,7 @@ catch (e) {
217
217
  for (let i of Mission.Data_Path) {
218
218
  if (Data_Setting[Mission.Main_Path] == undefined) {
219
219
  Data_Setting[Mission.Main_Path] = global.Fca.Data.ObjFastConfig[Mission.Main_Path];
220
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
220
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
221
221
  }
222
222
  const User_Data = (utils.getData_Path(Data_Setting[Mission.Main_Path], i, 0))
223
223
  const User_Data_Type = utils.getType(User_Data);
@@ -225,7 +225,7 @@ catch (e) {
225
225
  const Mission_Path = User_Data == 0 ? i : i.slice(0, User_Data);
226
226
  const Mission_Obj = utils.getData_Path(global.Fca.Data.ObjFastConfig[Mission.Main_Path], Mission_Path, 0);
227
227
  Data_Setting[Mission.Main_Path] = utils.setData_Path(Data_Setting[Mission.Main_Path], Mission_Path, Mission_Obj)
228
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(Data_Setting, null, "\t"));
228
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(Data_Setting, null, "\t"));
229
229
  }
230
230
  }
231
231
  }
@@ -410,7 +410,7 @@ module.exports = function(loginData, options, callback) {
410
410
  else {
411
411
  log.warn("[ FCA-UPDATE ] •", "Error Stable Version, Please Check Your Stable Version in FastConfig.json, Automatically turn off Stable Version!");
412
412
  global.Fca.Require.FastConfig.Stable_Version.Accept = false;
413
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
413
+ global.Fca.Require.fs.writeFileSync(process.cwd() + "/main/json/configfca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
414
414
  process.exit(1);
415
415
  }
416
416
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fca-horidai-remastered",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Facebook-chat-api protect and deploy by Kanzu and HZI Team",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var utils = require('../utils');
4
+ var log = require('npmlog');
5
+
6
+ module.exports = function (http, api, ctx) {
7
+ return function acpUsers(userID, callback) {
8
+ var form = {
9
+ av: ctx.userID,
10
+ fb_api_caller_class: "RelayModern",
11
+ fb_api_req_friendly_name: "FriendingCometFriendRequestConfirmMutation",
12
+ variables: JSON.stringify({
13
+ input: {
14
+ attribution_id_v2: `FriendingCometFriendRequestsRoot.react,comet.friending.friendrequests,unexpected,${Date.now()},609381,2356318349,,;FriendingCometRoot.react,comet.friending,tap_tabbar,${Date.now()},496978,2356318349,,`,
15
+ friend_requester_id: userID,
16
+ friending_channel: "FRIENDS_HOME_MAIN",
17
+ actor_id: ctx.globalOptions.pageID || ctx.userID,
18
+ client_mutation_id: Math.round(Math.random() * 19).toString()
19
+ },
20
+ scale: 1,
21
+ refresh_num: 0
22
+ }),
23
+ server_timestamps: true,
24
+ doc_id: "26226851996930142"
25
+ };
26
+
27
+ http.post('https://www.facebook.com/api/graphql/', ctx.jar, form, null, null)
28
+ .then(utils.parseAndCheckLogin(ctx, http))
29
+ .then(function (res) {
30
+ if (res.errors) {
31
+ return callback(JSON.stringify(res.errors, null, 2));
32
+ }
33
+ return callback(JSON.stringify(res.data, null, 2));
34
+ })
35
+ .catch(function (err) {
36
+ log.error('addFriends', err);
37
+ return callback(err);
38
+ });
39
+ };
40
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var utils = require('../utils');
4
+ var log = require('npmlog');
5
+
6
+ module.exports = function (http, api, ctx) {
7
+ return async function addFriends(userID, callback) {
8
+ var form = {
9
+ "__av": ctx.userID,
10
+ "fb_api_caller_class": "RelayModern",
11
+ "fb_api_req_friendly_name": "FriendingCometFriendRequestSendMutation",
12
+ "variables": JSON.stringify({
13
+ "input": {
14
+ "attribution_id_v2": "ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,unexpected,"+Date.now()+",510030,190055527696468,,;SearchCometGlobalSearchDefaultTabRoot.react,comet.search_results.default_tab,tap_search_bar," + Date.now() + ",830835,391724414624676,,",
15
+ "friend_requestee_ids": [userID],
16
+ "friending_channel": "PROFILE_BUTTON",
17
+ "warn_ack_for_ids": [],
18
+ "actor_id": ctx.userID,
19
+ "client_mutation_id": "3"
20
+ },
21
+ "scale": "1"
22
+ }),
23
+ "server_timestamps": true,
24
+ "doc_id": "7607575099364225"
25
+ };
26
+
27
+ http.post('https://www.facebook.com/api/graphql/', ctx.jar, form, null, null)
28
+ .then(utils.parseAndCheckLogin(ctx, http))
29
+ .then(function (res) {
30
+ return callback((JSON.stringify(res.data?.friend_request_send?.friend_requestees?.[0], null, 2)) || { error: "Không thể gửi lời mời kết bạn"});
31
+ })
32
+ .catch(function (err) {
33
+ log.error('addFriends', err);
34
+ return callback(err);
35
+ });
36
+ }
37
+ };
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../utils');
4
+ var log = require('npmlog');
5
+
6
+ module.exports = function (http, api, ctx) {
7
+ return function changeAvatar(image, caption = '', timestamp = null, callback) {
8
+ var cb;
9
+ var rt = new Promise(function (resolve, reject) {
10
+ cb = (error, url) => error ? reject(error) : resolve(url);
11
+ });
12
+
13
+ if (typeof image == 'function') {
14
+ callback = image;
15
+ image = null;
16
+ }
17
+ if (typeof caption == 'function') {
18
+ callback = caption;
19
+ caption = '';
20
+ }
21
+ if (typeof caption == 'number') {
22
+ timestamp = caption;
23
+ caption = '';
24
+ }
25
+ if (typeof timestamp == 'function') {
26
+ callback = timestamp;
27
+ timestamp = null;
28
+ }
29
+ if (typeof callback == 'function') cb = callback;
30
+
31
+ if (!utils.isReadableStream(image)) {
32
+ var error = 'image should be a readable stream, not ' + utils.getType(image);
33
+ log.error('changeAvatar', error);
34
+ cb(error);
35
+ } else {
36
+ http
37
+ .postFormData('https://www.facebook.com/profile/picture/upload/', ctx.jar, {
38
+ profile_id: ctx.userID,
39
+ photo_source: 57,
40
+ av: ctx.userID,
41
+ file: image
42
+ })
43
+ .then(utils.parseAndCheckLogin(ctx, http))
44
+ .then(function (res) {
45
+ if (res.error || res.errors || !res.payload)
46
+ throw res;
47
+
48
+ var vari = {
49
+ input: {
50
+ caption,
51
+ existing_photo_id: res.payload.fbid,
52
+ expiration_time: timestamp,
53
+ profile_id: ctx.userID,
54
+ profile_pic_method: "EXISTING",
55
+ profile_pic_source: "TIMELINE",
56
+ scaled_crop_rect: {
57
+ height: 1,
58
+ width: 1,
59
+ x: 0,
60
+ y: 0
61
+ },
62
+ skip_cropping: true,
63
+ actor_id: ctx.userID,
64
+ client_mutation_id: Math.round(Math.random() * 19).toString()
65
+ },
66
+ isPage: false,
67
+ isProfile: true,
68
+ scale: 3
69
+ }
70
+ return http
71
+ .post('https://www.facebook.com/api/graphql', ctx.jar, {
72
+ doc_id: 5066134240065849,
73
+ server_timestamps: true,
74
+ fb_api_req_friendly_name: 'ProfileCometProfilePictureSetMutation',
75
+ variables: JSON.stringify(vari)
76
+ })
77
+ .then(utils.parseAndCheckLogin(ctx, http));
78
+ })
79
+ .then(function (res) {
80
+ if (res.errors)
81
+ throw res;
82
+
83
+ return cb(null, (res[0] || res).data.profile_picture_set.profile);
84
+ })
85
+ .catch(function (err) {
86
+ log.error('changeAvatar', err);
87
+ return cb(err);
88
+ });
89
+ }
90
+
91
+ return rt;
92
+ }
93
+ }
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ const { generateOfflineThreadingID, getCurrentTimestamp, getGUID } = require('../utils');
4
+
5
+ function isCallable(func) {
6
+ try {
7
+ Reflect.apply(func, null, []);
8
+ return true;
9
+ } catch (error) {
10
+ return false;
11
+ }
12
+ }
13
+
14
+ module.exports = function (defaultFuncs, api, ctx) {
15
+ return function changeBlockedStatusMqtt(userID, status, type, callback) {
16
+ if (!ctx.mqttClient) {
17
+ throw new Error('Not connected to MQTT');
18
+ }
19
+
20
+ ctx.wsReqNumber += 1;
21
+ ctx.wsTaskNumber += 1;
22
+
23
+ const label = '334';
24
+ let userBlockAction = 0;
25
+
26
+ switch (type) {
27
+ case 'messenger':
28
+ if (status) {
29
+ userBlockAction = 1; // Block
30
+ } else {
31
+ userBlockAction = 0; // Unblock
32
+ }
33
+ break;
34
+ case 'facebook':
35
+ if (status) {
36
+ userBlockAction = 3; // Block
37
+ } else {
38
+ userBlockAction = 2; // Unblock
39
+ }
40
+ break;
41
+ default:
42
+ throw new Error('Invalid type');
43
+ }
44
+
45
+ const taskPayload = {
46
+ blockee_id: userID,
47
+ request_id: getGUID(),
48
+ user_block_action: userBlockAction,
49
+ };
50
+
51
+ const payload = JSON.stringify(taskPayload);
52
+ const version = '25393437286970779';
53
+
54
+ const task = {
55
+ failure_count: null,
56
+ label: label,
57
+ payload: payload,
58
+ queue_name: 'native_sync_block',
59
+ task_id: ctx.wsTaskNumber,
60
+ };
61
+
62
+ const content = {
63
+ app_id: '2220391788200892',
64
+ payload: JSON.stringify({
65
+ tasks: [task],
66
+ epoch_id: parseInt(generateOfflineThreadingID()),
67
+ version_id: version,
68
+ }),
69
+ request_id: ctx.wsReqNumber,
70
+ type: 3,
71
+ };
72
+
73
+ if (isCallable(callback)) {
74
+ // to be implemented
75
+ }
76
+
77
+ ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
78
+ };
79
+ };
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../utils');
4
+ var log = require('npmlog');
5
+
6
+ module.exports = function (http, api, ctx) {
7
+ return function changeCover(image, callback) {
8
+ var cb;
9
+ var rt = new Promise(function (resolve, reject) {
10
+ cb = (error, url) => error ? reject(error) : resolve(url);
11
+ });
12
+
13
+ if (typeof image == 'function') {
14
+ callback = image;
15
+ image = null;
16
+ }
17
+ if (typeof callback == 'function') cb = callback;
18
+ if (!utils.isReadableStream(image)) {
19
+ var error = 'image should be a readable stream, not ' + utils.getType(image);
20
+ log.error('changeCover', error);
21
+ cb(error);
22
+ }
23
+ else {
24
+ http
25
+ .postFormData('https://www.facebook.com/profile/picture/upload/', ctx.jar, {
26
+ profile_id: ctx.userID,
27
+ photo_source: 57,
28
+ av: ctx.userID,
29
+ file: image
30
+ })
31
+ .then(utils.parseAndCheckLogin(ctx, http))
32
+ .then(function (res) {
33
+ if (res.error || res.errors || !res.payload)
34
+ throw res;
35
+
36
+ var vari = {
37
+ input: {
38
+ attribution_id_v2: `ProfileCometCollectionRoot.react,comet.profile.collection.photos_by,unexpected,${Date.now()},770083,,;ProfileCometCollectionRoot.react,comet.profile.collection.photos_albums,unexpected,${Date.now()},470774,,;ProfileCometCollectionRoot.react,comet.profile.collection.photos,unexpected,${Date.now()},94740,,;ProfileCometCollectionRoot.react,comet.profile.collection.saved_reels_on_profile,unexpected,${Date.now()},89669,,;ProfileCometCollectionRoot.react,comet.profile.collection.reels_tab,unexpected,${Date.now()},152201,,`,
39
+ cover_photo_id: res.payload.fbid,
40
+ focus: {
41
+ x: 0.5,
42
+ y: 1
43
+ },
44
+ target_user_id: ctx.userID,
45
+ actor_id: ctx.userID,
46
+ client_mutation_id: Math.round(Math.random() * 19).toString()
47
+ },
48
+ scale: 1,
49
+ contextualProfileContext: null
50
+ }
51
+ return http
52
+ .post('https://www.facebook.com/api/graphql', ctx.jar, {
53
+ doc_id: 8247793861913071,
54
+ server_timestamps: true,
55
+ fb_api_req_friendly_name: 'ProfileCometCoverPhotoUpdateMutation',
56
+ variables: JSON.stringify(vari)
57
+ })
58
+ .then(utils.parseAndCheckLogin(ctx, http));
59
+ })
60
+ .then(function (res) {
61
+ if (res.errors)
62
+ throw res;
63
+ return cb(null, res.data.user_update_cover_photo.user.cover_photo.photo.url);
64
+ })
65
+ .catch(function (err) {
66
+ log.error('changeCover', err);
67
+ return cb(err);
68
+ });
69
+ }
70
+
71
+ return rt;
72
+ }
73
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ var utils = require('../utils');
4
+ var log = require('npmlog');
5
+
6
+ module.exports = function (http, api, ctx) {
7
+ return function changeName(input, format, callback) {
8
+ var cb;
9
+ var rt = new Promise(function (resolve, reject) {
10
+ cb = error => error ? reject(error) : resolve();
11
+ });
12
+
13
+ if (typeof input == 'function') {
14
+ callback = input;
15
+ input = null;
16
+ }
17
+ if (typeof format == 'function') {
18
+ callback = format;
19
+ format = 'complete';
20
+ }
21
+ if (typeof callback == 'function') cb = callback;
22
+ if (utils.getType(input) != 'Object') {
23
+ var error = 'name must be an object, not ' + utils.getType(input);
24
+ log('changeName', error);
25
+ return cb(error);
26
+ }
27
+
28
+ var { first_name, middle_name, last_name } = input;
29
+ if (!first_name || !last_name) {
30
+ log.error('changeName', 'name is not be accepted');
31
+ return cb('name is not be accepted');
32
+ }
33
+
34
+ middle_name = middle_name || '';
35
+
36
+ var full_name =
37
+ format == 'complete' ? last_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + first_name :
38
+ format == 'standard' ? last_name + ' ' + first_name :
39
+ format == 'reversed' ? first_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + last_name :
40
+ last_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + first_name;
41
+
42
+ var form = {
43
+ fb_api_caller_class: 'RelayModern',
44
+ fb_api_req_friendly_name: 'useFXIMUpdateNameMutation',
45
+ variables: JSON.stringify({
46
+ client_mutation_id: utils.getGUID(),
47
+ family_device_id: "device_id_fetch_datr",
48
+ identity_ids: [ctx.userID],
49
+ full_name,
50
+ first_name,
51
+ middle_name,
52
+ last_name,
53
+ interface: 'FB_WEB'
54
+ }),
55
+ server_timestamps: true,
56
+ doc_id: '5763510853763960'
57
+ }
58
+
59
+ http
60
+ .post('https://accountscenter.facebook.com/api/graphql/', ctx.jar, form, null, null, {
61
+ Origin: 'https://accountscenter.facebook.com',
62
+ Referer: `https://accountscenter.facebook.com/profiles/${ctx.userID}/name`
63
+ })
64
+ .then(utils.parseAndCheckLogin(ctx, http))
65
+ .then(function (res) {
66
+ if (res.errors)
67
+ throw res;
68
+ else if (res.data.fxim_update_identity_name.error)
69
+ throw res.data.fxim_update_identity_name.error;
70
+ return cb();
71
+ })
72
+ .catch(function (err) {
73
+ log.error('changeName', err);
74
+ return cb(err);
75
+ });
76
+
77
+ return rt;
78
+ }
79
+ }