nodejs-insta-private-api-mqt 1.3.75 → 1.3.76
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/dist/core/state.js +10 -2
- package/dist/useMultiFileAuthState.js +10 -2
- package/package.json +1 -1
package/dist/core/state.js
CHANGED
|
@@ -188,11 +188,19 @@ class State {
|
|
|
188
188
|
} catch {
|
|
189
189
|
// fallback to parsed authorization if available
|
|
190
190
|
this.updateAuthorization();
|
|
191
|
-
if (
|
|
192
|
-
|
|
191
|
+
if (this.parsedAuthorization && this.parsedAuthorization.ds_user_id) {
|
|
192
|
+
return this.parsedAuthorization.ds_user_id;
|
|
193
|
+
}
|
|
194
|
+
// fallback: check if userId was set directly on state
|
|
195
|
+
if (this._userId) return this._userId;
|
|
196
|
+
return null;
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
199
|
|
|
200
|
+
set cookieUserId(val) {
|
|
201
|
+
this._userId = val;
|
|
202
|
+
}
|
|
203
|
+
|
|
196
204
|
get cookieUsername() {
|
|
197
205
|
try {
|
|
198
206
|
return this.extractCookieValue('ds_user');
|
|
@@ -1228,7 +1228,13 @@ async function extractStateData(igState) {
|
|
|
1228
1228
|
const cookieFields = await extractCookieFields(igState);
|
|
1229
1229
|
|
|
1230
1230
|
// Primary identifiers
|
|
1231
|
-
|
|
1231
|
+
let userIdFromState = null;
|
|
1232
|
+
try {
|
|
1233
|
+
userIdFromState = igState.cookieUserId || null;
|
|
1234
|
+
} catch (e) {}
|
|
1235
|
+
if (!userIdFromState) {
|
|
1236
|
+
userIdFromState = igState.userId || igState.user_id || null;
|
|
1237
|
+
}
|
|
1232
1238
|
const dsUserIdFromCookies = cookieFields.dsUserIdCookie || igState.dsUserId || igState.ds_user_id || null;
|
|
1233
1239
|
const sessionIdFromCookies = cookieFields.sessionIdCookie || null;
|
|
1234
1240
|
const csrfFromCookies = cookieFields.csrfTokenCookie || null;
|
|
@@ -1297,7 +1303,9 @@ async function applyStateData(igState, authState) {
|
|
|
1297
1303
|
|
|
1298
1304
|
// apply new creds-derived fields if state supports them (non-intrusive)
|
|
1299
1305
|
try {
|
|
1300
|
-
|
|
1306
|
+
let _hasCookieUserId = false;
|
|
1307
|
+
try { _hasCookieUserId = !!igState.cookieUserId; } catch (e) {}
|
|
1308
|
+
if (creds.userId && !_hasCookieUserId) igState.cookieUserId = creds.userId;
|
|
1301
1309
|
if (creds.username && !igState.username) igState.username = creds.username;
|
|
1302
1310
|
if (creds.rankToken && !igState.rankToken) igState.rankToken = creds.rankToken;
|
|
1303
1311
|
if (creds.sessionId && !igState.sessionId) igState.sessionId = creds.sessionId;
|
package/package.json
CHANGED