stfca 1.0.17 → 1.0.19
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/package.json +1 -1
- package/src/suggestFriend.js +133 -0
- package/utils.js +28 -1
package/package.json
CHANGED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ===========================================================
|
|
3
|
+
* 💫 META THEME GENERATOR MODULE 💫
|
|
4
|
+
* ===========================================================
|
|
5
|
+
* 🧑💻 Author: Sheikh Tamim (ST | Sheikh Tamim)
|
|
6
|
+
* 🔰 Owner & Developer
|
|
7
|
+
* 🌐 GitHub: https://github.com/sheikhtamimlover
|
|
8
|
+
* 📸 Instagram: https://instagram.com/sheikh.tamim_lover
|
|
9
|
+
* 🧠 Description:
|
|
10
|
+
* This module generates beautiful Messenger AI themes
|
|
11
|
+
* using Meta's hidden GraphQL endpoints. It allows you to
|
|
12
|
+
* create unique chat themes based on your custom prompt
|
|
13
|
+
* or optional image inspiration.
|
|
14
|
+
* -----------------------------------------------------------
|
|
15
|
+
* ⚙️ Features:
|
|
16
|
+
* • Generate AI-based Messenger chat themes.
|
|
17
|
+
* • Custom prompt & optional image URL input.
|
|
18
|
+
* • Returns structured theme data with full color mapping.
|
|
19
|
+
* -----------------------------------------------------------
|
|
20
|
+
* 🕊️ Respect the creator & give proper credits if reused.
|
|
21
|
+
* ===========================================================
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
"use strict";
|
|
25
|
+
|
|
26
|
+
var utils = require("../utils");
|
|
27
|
+
var log = require("npmlog");
|
|
28
|
+
|
|
29
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
30
|
+
/** Developed by Sheikh Tamim | GitHub: sheikhtamimlover | Instagram: @sheikh.tamim_lover */
|
|
31
|
+
return function suggestFriend(count, cursor, callback) {
|
|
32
|
+
var resolveFunc = function () { };
|
|
33
|
+
var rejectFunc = function () { };
|
|
34
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
|
35
|
+
resolveFunc = resolve;
|
|
36
|
+
rejectFunc = reject;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (!callback) {
|
|
40
|
+
callback = function (err, data) {
|
|
41
|
+
if (err) return rejectFunc(err);
|
|
42
|
+
resolveFunc(data);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (typeof count === 'function') {
|
|
47
|
+
callback = count;
|
|
48
|
+
count = 30;
|
|
49
|
+
cursor = null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof cursor === 'function') {
|
|
53
|
+
callback = cursor;
|
|
54
|
+
cursor = null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
count = count || 30;
|
|
58
|
+
|
|
59
|
+
var form = {
|
|
60
|
+
av: ctx.userID,
|
|
61
|
+
__aaid: 0,
|
|
62
|
+
__user: ctx.userID,
|
|
63
|
+
__a: 1,
|
|
64
|
+
__req: utils.getSignatureID(),
|
|
65
|
+
__hs: "20405.HYP:comet_pkg.2.1...0",
|
|
66
|
+
dpr: 1,
|
|
67
|
+
__ccg: "EXCELLENT",
|
|
68
|
+
__rev: "1029835515",
|
|
69
|
+
__s: utils.getSignatureID(),
|
|
70
|
+
__hsi: Date.now(),
|
|
71
|
+
__comet_req: 15,
|
|
72
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
73
|
+
jazoest: ctx.ttstamp,
|
|
74
|
+
lsd: ctx.fb_dtsg,
|
|
75
|
+
__spin_r: "1029835515",
|
|
76
|
+
__spin_b: "trunk",
|
|
77
|
+
__spin_t: Date.now(),
|
|
78
|
+
__crn: "comet.fbweb.CometPYMKSuggestionsRoute",
|
|
79
|
+
fb_api_caller_class: "RelayModern",
|
|
80
|
+
fb_api_req_friendly_name: "FriendingCometPYMKPanelPaginationQuery",
|
|
81
|
+
server_timestamps: true,
|
|
82
|
+
variables: JSON.stringify({
|
|
83
|
+
count: count,
|
|
84
|
+
cursor: cursor,
|
|
85
|
+
location: "FRIENDS_HOME_MAIN",
|
|
86
|
+
scale: 3
|
|
87
|
+
}),
|
|
88
|
+
doc_id: "9917809191634193"
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
defaultFuncs
|
|
92
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
93
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
94
|
+
.then(function (resData) {
|
|
95
|
+
if (resData.error) {
|
|
96
|
+
throw resData;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (resData.data && resData.data.viewer && resData.data.viewer.people_you_may_know) {
|
|
100
|
+
var pymkData = resData.data.viewer.people_you_may_know;
|
|
101
|
+
var suggestions = pymkData.edges.map(function (edge) {
|
|
102
|
+
var node = edge.node;
|
|
103
|
+
return {
|
|
104
|
+
id: node.id,
|
|
105
|
+
name: node.name,
|
|
106
|
+
url: node.url,
|
|
107
|
+
friendshipStatus: node.friendship_status,
|
|
108
|
+
profilePicture: node.profile_picture ? node.profile_picture.uri : null,
|
|
109
|
+
mutualFriends: node.social_context ? node.social_context.text : "",
|
|
110
|
+
topMutualFriends: node.social_context_top_mutual_friends || []
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
var result = {
|
|
115
|
+
suggestions: suggestions,
|
|
116
|
+
hasNextPage: pymkData.page_info.has_next_page,
|
|
117
|
+
endCursor: pymkData.page_info.end_cursor
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return callback(null, result);
|
|
121
|
+
} else {
|
|
122
|
+
return callback({ error: "Invalid response format" });
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
.catch(function (err) {
|
|
126
|
+
log.error("suggestFriend", err);
|
|
127
|
+
return callback(err);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return returnPromise;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
/** Developed by Sheikh Tamim | GitHub: sheikhtamimlover | Please give credits if reused. */
|
package/utils.js
CHANGED
|
@@ -2822,6 +2822,31 @@ function getEventTime() {
|
|
|
2822
2822
|
return Date.now();
|
|
2823
2823
|
}
|
|
2824
2824
|
|
|
2825
|
+
function getSessionID() {
|
|
2826
|
+
return Math.random().toString(36).substring(2, 15);
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
function getFormData(jar, url) {
|
|
2830
|
+
const cookies = jar.getCookies(url);
|
|
2831
|
+
const result = {};
|
|
2832
|
+
|
|
2833
|
+
cookies.forEach(cookie => {
|
|
2834
|
+
const parts = cookie.toString().split(';')[0].split('=');
|
|
2835
|
+
if (parts.length === 2) {
|
|
2836
|
+
const key = parts[0].trim();
|
|
2837
|
+
const value = parts[1].trim();
|
|
2838
|
+
|
|
2839
|
+
if (key === 'fb_dtsg') {
|
|
2840
|
+
result.fb_dtsg = value;
|
|
2841
|
+
} else if (key === 'lsd') {
|
|
2842
|
+
result.lsd = value;
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
});
|
|
2846
|
+
|
|
2847
|
+
return result;
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2825
2850
|
function cleanHTML(text) {
|
|
2826
2851
|
text = text.replace(/(<br>)|(<\/?i>)|(<\/?em>)|(<\/?b>)|(!?~)|(&)|(')|(<)|(>)|(")/g, (match) => {
|
|
2827
2852
|
switch (match) {
|
|
@@ -2899,5 +2924,7 @@ module.exports = {
|
|
|
2899
2924
|
setProxy,
|
|
2900
2925
|
isDMThread,
|
|
2901
2926
|
getJazoest,
|
|
2902
|
-
getEventTime
|
|
2927
|
+
getEventTime,
|
|
2928
|
+
getSessionID,
|
|
2929
|
+
getFormData
|
|
2903
2930
|
};
|