@dongdev/fca-unofficial 0.0.6 → 0.0.8
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/README.md +77 -64
- package/index.js +403 -293
- package/lib/database/models/index.js +47 -0
- package/lib/database/models/thread.js +31 -0
- package/lib/database/threadData.js +93 -0
- package/lib/logger.js +96 -0
- package/package.json +8 -3
- package/src/getThreadInfo.js +293 -223
- package/src/getUserInfo.js +1 -7
- package/src/listenMqtt.js +716 -647
- package/src/refreshFb_dtsg.js +60 -75
- package/src/shareContact.js +49 -0
- package/utils.js +1236 -1350
- package/.travis.yml +0 -6
package/index.js
CHANGED
@@ -1,308 +1,418 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
const utils = require("./utils");
|
4
3
|
const log = require("npmlog");
|
5
|
-
|
4
|
+
const axios = require("axios");
|
5
|
+
const { execSync } = require("child_process");
|
6
|
+
const fs = require("fs");
|
7
|
+
const path = require("path");
|
8
|
+
const models = require("./lib/database/models");
|
9
|
+
const logger = require("./lib/logger");
|
6
10
|
let checkVerified = null;
|
7
|
-
|
8
11
|
const defaultLogRecordSize = 100;
|
9
12
|
log.maxRecordSize = defaultLogRecordSize;
|
10
|
-
|
13
|
+
const defaultConfig = {
|
14
|
+
autoUpdate: true,
|
15
|
+
mqtt: {
|
16
|
+
enabled: true,
|
17
|
+
reconnectInterval: 3600,
|
18
|
+
}
|
19
|
+
};
|
20
|
+
const configPath = path.join(process.cwd(), "fca-config.json");
|
21
|
+
let config;
|
22
|
+
if (!fs.existsSync(configPath)) {
|
23
|
+
fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2));
|
24
|
+
config = defaultConfig;
|
25
|
+
} else {
|
26
|
+
try {
|
27
|
+
const fileContent = fs.readFileSync(configPath, 'utf8');
|
28
|
+
config = JSON.parse(fileContent);
|
29
|
+
config = { ...defaultConfig, ...config };
|
30
|
+
} catch (err) {
|
31
|
+
logger("Error reading config file, using defaults", "error");
|
32
|
+
config = defaultConfig;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
global.fca = {
|
36
|
+
config: config
|
37
|
+
};
|
38
|
+
async function checkForUpdates() {
|
39
|
+
if (!global.fca.config.autoUpdate) {
|
40
|
+
logger("Auto update is disabled", "info");
|
41
|
+
}
|
42
|
+
try {
|
43
|
+
const response = await axios.get("https://raw.githubusercontent.com/DongDev-VN/fca-unofficial/refs/heads/main/package.json");
|
44
|
+
const remoteVersion = response.data.version;
|
45
|
+
const localPackage = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf8"));
|
46
|
+
const localVersion = localPackage.version;
|
47
|
+
if (remoteVersion !== localVersion) {
|
48
|
+
logger(`New version available: ${remoteVersion}`, "FCA-UPDATE");
|
49
|
+
logger("Installing latest version...", "FCA-UPDATE");
|
50
|
+
execSync(`npm i ${localPackage.name}@latest`);
|
51
|
+
logger("Update completed! Please restart your application", "FCA-UPDATE");
|
52
|
+
process.exit(1);
|
53
|
+
} else {
|
54
|
+
logger(`You are using the latest version: ${localVersion}`, 'info');
|
55
|
+
}
|
56
|
+
} catch (err) {
|
57
|
+
logger("Failed to check for updates:", err, "error");
|
58
|
+
}
|
59
|
+
}
|
60
|
+
if (global.fca.config.autoUpdate) {
|
61
|
+
checkForUpdates();
|
62
|
+
}
|
63
|
+
const Boolean_Option = [
|
64
|
+
"online",
|
65
|
+
"selfListen",
|
66
|
+
"listenEvents",
|
67
|
+
"updatePresence",
|
68
|
+
"forceLogin",
|
69
|
+
"autoMarkDelivery",
|
70
|
+
"autoMarkRead",
|
71
|
+
"listenTyping",
|
72
|
+
"autoReconnect",
|
73
|
+
"emitReady",
|
74
|
+
];
|
11
75
|
function setOptions(globalOptions, options) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
case 'emitReady':
|
68
|
-
globalOptions.emitReady = Boolean(options.emitReady);
|
69
|
-
break;
|
70
|
-
default:
|
71
|
-
log.warn("setOptions", "Unrecognized option given to setOptions: " + key);
|
72
|
-
break;
|
73
|
-
}
|
74
|
-
});
|
76
|
+
Object.keys(options).map(function(key) {
|
77
|
+
switch (Boolean_Option.includes(key)) {
|
78
|
+
case true: {
|
79
|
+
globalOptions[key] = Boolean(options[key]);
|
80
|
+
break;
|
81
|
+
}
|
82
|
+
case false: {
|
83
|
+
switch (key) {
|
84
|
+
case "pauseLog": {
|
85
|
+
if (options.pauseLog) log.pause();
|
86
|
+
else log.resume();
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
case "logLevel": {
|
90
|
+
log.level = options.logLevel;
|
91
|
+
globalOptions.logLevel = options.logLevel;
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
case "logRecordSize": {
|
95
|
+
log.maxRecordSize = options.logRecordSize;
|
96
|
+
globalOptions.logRecordSize = options.logRecordSize;
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
case "pageID": {
|
100
|
+
globalOptions.pageID = options.pageID.toString();
|
101
|
+
break;
|
102
|
+
}
|
103
|
+
case "userAgent": {
|
104
|
+
globalOptions.userAgent =
|
105
|
+
options.userAgent ||
|
106
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36";
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
case "proxy": {
|
110
|
+
if (typeof options.proxy != "string") {
|
111
|
+
delete globalOptions.proxy;
|
112
|
+
utils.setProxy();
|
113
|
+
} else {
|
114
|
+
globalOptions.proxy = options.proxy;
|
115
|
+
utils.setProxy(globalOptions.proxy);
|
116
|
+
}
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
default: {
|
120
|
+
log.warn(
|
121
|
+
"setOptions",
|
122
|
+
"Unrecognized option given to setOptions: " + key
|
123
|
+
);
|
124
|
+
break;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
});
|
75
131
|
}
|
76
|
-
|
77
132
|
function buildAPI(globalOptions, html, jar) {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
133
|
+
const maybeCookie = jar
|
134
|
+
.getCookies("https://www.facebook.com")
|
135
|
+
.filter(function(val) {
|
136
|
+
return val.cookieString().split("=")[0] === "c_user";
|
137
|
+
});
|
138
|
+
const objCookie = jar
|
139
|
+
.getCookies("https://www.facebook.com")
|
140
|
+
.reduce(function(obj, val) {
|
141
|
+
obj[val.cookieString().split("=")[0]] = val.cookieString().split("=")[1];
|
142
|
+
return obj;
|
143
|
+
}, {});
|
144
|
+
if (maybeCookie.length === 0) {
|
145
|
+
throw {
|
146
|
+
error:
|
147
|
+
"Error retrieving userID. This can be caused by a lot of things, including getting blocked by Facebook for logging in from an unknown location. Try logging in with a browser to verify.",
|
148
|
+
};
|
149
|
+
}
|
150
|
+
if (html.indexOf("/checkpoint/block/?next") > -1 || html.indexOf("/checkpoint/?next") > -1) {
|
151
|
+
throw {
|
152
|
+
error: "Checkpoint detected. Please log in with a browser to verify.",
|
153
|
+
}
|
154
|
+
}
|
155
|
+
const userID = maybeCookie[0]
|
156
|
+
.cookieString()
|
157
|
+
.split("=")[1]
|
158
|
+
.toString();
|
159
|
+
const i_userID = objCookie.i_user || null;
|
160
|
+
logger(`Logged in as ${userID}`, 'info');
|
161
|
+
try {
|
162
|
+
clearInterval(checkVerified);
|
163
|
+
} catch (_) {}
|
164
|
+
const clientID = ((Math.random() * 2147483648) | 0).toString(16);
|
165
|
+
let mqttEndpoint, region, fb_dtsg, irisSeqID;
|
166
|
+
try {
|
167
|
+
const endpointMatch = html.match(/"endpoint":"([^"]+)"/);
|
168
|
+
if (endpointMatch) {
|
169
|
+
mqttEndpoint = endpointMatch[1].replace(/\\\//g, "/");
|
170
|
+
const url = new URL(mqttEndpoint);
|
171
|
+
region = url.searchParams.get("region")?.toUpperCase() || "PRN";
|
172
|
+
}
|
173
|
+
logger(`Sever region ${region}`, 'info');
|
174
|
+
} catch (e) {
|
175
|
+
log.warning("login", "Not MQTT endpoint");
|
176
|
+
}
|
177
|
+
const tokenMatch = html.match(/DTSGInitialData.*?token":"(.*?)"/);
|
178
|
+
if (tokenMatch) {
|
179
|
+
fb_dtsg = tokenMatch[1];
|
180
|
+
}
|
181
|
+
(async () => {
|
182
|
+
try {
|
183
|
+
await models.sequelize.authenticate();
|
184
|
+
await models.syncAll();
|
185
|
+
} catch (error) {
|
186
|
+
console.error(error);
|
187
|
+
console.error('Database connection failed:', error.message);
|
188
|
+
}
|
189
|
+
})();
|
190
|
+
logger(`FCA fix by DongDev`, 'info');
|
191
|
+
const ctx = {
|
192
|
+
userID: userID,
|
193
|
+
i_userID: i_userID,
|
194
|
+
jar: jar,
|
195
|
+
clientID: clientID,
|
196
|
+
globalOptions: globalOptions,
|
197
|
+
loggedIn: true,
|
198
|
+
access_token: "NONE",
|
199
|
+
clientMutationId: 0,
|
200
|
+
mqttClient: undefined,
|
201
|
+
lastSeqId: irisSeqID,
|
202
|
+
syncToken: undefined,
|
203
|
+
mqttEndpoint,
|
204
|
+
region,
|
205
|
+
firstListen: true,
|
206
|
+
fb_dtsg,
|
207
|
+
};
|
208
|
+
const api = {
|
209
|
+
setOptions: setOptions.bind(null, globalOptions),
|
210
|
+
getAppState: function getAppState() {
|
211
|
+
const appState = utils.getAppState(jar);
|
212
|
+
return appState.filter(
|
213
|
+
(item, index, self) =>
|
214
|
+
self.findIndex((t) => {
|
215
|
+
return t.key === item.key;
|
216
|
+
}) === index
|
217
|
+
);
|
218
|
+
},
|
219
|
+
};
|
220
|
+
const defaultFuncs = utils.makeDefaults(html, i_userID || userID, ctx);
|
221
|
+
require("fs")
|
222
|
+
.readdirSync(__dirname + "/src/")
|
223
|
+
.filter((v) => v.endsWith(".js"))
|
224
|
+
.map(function(v) {
|
225
|
+
api[v.replace(".js", "")] = require("./src/" + v)(defaultFuncs, api, ctx);
|
226
|
+
});
|
227
|
+
api.listen = api.listenMqtt;
|
228
|
+
setInterval(checkForUpdates, 1000 * 60 * 60 * 24);
|
229
|
+
setInterval(async () => {
|
230
|
+
api
|
231
|
+
.refreshFb_dtsg()
|
232
|
+
.then(() => {
|
233
|
+
logger("Successfully refreshed fb_dtsg", 'info');
|
234
|
+
})
|
235
|
+
.catch((err) => {
|
236
|
+
console.error("An error occurred while refreshing fb_dtsg", err);
|
237
|
+
});
|
238
|
+
}, 1000 * 60 * 60 * 24);
|
239
|
+
return [ctx, defaultFuncs, api];
|
159
240
|
}
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
241
|
+
function loginHelper(
|
242
|
+
appState,
|
243
|
+
email,
|
244
|
+
password,
|
245
|
+
globalOptions,
|
246
|
+
callback,
|
247
|
+
prCallback
|
248
|
+
) {
|
249
|
+
let mainPromise = null;
|
250
|
+
const jar = utils.getJar();
|
251
|
+
if (appState) {
|
252
|
+
if (utils.getType(appState) === "Array" && appState.some((c) => c.name)) {
|
253
|
+
appState = appState.map((c) => {
|
254
|
+
c.key = c.name;
|
255
|
+
delete c.name;
|
256
|
+
return c;
|
257
|
+
});
|
258
|
+
} else if (utils.getType(appState) === "String") {
|
259
|
+
const arrayAppState = [];
|
260
|
+
appState.split(";").forEach((c) => {
|
261
|
+
const [key, value] = c.split("=");
|
262
|
+
arrayAppState.push({
|
263
|
+
key: (key || "").trim(),
|
264
|
+
value: (value || "").trim(),
|
265
|
+
domain: "facebook.com",
|
266
|
+
path: "/",
|
267
|
+
expires: new Date().getTime() + 1000 * 60 * 60 * 24 * 365,
|
268
|
+
});
|
269
|
+
});
|
270
|
+
appState = arrayAppState;
|
271
|
+
}
|
272
|
+
appState.map(function(c) {
|
273
|
+
const str =
|
274
|
+
c.key +
|
275
|
+
"=" +
|
276
|
+
c.value +
|
277
|
+
"; expires=" +
|
278
|
+
c.expires +
|
279
|
+
"; domain=" +
|
280
|
+
c.domain +
|
281
|
+
"; path=" +
|
282
|
+
c.path +
|
283
|
+
";";
|
284
|
+
jar.setCookie(str, "http://" + c.domain);
|
285
|
+
});
|
286
|
+
mainPromise = utils
|
287
|
+
.get("https://www.facebook.com/", jar, null, globalOptions, {
|
288
|
+
noRef: true,
|
289
|
+
})
|
290
|
+
.then(utils.saveCookies(jar));
|
291
|
+
} else {
|
292
|
+
if (email) {
|
293
|
+
throw {
|
294
|
+
error:
|
295
|
+
"Currently, the login method by email and password is no longer supported, please use the login method by appState",
|
296
|
+
};
|
297
|
+
} else {
|
298
|
+
throw { error: "No appState given." };
|
299
|
+
}
|
300
|
+
}
|
301
|
+
let ctx = null;
|
302
|
+
let _defaultFuncs = null;
|
303
|
+
let api = null;
|
304
|
+
mainPromise = mainPromise
|
305
|
+
.then(function(res) {
|
306
|
+
const reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
|
307
|
+
const redirect = reg.exec(res.body);
|
308
|
+
if (redirect && redirect[1]) {
|
309
|
+
return utils
|
310
|
+
.get(redirect[1], jar, null, globalOptions)
|
311
|
+
.then(utils.saveCookies(jar));
|
312
|
+
}
|
313
|
+
return res;
|
314
|
+
})
|
315
|
+
.then(function(res) {
|
316
|
+
const html = res.body;
|
317
|
+
const stuff = buildAPI(globalOptions, html, jar);
|
318
|
+
ctx = stuff[0];
|
319
|
+
_defaultFuncs = stuff[1];
|
320
|
+
api = stuff[2];
|
321
|
+
return res;
|
322
|
+
});
|
323
|
+
if (globalOptions.pageID) {
|
324
|
+
mainPromise = mainPromise
|
325
|
+
.then(function() {
|
326
|
+
return utils.get(
|
327
|
+
"https://www.facebook.com/" +
|
328
|
+
ctx.globalOptions.pageID +
|
329
|
+
"/messages/?section=messages&subsection=inbox",
|
330
|
+
ctx.jar,
|
331
|
+
null,
|
332
|
+
globalOptions
|
333
|
+
);
|
334
|
+
})
|
335
|
+
.then(function(resData) {
|
336
|
+
let url = utils
|
337
|
+
.getFrom(
|
338
|
+
resData.body,
|
339
|
+
'window.location.replace("https:\\/\\/www.facebook.com\\',
|
340
|
+
'");'
|
341
|
+
)
|
342
|
+
.split("\\")
|
343
|
+
.join("");
|
344
|
+
url = url.substring(0, url.length - 1);
|
345
|
+
return utils.get(
|
346
|
+
"https://www.facebook.com" + url,
|
347
|
+
ctx.jar,
|
348
|
+
null,
|
349
|
+
globalOptions
|
350
|
+
);
|
351
|
+
});
|
352
|
+
}
|
353
|
+
mainPromise
|
354
|
+
.then(function() {
|
355
|
+
logger("Done logging in", 'info');
|
356
|
+
return callback(null, api);
|
357
|
+
})
|
358
|
+
.catch(function(e) {
|
359
|
+
log.error("login", e.error || e);
|
360
|
+
callback(e);
|
361
|
+
});
|
262
362
|
}
|
263
|
-
|
264
363
|
function login(loginData, options, callback) {
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
364
|
+
if (
|
365
|
+
utils.getType(options) === "Function" ||
|
366
|
+
utils.getType(options) === "AsyncFunction"
|
367
|
+
) {
|
368
|
+
callback = options;
|
369
|
+
options = {};
|
370
|
+
}
|
371
|
+
const globalOptions = {
|
372
|
+
selfListen: false,
|
373
|
+
selfListenEvent: false,
|
374
|
+
listenEvents: false,
|
375
|
+
listenTyping: false,
|
376
|
+
updatePresence: false,
|
377
|
+
forceLogin: false,
|
378
|
+
autoMarkDelivery: true,
|
379
|
+
autoMarkRead: false,
|
380
|
+
autoReconnect: true,
|
381
|
+
logRecordSize: defaultLogRecordSize,
|
382
|
+
online: true,
|
383
|
+
emitReady: false,
|
384
|
+
userAgent:
|
385
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
|
386
|
+
};
|
387
|
+
setOptions(globalOptions, options);
|
388
|
+
let prCallback = null;
|
389
|
+
if (
|
390
|
+
utils.getType(callback) !== "Function" &&
|
391
|
+
utils.getType(callback) !== "AsyncFunction"
|
392
|
+
) {
|
393
|
+
let rejectFunc = null;
|
394
|
+
let resolveFunc = null;
|
395
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
396
|
+
resolveFunc = resolve;
|
397
|
+
rejectFunc = reject;
|
398
|
+
});
|
399
|
+
prCallback = function(error, api) {
|
400
|
+
if (error) {
|
401
|
+
return rejectFunc(error);
|
402
|
+
}
|
403
|
+
return resolveFunc(api);
|
404
|
+
};
|
405
|
+
callback = prCallback;
|
406
|
+
}
|
407
|
+
loginHelper(
|
408
|
+
loginData.appState,
|
409
|
+
loginData.email,
|
410
|
+
loginData.password,
|
411
|
+
globalOptions,
|
412
|
+
callback,
|
413
|
+
prCallback
|
414
|
+
);
|
415
|
+
return returnPromise;
|
306
416
|
}
|
307
417
|
|
308
418
|
module.exports = login;
|