alicezetion 1.5.4 → 1.5.6
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/.cache/replit/__replit_disk_meta.json +1 -1
- package/index.js +57 -80
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"nonce":
|
1
|
+
{"nonce":5642102250332360091,"last_updated":{"seconds":1693575920,"nanos":837442000}}
|
package/index.js
CHANGED
@@ -66,83 +66,66 @@ function setOptions(globalOptions, options) {
|
|
66
66
|
globalOptions.emitReady = Boolean(options.emitReady);
|
67
67
|
break;
|
68
68
|
default:
|
69
|
-
log.warn("setOptions", "Unrecognized option given to setOptions: " + key);
|
69
|
+
log.warn("setOptions", "Unrecognized option given to setOptions: " + key);
|
70
70
|
break;
|
71
71
|
}
|
72
72
|
});
|
73
73
|
}
|
74
|
-
|
75
|
-
function buildAPI(globalOptions, html, jar) {
|
76
|
-
|
77
|
-
|
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
|
-
// All data available to api functions
|
130
|
-
var ctx = {
|
131
|
-
userID: userID,
|
132
|
-
jar: jar,
|
133
|
-
clientID: clientID,
|
134
|
-
globalOptions: globalOptions,
|
135
|
-
loggedIn: true,
|
136
|
-
access_token: 'NONE',
|
137
|
-
clientMutationId: 0,
|
138
|
-
mqttClient: undefined,
|
139
|
-
lastSeqId: irisSeqID,
|
140
|
-
syncToken: undefined,
|
141
|
-
mqttEndpoint,
|
142
|
-
region,
|
143
|
-
firstListen: true
|
144
|
-
};
|
145
|
-
|
74
|
+
|
75
|
+
function buildAPI(globalOptions, html, jar) {
|
76
|
+
try {
|
77
|
+
var maybeCookie = jar.getCookies("https://www.facebook.com").filter(function(val) {
|
78
|
+
return val.cookieString().split("=")[0] === "c_user";
|
79
|
+
});
|
80
|
+
if (maybeCookie.length === 0) throw { error: "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." };
|
81
|
+
if (html.indexOf("/checkpoint/block/?next") > -1) log.warn("login", "Checkpoint detected. Please log in with a browser to verify.");
|
82
|
+
var userID = maybeCookie[0].cookieString().split("=")[1].toString();
|
83
|
+
clearInterval(checkVerified);
|
84
|
+
var clientID = (Math.random() * 2147483648 | 0).toString(16);
|
85
|
+
let oldFBMQTTMatch = html.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/);
|
86
|
+
let mqttEndpoint = null;
|
87
|
+
let region = null;
|
88
|
+
let irisSeqID = null;
|
89
|
+
var noMqttData = null;
|
90
|
+
if (oldFBMQTTMatch) {
|
91
|
+
irisSeqID = oldFBMQTTMatch[1];
|
92
|
+
mqttEndpoint = oldFBMQTTMatch[2];
|
93
|
+
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
94
|
+
} else {
|
95
|
+
let newFBMQTTMatch = html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/);
|
96
|
+
if (newFBMQTTMatch) {
|
97
|
+
irisSeqID = newFBMQTTMatch[2];
|
98
|
+
mqttEndpoint = newFBMQTTMatch[1].replace(/\\\//g, "/");
|
99
|
+
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
100
|
+
} else {
|
101
|
+
let legacyFBMQTTMatch = html.match(/(\["MqttWebConfig",\[\],{fbid:")(.+?)(",appID:219994525426954,endpoint:")(.+?)(",pollingEndpoint:")(.+?)(3790])/);
|
102
|
+
if (legacyFBMQTTMatch) {
|
103
|
+
mqttEndpoint = legacyFBMQTTMatch[4];
|
104
|
+
region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
|
105
|
+
} else {
|
106
|
+
noMqttData = html;
|
107
|
+
process.exit();
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
} catch (err) {}
|
112
|
+
|
113
|
+
var ctx = {
|
114
|
+
userID: userID,
|
115
|
+
jar: jar,
|
116
|
+
clientID: clientID,
|
117
|
+
globalOptions: globalOptions,
|
118
|
+
loggedIn: true,
|
119
|
+
access_token: 'NONE',
|
120
|
+
clientMutationId: 0,
|
121
|
+
mqttClient: undefined,
|
122
|
+
lastSeqId: irisSeqID,
|
123
|
+
syncToken: undefined,
|
124
|
+
mqttEndpoint,
|
125
|
+
region,
|
126
|
+
firstListen: true
|
127
|
+
};
|
128
|
+
|
146
129
|
var api = {
|
147
130
|
setOptions: setOptions.bind(null, globalOptions),
|
148
131
|
getAppState: function getAppState() {
|
@@ -150,9 +133,7 @@ function buildAPI(globalOptions, html, jar) {
|
|
150
133
|
}
|
151
134
|
};
|
152
135
|
|
153
|
-
if (noMqttData)
|
154
|
-
api["htmlData"] = noMqttData;
|
155
|
-
}
|
136
|
+
if (noMqttData) api["htmlData"] = noMqttData;
|
156
137
|
|
157
138
|
const apiFuncNames = [
|
158
139
|
'addExternalModule',
|
@@ -214,10 +195,6 @@ function buildAPI(globalOptions, html, jar) {
|
|
214
195
|
api[v] = require('./leiamnash/' + v)(defaultFuncs, api, ctx);
|
215
196
|
});
|
216
197
|
|
217
|
-
//Removing original `listen` that uses pull.
|
218
|
-
//Map it to listenMqtt instead for backward compatibly.
|
219
|
-
api.listen = api.listenMqtt;
|
220
|
-
|
221
198
|
return [ctx, defaultFuncs, api];
|
222
199
|
}
|
223
200
|
|