@mherod/get-cookie 2.0.0-rc.1 → 2.0.0-rc.10
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/index.js +377 -145
- package/package-lock.json +12295 -0
- package/package.json +10 -7
- package/src/CookieRow.ts +2 -1
- package/src/CookieSpec.ts +2 -2
- package/src/CookieStore.ts +10 -0
- package/src/ExportedCookie.ts +2 -1
- package/src/FetchResponse.ts +2 -0
- package/src/IsCookieRow.ts +1 -1
- package/src/IsExportedCookie.ts +1 -1
- package/src/SpecialCases.ts +1 -1
- package/src/StringToRegex.ts +6 -0
- package/src/argv.ts +4 -0
- package/src/browsers/ChromeCookieQueryStrategy.ts +92 -22
- package/src/browsers/CompositeCookieQueryStrategy.ts +32 -8
- package/src/browsers/CookieQueryStrategy.ts +2 -1
- package/src/browsers/CookieStoreQueryStrategy.ts +94 -0
- package/src/browsers/FirefoxCookieQueryStrategy.ts +5 -3
- package/src/browsers/SafariCookieQueryStrategy.ts +3 -1
- package/src/cli.ts +84 -91
- package/src/doSqliteQuery1.ts +4 -8
- package/src/doSqliteQuery1Params.ts +7 -0
- package/src/fetchWithCookies.ts +78 -27
- package/src/findAllFiles.ts +5 -9
- package/src/getChromeCookie.ts +19 -0
- package/src/getCookie.ts +19 -0
- package/src/getFirefoxCookie.ts +19 -0
- package/src/getGroupedRenderedCookies.ts +19 -22
- package/src/getMergedRenderedCookies.ts +25 -0
- package/src/index.ts +13 -52
- package/src/isValidJwt.ts +2 -2
- package/src/queryCookies.ts +16 -12
- package/src/resultsRendered.ts +7 -4
- package/src/unpackHeaders.ts +7 -4
- package/src/utils.ts +0 -25
- package/dist/cli.js +0 -3
- package/dist/cli.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/module.js +0 -586
- package/dist/module.js.map +0 -1
- package/dist/types.d.ts +0 -35
- package/dist/types.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var $7oI3p$lodash = require("lodash");
|
|
3
|
+
var $7oI3p$minimist = require("minimist");
|
|
3
4
|
var $7oI3p$lrucache = require("lru-cache");
|
|
5
|
+
var $7oI3p$colorette = require("colorette");
|
|
4
6
|
var $7oI3p$fs = require("fs");
|
|
5
7
|
var $7oI3p$crypto = require("crypto");
|
|
6
8
|
var $7oI3p$path = require("path");
|
|
7
|
-
var $7oI3p$child_process = require("child_process");
|
|
8
9
|
var $7oI3p$sqlite3 = require("sqlite3");
|
|
10
|
+
var $7oI3p$child_process = require("child_process");
|
|
11
|
+
var $7oI3p$toughcookie = require("tough-cookie");
|
|
12
|
+
var $7oI3p$toughcookiefilestore = require("tough-cookie-file-store");
|
|
9
13
|
var $7oI3p$jsonwebtoken = require("jsonwebtoken");
|
|
10
14
|
var $7oI3p$crossfetch = require("cross-fetch");
|
|
11
15
|
var $7oI3p$destr = require("destr");
|
|
16
|
+
var $7oI3p$useragents = require("user-agents");
|
|
12
17
|
|
|
13
18
|
function $parcel$export(e, n, v, s) {
|
|
14
19
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -33,17 +38,16 @@ function $parcel$interopDefault(a) {
|
|
|
33
38
|
return a && a.__esModule ? a.default : a;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
$parcel$export(module.exports, "getCookie", () => $
|
|
37
|
-
$parcel$export(module.exports, "
|
|
38
|
-
$parcel$export(module.exports, "
|
|
41
|
+
$parcel$export(module.exports, "getCookie", () => $8481e2034946cc4b$export$4be65e66cfa2648a);
|
|
42
|
+
$parcel$export(module.exports, "getChromeCookie", () => $1a92ef2038b55530$export$e5637297e9eb6f2e);
|
|
43
|
+
$parcel$export(module.exports, "getFirefoxCookie", () => $f9b70200901ad17d$export$c44c5fdef43f0941);
|
|
44
|
+
$parcel$export(module.exports, "getMergedRenderedCookies", () => $4ffeaeb7bb3c0319$export$cfc0723de5712e57);
|
|
39
45
|
$parcel$export(module.exports, "getGroupedRenderedCookies", () => $300d8b33187a203c$export$4d2e9997e2c23417);
|
|
40
46
|
$parcel$export(module.exports, "fetchWithCookies", () => $cfc07ae4aa2c7e44$export$b24a545a0b39f491);
|
|
41
47
|
|
|
42
|
-
const $fac425c10fbbada5$export$a7b6bc01c63cdfc3 = {};
|
|
43
|
-
(0, $7oI3p$lodash.merge)($fac425c10fbbada5$export$a7b6bc01c63cdfc3, process.env);
|
|
44
|
-
const $fac425c10fbbada5$export$a7c5707626fc90f = $fac425c10fbbada5$export$a7b6bc01c63cdfc3["HOME"];
|
|
45
|
-
if (!$fac425c10fbbada5$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
46
48
|
|
|
49
|
+
const $ef3d5dc2fd8022f5$export$6f4ae1207c703045 = process.argv ?? [];
|
|
50
|
+
const $ef3d5dc2fd8022f5$export$c348dfaf65040d9b = (0, ($parcel$interopDefault($7oI3p$minimist)))($ef3d5dc2fd8022f5$export$6f4ae1207c703045.slice(2));
|
|
47
51
|
|
|
48
52
|
|
|
49
53
|
|
|
@@ -65,35 +69,26 @@ async function $25b78d6746d4ad48$export$8d71c74f97c0202e(command) {
|
|
|
65
69
|
});
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
|
-
function $25b78d6746d4ad48$export$d53bf2de587a369(result) {
|
|
69
|
-
if (result == null) return null;
|
|
70
|
-
if (process.env.VERBOSE) console.log("result", result);
|
|
71
|
-
if (typeof result === "string" && result.length > 0) return result;
|
|
72
|
-
if (result.slice && result.toString) // noinspection JSCheckFunctionSignatures
|
|
73
|
-
return result.toString("utf8");
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
function $25b78d6746d4ad48$export$99ce3e33a555daf1(input) {
|
|
77
|
-
return typeof input !== "string" || input.length === 0;
|
|
78
|
-
}
|
|
79
|
-
function $25b78d6746d4ad48$export$5348b46700dd771c(input) {
|
|
80
|
-
return typeof input == "string" && input.length > 0;
|
|
81
|
-
}
|
|
82
72
|
|
|
83
73
|
|
|
84
74
|
|
|
75
|
+
const $fac425c10fbbada5$export$a7b6bc01c63cdfc3 = {};
|
|
76
|
+
(0, $7oI3p$lodash.merge)($fac425c10fbbada5$export$a7b6bc01c63cdfc3, process.env);
|
|
77
|
+
const $fac425c10fbbada5$export$a7c5707626fc90f = $fac425c10fbbada5$export$a7b6bc01c63cdfc3["HOME"];
|
|
78
|
+
if (!$fac425c10fbbada5$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
79
|
+
|
|
80
|
+
|
|
85
81
|
|
|
86
82
|
|
|
87
83
|
|
|
88
84
|
async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: name , maxDepth: maxDepth = 2 }) {
|
|
89
85
|
const rootSegments = path.split("/").length;
|
|
90
|
-
if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Searching for ${name} in ${path}`);
|
|
91
86
|
const files = [];
|
|
92
87
|
let readdirSync;
|
|
93
88
|
try {
|
|
94
89
|
readdirSync = $7oI3p$fs.readdirSync(path);
|
|
95
90
|
} catch (e) {
|
|
96
|
-
if ((0, $
|
|
91
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`Error reading ${path}`, e);
|
|
97
92
|
return [];
|
|
98
93
|
}
|
|
99
94
|
for (const file of readdirSync){
|
|
@@ -102,7 +97,7 @@ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: na
|
|
|
102
97
|
try {
|
|
103
98
|
stat = $7oI3p$fs.statSync(filePath);
|
|
104
99
|
} catch (e1) {
|
|
105
|
-
if ((0, $
|
|
100
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.error(`Error getting stat for ${filePath}`, e1);
|
|
106
101
|
continue;
|
|
107
102
|
}
|
|
108
103
|
if (stat.isDirectory()) {
|
|
@@ -114,11 +109,11 @@ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: na
|
|
|
114
109
|
});
|
|
115
110
|
files.push(...subFiles);
|
|
116
111
|
} catch (e2) {
|
|
117
|
-
if ((0, $
|
|
112
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.error(e2);
|
|
118
113
|
}
|
|
119
114
|
} else if (file === name) files.push(filePath);
|
|
120
115
|
}
|
|
121
|
-
if ((0, $
|
|
116
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) {
|
|
122
117
|
if (files.length > 0) {
|
|
123
118
|
console.log(`Found ${files.length} ${name} files`);
|
|
124
119
|
console.log(files);
|
|
@@ -131,45 +126,6 @@ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: na
|
|
|
131
126
|
|
|
132
127
|
|
|
133
128
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
async function $a085b524d8ee9fce$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
|
|
137
|
-
if (!file || file && !$7oI3p$fs.existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
138
|
-
const db = new $7oI3p$sqlite3.Database(file);
|
|
139
|
-
return new Promise((resolve, reject)=>{
|
|
140
|
-
db.all(sql, (err, rows)=>{
|
|
141
|
-
if (err) {
|
|
142
|
-
reject(err);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const rows1 = rows;
|
|
146
|
-
if (rows1 == null || rows1.length === 0) {
|
|
147
|
-
resolve([]);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (Array.isArray(rows1)) {
|
|
151
|
-
const cookieRows = rows1.map((row)=>{
|
|
152
|
-
const newVar = {
|
|
153
|
-
meta: {
|
|
154
|
-
file: file
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
const cookieRow = rowTransform(row);
|
|
158
|
-
return (0, $7oI3p$lodash.merge)(newVar, cookieRow);
|
|
159
|
-
});
|
|
160
|
-
resolve(cookieRows);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (process.env.VERBOSE) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
164
|
-
resolve([
|
|
165
|
-
rows1
|
|
166
|
-
]);
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
129
|
function $af69dfb8766652d8$export$bc926c43858bd3cb(obj) {
|
|
174
130
|
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
175
131
|
}
|
|
@@ -180,7 +136,19 @@ function $d66f40b581ba8bfa$export$963c8d651337e4a4(obj) {
|
|
|
180
136
|
}
|
|
181
137
|
|
|
182
138
|
|
|
139
|
+
function $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb(s) {
|
|
140
|
+
const s1 = s.replaceAll(/\./gi, ".");
|
|
141
|
+
const s2 = s1.replace(/%/g, ".*");
|
|
142
|
+
const s3 = s2.replace(/\*/g, ".*");
|
|
143
|
+
return new RegExp(s3);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
183
150
|
class $269fe42bfd555305$export$2e2bcd8739ae039 {
|
|
151
|
+
browserName = "Chrome";
|
|
184
152
|
async queryCookies(name, domain) {
|
|
185
153
|
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
186
154
|
if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).FIREFOX_ONLY) return [];
|
|
@@ -199,7 +167,7 @@ async function $269fe42bfd555305$var$getPromise1(name, domain, file) {
|
|
|
199
167
|
file: file
|
|
200
168
|
});
|
|
201
169
|
} catch (e) {
|
|
202
|
-
if ((0, $
|
|
170
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error getting encrypted cookie", e);
|
|
203
171
|
return [];
|
|
204
172
|
}
|
|
205
173
|
}
|
|
@@ -213,7 +181,7 @@ async function $269fe42bfd555305$var$getPromise(name, domain) {
|
|
|
213
181
|
const results1 = await Promise.all(promises);
|
|
214
182
|
return results1.flat().filter((0, $af69dfb8766652d8$export$bc926c43858bd3cb));
|
|
215
183
|
} catch (error) {
|
|
216
|
-
if ((0, $
|
|
184
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("error", error);
|
|
217
185
|
return [];
|
|
218
186
|
}
|
|
219
187
|
}
|
|
@@ -222,7 +190,7 @@ async function $269fe42bfd555305$var$decryptValue(password, encryptedValue) {
|
|
|
222
190
|
try {
|
|
223
191
|
d = await $269fe42bfd555305$var$decrypt(password, encryptedValue);
|
|
224
192
|
} catch (e) {
|
|
225
|
-
if ((0, $
|
|
193
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error decrypting cookie", e);
|
|
226
194
|
d = null;
|
|
227
195
|
}
|
|
228
196
|
return d ?? encryptedValue.toString("utf-8");
|
|
@@ -235,49 +203,68 @@ async function $269fe42bfd555305$var$getChromeCookies({ name: name , domain: dom
|
|
|
235
203
|
const decryptedValue = await $269fe42bfd555305$var$decryptValue(password, encryptedValue);
|
|
236
204
|
const meta = {};
|
|
237
205
|
(0, $7oI3p$lodash.merge)(meta, cookieRow.meta ?? {});
|
|
238
|
-
|
|
206
|
+
const exportedCookie = {
|
|
239
207
|
domain: cookieRow.domain,
|
|
240
208
|
name: cookieRow.name,
|
|
241
209
|
value: decryptedValue,
|
|
242
210
|
meta: meta
|
|
243
211
|
};
|
|
212
|
+
const expiry = cookieRow.expiry;
|
|
213
|
+
if (expiry) (0, $7oI3p$lodash.merge)(exportedCookie, {
|
|
214
|
+
expiry: new Date(expiry)
|
|
215
|
+
});
|
|
216
|
+
return exportedCookie;
|
|
244
217
|
});
|
|
245
218
|
const results = (await Promise.all(decrypted)).filter((0, $d66f40b581ba8bfa$export$963c8d651337e4a4));
|
|
246
|
-
if ((0, $
|
|
219
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("results", results);
|
|
247
220
|
return results;
|
|
248
221
|
}
|
|
249
222
|
const $269fe42bfd555305$var$chromeLocal = $7oI3p$path.join((0, $fac425c10fbbada5$export$a7c5707626fc90f), "Library", "Application Support", "Google", "Chrome");
|
|
250
223
|
async function $269fe42bfd555305$var$getEncryptedChromeCookie({ name: name , domain: domain , file: file = $7oI3p$path.join($269fe42bfd555305$var$chromeLocal, "Default", "Cookies") }) {
|
|
251
224
|
if (!(0, $7oI3p$fs.existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
252
|
-
if ((0, $
|
|
225
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) {
|
|
253
226
|
const s = file.split("/").slice(-3).join("/");
|
|
254
227
|
console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);
|
|
255
228
|
}
|
|
256
229
|
let sql;
|
|
257
230
|
//language=SQL
|
|
258
|
-
sql = "SELECT
|
|
231
|
+
sql = "SELECT * FROM cookies";
|
|
232
|
+
// sql = "SELECT encrypted_value, name, host_key FROM cookies";
|
|
259
233
|
const wildcardRegexp = /^([*%])$/i;
|
|
260
234
|
const specifiedName = name.match(wildcardRegexp) == null;
|
|
261
235
|
const specifiedDomain = domain.match(wildcardRegexp) == null;
|
|
262
|
-
|
|
236
|
+
const wildcardDomain = domain.match(/[%*]/) != null;
|
|
237
|
+
const queryDomain = specifiedDomain && !wildcardDomain;
|
|
238
|
+
// if we have a wildcard domain, we need to use a regexp
|
|
239
|
+
if (specifiedName || queryDomain) {
|
|
263
240
|
sql += ` WHERE `;
|
|
264
241
|
if (specifiedName) {
|
|
265
242
|
sql += `name = '${name}'`;
|
|
266
|
-
if (
|
|
243
|
+
if (queryDomain) sql += ` AND `;
|
|
244
|
+
}
|
|
245
|
+
if (queryDomain) {
|
|
246
|
+
// leading dot replaced with % to match subdomains
|
|
247
|
+
const sqlEmbedDomain = domain.replace(/^[.%]?/, "%");
|
|
248
|
+
sql += `host_key LIKE '${sqlEmbedDomain}';`;
|
|
267
249
|
}
|
|
268
|
-
if (specifiedDomain) sql += `host_key LIKE '${domain}';`;
|
|
269
250
|
}
|
|
270
|
-
|
|
251
|
+
const sqliteQuery1 = await $269fe42bfd555305$export$bd52b72df8d0d261({
|
|
271
252
|
file: file,
|
|
272
253
|
sql: sql,
|
|
273
254
|
rowTransform: (row)=>{
|
|
274
|
-
|
|
255
|
+
const cookieRow = {
|
|
256
|
+
expiry: (row["expires_utc"] / 1000000 - 11644473600) * 1000,
|
|
275
257
|
domain: row["host_key"],
|
|
276
258
|
name: row["name"],
|
|
277
259
|
value: row["encrypted_value"]
|
|
278
260
|
};
|
|
261
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("CookieRow", cookieRow);
|
|
262
|
+
return cookieRow;
|
|
279
263
|
}
|
|
280
264
|
});
|
|
265
|
+
return sqliteQuery1.filter((row)=>{
|
|
266
|
+
return row.domain.match((0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(domain)) != null;
|
|
267
|
+
});
|
|
281
268
|
}
|
|
282
269
|
async function $269fe42bfd555305$var$getChromePassword() {
|
|
283
270
|
return (0, $25b78d6746d4ad48$export$8d71c74f97c0202e)('security find-generic-password -w -s "Chrome Safe Storage"');
|
|
@@ -290,21 +277,21 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
290
277
|
if (!(encryptedData1 instanceof Buffer)) {
|
|
291
278
|
if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {
|
|
292
279
|
[encryptedData1] = encryptedData1;
|
|
293
|
-
if ((0, $
|
|
280
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`encryptedData is an array of buffers, selected first: ${encryptedData1}`);
|
|
294
281
|
} else throw new Error("encryptedData must be a Buffer: " + encryptedData1);
|
|
295
282
|
encryptedData1 = Buffer.from(encryptedData1);
|
|
296
283
|
}
|
|
297
|
-
if ((0, $
|
|
284
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`Trying to decrypt with password ${password}`);
|
|
298
285
|
return new Promise((resolve, reject)=>{
|
|
299
286
|
$7oI3p$crypto.pbkdf2(password, "saltysalt", 1003, 16, "sha1", (error, buffer)=>{
|
|
300
287
|
try {
|
|
301
288
|
if (error) {
|
|
302
|
-
if ((0, $
|
|
289
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2", error);
|
|
303
290
|
reject(error);
|
|
304
291
|
return;
|
|
305
292
|
}
|
|
306
293
|
if (buffer.length !== 16) {
|
|
307
|
-
if ((0, $
|
|
294
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, buffer length is not 16", buffer.length);
|
|
308
295
|
reject(new Error("Buffer length is not 16"));
|
|
309
296
|
return;
|
|
310
297
|
}
|
|
@@ -314,7 +301,7 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
314
301
|
decipher.setAutoPadding(false);
|
|
315
302
|
if (encryptedData1 && encryptedData1.slice) encryptedData1 = encryptedData1.slice(3);
|
|
316
303
|
if (encryptedData1.length % 16 !== 0) {
|
|
317
|
-
if ((0, $
|
|
304
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, encryptedData length is not a multiple of 16", encryptedData1.length);
|
|
318
305
|
reject(new Error("encryptedData length is not a multiple of 16"));
|
|
319
306
|
return;
|
|
320
307
|
}
|
|
@@ -322,7 +309,7 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
322
309
|
try {
|
|
323
310
|
decipher.final("utf-8");
|
|
324
311
|
} catch (e) {
|
|
325
|
-
if ((0, $
|
|
312
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing decipher.final()", e);
|
|
326
313
|
reject(e);
|
|
327
314
|
return;
|
|
328
315
|
}
|
|
@@ -337,12 +324,85 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
337
324
|
});
|
|
338
325
|
});
|
|
339
326
|
}
|
|
327
|
+
async function $269fe42bfd555305$export$bd52b72df8d0d261({ file: file , sql: sql , rowTransform: rowTransform }) {
|
|
328
|
+
if (!file || file && !(0, ($parcel$interopDefault($7oI3p$fs))).existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
329
|
+
const db = new $7oI3p$sqlite3.Database(file);
|
|
330
|
+
return new Promise((resolve, reject)=>{
|
|
331
|
+
db.all(sql, (err, rows)=>{
|
|
332
|
+
if (err) {
|
|
333
|
+
reject(err);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const rows1 = rows;
|
|
337
|
+
if (rows1 == null || rows1.length === 0) {
|
|
338
|
+
resolve([]);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (Array.isArray(rows1)) {
|
|
342
|
+
const cookieRows = rows1.map((row)=>{
|
|
343
|
+
const newVar = {
|
|
344
|
+
meta: {
|
|
345
|
+
file: file
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
const cookieRow = rowTransform(row);
|
|
349
|
+
return (0, $7oI3p$lodash.merge)(newVar, cookieRow);
|
|
350
|
+
});
|
|
351
|
+
resolve(cookieRows);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
355
|
+
resolve([
|
|
356
|
+
rows1
|
|
357
|
+
]);
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
340
365
|
|
|
341
366
|
|
|
342
367
|
|
|
343
368
|
|
|
344
369
|
|
|
345
370
|
|
|
371
|
+
async function $a085b524d8ee9fce$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
|
|
372
|
+
if (!file || file && !$7oI3p$fs.existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
373
|
+
const db = new $7oI3p$sqlite3.Database(file);
|
|
374
|
+
return new Promise((resolve, reject)=>{
|
|
375
|
+
db.all(sql, (err, rows)=>{
|
|
376
|
+
if (err) {
|
|
377
|
+
reject(err);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const rows1 = rows;
|
|
381
|
+
if (rows1 == null || rows1.length === 0) {
|
|
382
|
+
resolve([]);
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (Array.isArray(rows1)) {
|
|
386
|
+
const cookieRows = rows1.map((row)=>{
|
|
387
|
+
const newVar = {
|
|
388
|
+
meta: {
|
|
389
|
+
file: file
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
const cookieRow = rowTransform(row);
|
|
393
|
+
return (0, $7oI3p$lodash.merge)(newVar, cookieRow);
|
|
394
|
+
});
|
|
395
|
+
resolve(cookieRows);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
399
|
+
resolve([
|
|
400
|
+
rows1
|
|
401
|
+
]);
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
346
406
|
|
|
347
407
|
function $b744d19cc39f964e$export$da22813e5a2ec500({ name: name , domain: domain }) {
|
|
348
408
|
const wildcardRegexp = /^([*%])$/i;
|
|
@@ -354,6 +414,7 @@ function $b744d19cc39f964e$export$da22813e5a2ec500({ name: name , domain: domain
|
|
|
354
414
|
|
|
355
415
|
|
|
356
416
|
class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
417
|
+
browserName = "Firefox";
|
|
357
418
|
async queryCookies(name, domain) {
|
|
358
419
|
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
359
420
|
if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).CHROME_ONLY) return [];
|
|
@@ -423,6 +484,7 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
|
423
484
|
|
|
424
485
|
|
|
425
486
|
class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
|
|
487
|
+
browserName = "Safari";
|
|
426
488
|
async queryCookies(name, domain) {
|
|
427
489
|
return [];
|
|
428
490
|
}
|
|
@@ -430,14 +492,97 @@ class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
|
|
|
430
492
|
|
|
431
493
|
|
|
432
494
|
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
var $53a3bcc99a05dfcf$require$FileCookieStore = $7oI3p$toughcookiefilestore.FileCookieStore;
|
|
499
|
+
const $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8 = new $53a3bcc99a05dfcf$require$FileCookieStore(`${(0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3)["HOME"]}/cookie-star.json`);
|
|
500
|
+
const $53a3bcc99a05dfcf$export$928a906645f9d018 = new (0, $7oI3p$toughcookie.CookieJar)($53a3bcc99a05dfcf$export$6c62df16f2e9c7e8);
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
class $e4efb16e005540de$export$2e2bcd8739ae039 {
|
|
505
|
+
browserName = "internal";
|
|
506
|
+
async queryCookies(name, domain) {
|
|
507
|
+
const exportedCookies = [];
|
|
508
|
+
// if (name.match(/[%*]/) || domain.match(/[%*]/)) {
|
|
509
|
+
const cookies = await this.#getAllCookies();
|
|
510
|
+
const allExportedCookies = cookies.map((cookie)=>{
|
|
511
|
+
return this.#extracted(cookie, {
|
|
512
|
+
name: name,
|
|
513
|
+
domain: domain
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
exportedCookies.push(...allExportedCookies);
|
|
517
|
+
// }
|
|
518
|
+
const wildcardRegexp = /^([*%])$/i;
|
|
519
|
+
if (name.match(wildcardRegexp) && domain.match(wildcardRegexp)) return exportedCookies;
|
|
520
|
+
const path = "/";
|
|
521
|
+
if (domain != "%") {
|
|
522
|
+
const domain1 = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
523
|
+
const url = new URL("https://" + domain1);
|
|
524
|
+
url.pathname = path;
|
|
525
|
+
const cookies1 = await this.#getCookies(url.href);
|
|
526
|
+
const domainCookies = cookies1.map((cookie)=>{
|
|
527
|
+
return this.#extracted(cookie, {
|
|
528
|
+
domain: domain,
|
|
529
|
+
name: name
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
exportedCookies.push(...domainCookies);
|
|
533
|
+
}
|
|
534
|
+
if (name == "%") return exportedCookies.filter((cookie)=>{
|
|
535
|
+
return cookie.domain.match((0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(domain));
|
|
536
|
+
});
|
|
537
|
+
return exportedCookies.filter((cookie)=>{
|
|
538
|
+
return cookie.name.match((0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(name)) && cookie.domain.match((0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(domain));
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
#extracted(cookie, cookieSpec) {
|
|
542
|
+
return {
|
|
543
|
+
domain: cookie.domain ?? cookieSpec.domain,
|
|
544
|
+
name: cookie.key ?? cookieSpec.name,
|
|
545
|
+
value: cookie.value,
|
|
546
|
+
expiry: cookie.expires ?? Infinity,
|
|
547
|
+
meta: {
|
|
548
|
+
file: "tough-cookie"
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
#getCookies(url) {
|
|
553
|
+
return new Promise((resolve, reject)=>{
|
|
554
|
+
// @ts-ignore
|
|
555
|
+
return (0, $53a3bcc99a05dfcf$export$928a906645f9d018).getCookies(url, (err, cookies)=>{
|
|
556
|
+
if (err) reject(err);
|
|
557
|
+
else resolve(cookies ?? []);
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
#getAllCookies() {
|
|
562
|
+
return new Promise((resolve, reject)=>{
|
|
563
|
+
// @ts-ignore
|
|
564
|
+
return (0, $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8).getAllCookies((err, cookies)=>{
|
|
565
|
+
if (err) reject(err);
|
|
566
|
+
else resolve(cookies ?? []);
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
433
576
|
const $f72befa528c23ca7$var$cache = new (0, ($parcel$interopDefault($7oI3p$lrucache)))({
|
|
434
577
|
ttl: 2000,
|
|
435
578
|
max: 10
|
|
436
579
|
});
|
|
437
580
|
class $f72befa528c23ca7$export$2e2bcd8739ae039 {
|
|
581
|
+
browserName = "all";
|
|
438
582
|
#strategies;
|
|
439
583
|
constructor(){
|
|
440
584
|
this.#strategies = [
|
|
585
|
+
(0, $e4efb16e005540de$export$2e2bcd8739ae039),
|
|
441
586
|
(0, $269fe42bfd555305$export$2e2bcd8739ae039),
|
|
442
587
|
(0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039),
|
|
443
588
|
(0, $fad6f51bd5c7bae2$export$2e2bcd8739ae039),
|
|
@@ -446,13 +591,25 @@ class $f72befa528c23ca7$export$2e2bcd8739ae039 {
|
|
|
446
591
|
});
|
|
447
592
|
}
|
|
448
593
|
async queryCookies(name, domain) {
|
|
594
|
+
// domain = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
449
595
|
const key = `${name}:${domain}`;
|
|
450
596
|
const cached = $f72befa528c23ca7$var$cache.get(key);
|
|
451
597
|
if (cached) return cached;
|
|
598
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Querying cookies:", name, domain);
|
|
452
599
|
const results = await Promise.all(this.#strategies.map(async (strategy)=>{
|
|
453
600
|
// @ts-ignore
|
|
454
|
-
|
|
455
|
-
|
|
601
|
+
return strategy.queryCookies(name, domain).then((cookies)=>{
|
|
602
|
+
return cookies.map((cookie)=>{
|
|
603
|
+
return (0, $7oI3p$lodash.merge)(cookie, {
|
|
604
|
+
meta: {
|
|
605
|
+
browser: strategy.browserName
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
}).catch((e)=>{
|
|
610
|
+
console.log((0, $7oI3p$colorette.red)(`Error querying ${strategy.browserName} cookies`), e);
|
|
611
|
+
return [];
|
|
612
|
+
});
|
|
456
613
|
}));
|
|
457
614
|
const flat = results.flat();
|
|
458
615
|
$f72befa528c23ca7$var$cache.set(`${name}:${domain}`, flat);
|
|
@@ -468,7 +625,7 @@ function $9a6b2ace073cf1d7$export$2e2bcd8739ae039(token) {
|
|
|
468
625
|
const result = (0, ($parcel$interopDefault($7oI3p$jsonwebtoken))).decode(token, {
|
|
469
626
|
complete: true
|
|
470
627
|
});
|
|
471
|
-
if ((0, $
|
|
628
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose && result) console.log(result);
|
|
472
629
|
const payload = result?.payload;
|
|
473
630
|
if (payload) {
|
|
474
631
|
const exp = payload.exp;
|
|
@@ -486,48 +643,99 @@ function $9a6b2ace073cf1d7$export$2e2bcd8739ae039(token) {
|
|
|
486
643
|
|
|
487
644
|
async function $7a068a32d4710f0b$export$e6d428437cf2cacb({ name: name , domain: domain }, strategy = new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)()) {
|
|
488
645
|
const results = await strategy.queryCookies(name, domain);
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
646
|
+
const allCookies = (0, $7oI3p$lodash.uniqBy)(results, JSON.stringify);
|
|
647
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["require-jwt"]) {
|
|
648
|
+
const jwtCookies = [];
|
|
649
|
+
for (const result of allCookies){
|
|
650
|
+
const value = result.value;
|
|
651
|
+
if ((0, $9a6b2ace073cf1d7$export$2e2bcd8739ae039)(value)) jwtCookies.push(result);
|
|
652
|
+
}
|
|
653
|
+
return (0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["single"] ? [
|
|
654
|
+
jwtCookies[0]
|
|
655
|
+
] : jwtCookies;
|
|
656
|
+
} else return (0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["single"] ? [
|
|
657
|
+
allCookies[0]
|
|
658
|
+
] : allCookies;
|
|
499
659
|
}
|
|
500
660
|
|
|
501
661
|
|
|
502
662
|
|
|
663
|
+
async function $8481e2034946cc4b$export$4be65e66cfa2648a(params) {
|
|
664
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
665
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
666
|
+
else throw new Error("Cookie not found");
|
|
667
|
+
}
|
|
668
|
+
|
|
503
669
|
|
|
504
670
|
|
|
505
671
|
|
|
506
672
|
|
|
673
|
+
async function $1a92ef2038b55530$export$e5637297e9eb6f2e(params) {
|
|
674
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $269fe42bfd555305$export$2e2bcd8739ae039)());
|
|
675
|
+
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
676
|
+
return cookies.find((0, $d66f40b581ba8bfa$export$963c8d651337e4a4));
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
async function $f9b70200901ad17d$export$c44c5fdef43f0941(params) {
|
|
683
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039)());
|
|
684
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
685
|
+
else throw new Error("Cookie not found");
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
507
690
|
|
|
508
691
|
|
|
509
692
|
function $9c43c2ed82e63570$export$9abc0a414b0d8b8f(results) {
|
|
510
|
-
|
|
693
|
+
// sort by name and expiry descending
|
|
694
|
+
// takes the latest expiry for each name
|
|
695
|
+
const orderedResults = (0, $7oI3p$lodash.orderBy)(results, [
|
|
696
|
+
"name",
|
|
697
|
+
"expiry"
|
|
698
|
+
], [
|
|
699
|
+
"asc",
|
|
700
|
+
"desc"
|
|
701
|
+
]);
|
|
702
|
+
return (0, $7oI3p$lodash.uniqBy)(orderedResults, (r)=>r.name).map((r)=>r.name + "=" + r.value).join("; ");
|
|
511
703
|
}
|
|
512
704
|
|
|
513
705
|
|
|
514
|
-
|
|
515
|
-
{ name: name , domain: domain }) {
|
|
706
|
+
|
|
707
|
+
async function $300d8b33187a203c$export$4d2e9997e2c23417({ name: name , domain: domain }) {
|
|
516
708
|
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)({
|
|
517
709
|
name: name,
|
|
518
710
|
domain: domain
|
|
519
711
|
}, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
520
|
-
if (
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
712
|
+
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
713
|
+
const results = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)({
|
|
714
|
+
name: name,
|
|
715
|
+
domain: domain
|
|
716
|
+
});
|
|
717
|
+
const groupedByFile = (0, $7oI3p$lodash.groupBy)(results, (r)=>r.meta?.file);
|
|
718
|
+
return Object.keys(groupedByFile).map((file)=>{
|
|
719
|
+
const results = groupedByFile[file];
|
|
720
|
+
return (0, $9c43c2ed82e63570$export$9abc0a414b0d8b8f)(results);
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
async function $4ffeaeb7bb3c0319$export$cfc0723de5712e57({ name: name , domain: domain }) {
|
|
729
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)({
|
|
730
|
+
name: name,
|
|
731
|
+
domain: domain
|
|
732
|
+
}, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
733
|
+
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
734
|
+
const results = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)({
|
|
735
|
+
name: name,
|
|
736
|
+
domain: domain
|
|
737
|
+
});
|
|
738
|
+
return (0, $9c43c2ed82e63570$export$9abc0a414b0d8b8f)(results);
|
|
531
739
|
}
|
|
532
740
|
|
|
533
741
|
|
|
@@ -535,10 +743,14 @@ async function $300d8b33187a203c$export$4d2e9997e2c23417(//
|
|
|
535
743
|
|
|
536
744
|
|
|
537
745
|
|
|
538
|
-
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetch = (0, $7oI3p$crossfetch.fetch)) {
|
|
539
751
|
const defaultOptions = {
|
|
540
752
|
headers: {
|
|
541
|
-
"User-Agent":
|
|
753
|
+
"User-Agent": new (0, ($parcel$interopDefault($7oI3p$useragents)))().toString()
|
|
542
754
|
},
|
|
543
755
|
redirect: "manual"
|
|
544
756
|
};
|
|
@@ -547,37 +759,72 @@ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}) {
|
|
|
547
759
|
const domain = url1.hostname.replace(/^.*(\.\w+\.\w+)$/, (match, p1)=>{
|
|
548
760
|
return `%${p1}`;
|
|
549
761
|
});
|
|
550
|
-
const
|
|
762
|
+
const cookieSpec = {
|
|
551
763
|
name: "%",
|
|
552
764
|
domain: domain
|
|
765
|
+
};
|
|
766
|
+
// const cookies: string[] = await getGroupedRenderedCookies(cookieSpec).catch(
|
|
767
|
+
// () => []
|
|
768
|
+
// );
|
|
769
|
+
// const cookie = cookies.pop();
|
|
770
|
+
const cookie = await (0, $4ffeaeb7bb3c0319$export$cfc0723de5712e57)(cookieSpec).catch(()=>"");
|
|
771
|
+
const headers = {};
|
|
772
|
+
if (cookie.length > 0) (0, $7oI3p$lodash.merge)(headers, {
|
|
773
|
+
Cookie: cookie
|
|
553
774
|
});
|
|
554
|
-
const cookie = cookies.pop();
|
|
555
775
|
const newOptions1 = (0, $7oI3p$lodash.merge)(defaultOptions, options, {
|
|
556
|
-
headers:
|
|
557
|
-
Cookie: cookie
|
|
558
|
-
}
|
|
776
|
+
headers: headers
|
|
559
777
|
});
|
|
560
778
|
try {
|
|
561
|
-
const res = await
|
|
779
|
+
const res = await fetch(url2, newOptions1);
|
|
780
|
+
const headers1 = [];
|
|
781
|
+
res.headers.forEach((value, key)=>{
|
|
782
|
+
headers1.push([
|
|
783
|
+
key,
|
|
784
|
+
value
|
|
785
|
+
]);
|
|
786
|
+
});
|
|
787
|
+
for (const [key, value] of headers1)if (key === "set-cookie") {
|
|
788
|
+
await (0, $53a3bcc99a05dfcf$export$928a906645f9d018).setCookie(value, url2);
|
|
789
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log((0, $7oI3p$colorette.blue)(`Set-Cookie: ${(0, $7oI3p$colorette.yellow)(value)} ${(0, $7oI3p$colorette.yellow)(url2)}`));
|
|
790
|
+
// const cookie = tough.parse(value);
|
|
791
|
+
// if (cookie instanceof Cookie) {
|
|
792
|
+
// await memoryCookieStore.putCookie(cookie);
|
|
793
|
+
// }
|
|
794
|
+
}
|
|
562
795
|
const newUrl = res.headers.get("location");
|
|
563
|
-
if (res.redirected || newUrl && newUrl !== url2)
|
|
796
|
+
if (res.redirected || newUrl && newUrl !== url2) {
|
|
797
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log((0, $7oI3p$colorette.blue)(`Redirected to `), (0, $7oI3p$colorette.yellow)(newUrl));
|
|
798
|
+
return $cfc07ae4aa2c7e44$export$b24a545a0b39f491(newUrl, newOptions1);
|
|
799
|
+
}
|
|
564
800
|
const arrayBuffer1 = res.arrayBuffer();
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
801
|
+
async function arrayBuffer() {
|
|
802
|
+
return arrayBuffer1;
|
|
803
|
+
}
|
|
804
|
+
async function buffer() {
|
|
805
|
+
return arrayBuffer().then(Buffer.from);
|
|
806
|
+
}
|
|
807
|
+
async function text() {
|
|
808
|
+
return buffer().then((buffer)=>buffer.toString("utf8"));
|
|
809
|
+
}
|
|
810
|
+
async function json() {
|
|
811
|
+
return text().then((text)=>(0, ($parcel$interopDefault($7oI3p$destr)))(text));
|
|
812
|
+
}
|
|
813
|
+
async function formData() {
|
|
814
|
+
const urlSearchParams = await text().then((text)=>new URLSearchParams(text));
|
|
815
|
+
const formData = new FormData();
|
|
816
|
+
for (const [key, value] of urlSearchParams.entries())formData.append(key, value);
|
|
817
|
+
return formData;
|
|
818
|
+
}
|
|
819
|
+
const res1 = res;
|
|
570
820
|
const source2 = {
|
|
571
|
-
status: res.status,
|
|
572
|
-
statusText: res.statusText,
|
|
573
|
-
headers: res.headers,
|
|
574
821
|
arrayBuffer: arrayBuffer,
|
|
575
|
-
buffer: buffer,
|
|
576
822
|
text: text,
|
|
577
823
|
json: json,
|
|
824
|
+
buffer: buffer,
|
|
578
825
|
formData: formData
|
|
579
826
|
};
|
|
580
|
-
return (0, $7oI3p$lodash.merge)(
|
|
827
|
+
return (0, $7oI3p$lodash.merge)(res1, source2);
|
|
581
828
|
} catch (e) {
|
|
582
829
|
throw e;
|
|
583
830
|
}
|
|
@@ -593,21 +840,6 @@ var $3d7e27b54f670f46$exports = {};
|
|
|
593
840
|
var $6c197c88880e045c$exports = {};
|
|
594
841
|
|
|
595
842
|
|
|
596
|
-
async function $cd1ba0160120c006$export$4be65e66cfa2648a(params) {
|
|
597
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
598
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
599
|
-
else throw new Error("Cookie not found");
|
|
600
|
-
}
|
|
601
|
-
async function $cd1ba0160120c006$export$c44c5fdef43f0941(params) {
|
|
602
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039)());
|
|
603
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
604
|
-
else throw new Error("Cookie not found");
|
|
605
|
-
}
|
|
606
|
-
async function $cd1ba0160120c006$export$e5637297e9eb6f2e(params) {
|
|
607
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $269fe42bfd555305$export$2e2bcd8739ae039)());
|
|
608
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
609
|
-
else throw new Error("Cookie not found");
|
|
610
|
-
}
|
|
611
843
|
$parcel$exportWildcard(module.exports, $d5b6386167d289d2$exports);
|
|
612
844
|
$parcel$exportWildcard(module.exports, $3d7e27b54f670f46$exports);
|
|
613
845
|
$parcel$exportWildcard(module.exports, $6c197c88880e045c$exports);
|