@iflyrpa/actions 1.2.22 → 1.2.24-beta.0
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/actions/baijiahaoPublish/index.d.ts +3 -0
- package/dist/actions/toutiaoPublish/index.d.ts +3 -0
- package/dist/actions/weixinPublish/index.d.ts +3 -0
- package/dist/actions/xiaohongshuPublish/index.d.ts +3 -0
- package/dist/bundle.js +1455 -123
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +1553 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1547 -97
- package/dist/index.mjs.map +1 -1
- package/dist/utils/http.d.ts +2 -1
- package/dist/utils/proxy.d.ts +2 -0
- package/dist/utils/xhsXsEncrypt.d.ts +19 -35
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_assert__ from "assert";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_http__ from "http";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_https__ from "https";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_net__ from "net";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tls__ from "tls";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_util__ from "util";
|
|
1
10
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
2
11
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
3
12
|
import * as __WEBPACK_EXTERNAL_MODULE_dom_serializer_aa70940b__ from "dom-serializer";
|
|
@@ -10,6 +19,1055 @@ import * as __WEBPACK_EXTERNAL_MODULE_form_data_cf000082__ from "form-data";
|
|
|
10
19
|
import * as __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__ from "node:buffer";
|
|
11
20
|
import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
|
|
12
21
|
var __webpack_modules__ = {
|
|
22
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
23
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
24
|
+
if (void 0 === k2) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function() {
|
|
29
|
+
return m[k];
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
} : function(o, m, k, k2) {
|
|
34
|
+
if (void 0 === k2) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
});
|
|
37
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
38
|
+
Object.defineProperty(o, "default", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
value: v
|
|
41
|
+
});
|
|
42
|
+
} : function(o, v) {
|
|
43
|
+
o["default"] = v;
|
|
44
|
+
});
|
|
45
|
+
var __importStar = this && this.__importStar || function(mod) {
|
|
46
|
+
if (mod && mod.__esModule) return mod;
|
|
47
|
+
var result = {};
|
|
48
|
+
if (null != mod) {
|
|
49
|
+
for(var k in mod)if ("default" !== k && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
50
|
+
}
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", {
|
|
55
|
+
value: true
|
|
56
|
+
});
|
|
57
|
+
exports.req = exports.json = exports.toBuffer = void 0;
|
|
58
|
+
const http = __importStar(__webpack_require__("http"));
|
|
59
|
+
const https = __importStar(__webpack_require__("https"));
|
|
60
|
+
async function toBuffer(stream) {
|
|
61
|
+
let length = 0;
|
|
62
|
+
const chunks = [];
|
|
63
|
+
for await (const chunk of stream){
|
|
64
|
+
length += chunk.length;
|
|
65
|
+
chunks.push(chunk);
|
|
66
|
+
}
|
|
67
|
+
return Buffer.concat(chunks, length);
|
|
68
|
+
}
|
|
69
|
+
exports.toBuffer = toBuffer;
|
|
70
|
+
async function json(stream) {
|
|
71
|
+
const buf = await toBuffer(stream);
|
|
72
|
+
const str = buf.toString('utf8');
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(str);
|
|
75
|
+
} catch (_err) {
|
|
76
|
+
const err = _err;
|
|
77
|
+
err.message += ` (input: ${str})`;
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.json = json;
|
|
82
|
+
function req(url, opts = {}) {
|
|
83
|
+
const href = 'string' == typeof url ? url : url.href;
|
|
84
|
+
const req1 = (href.startsWith('https:') ? https : http).request(url, opts);
|
|
85
|
+
const promise = new Promise((resolve, reject)=>{
|
|
86
|
+
req1.once('response', resolve).once('error', reject).end();
|
|
87
|
+
});
|
|
88
|
+
req1.then = promise.then.bind(promise);
|
|
89
|
+
return req1;
|
|
90
|
+
}
|
|
91
|
+
exports.req = req;
|
|
92
|
+
},
|
|
93
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
94
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
95
|
+
if (void 0 === k2) k2 = k;
|
|
96
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
97
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function() {
|
|
100
|
+
return m[k];
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
Object.defineProperty(o, k2, desc);
|
|
104
|
+
} : function(o, m, k, k2) {
|
|
105
|
+
if (void 0 === k2) k2 = k;
|
|
106
|
+
o[k2] = m[k];
|
|
107
|
+
});
|
|
108
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
109
|
+
Object.defineProperty(o, "default", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
value: v
|
|
112
|
+
});
|
|
113
|
+
} : function(o, v) {
|
|
114
|
+
o["default"] = v;
|
|
115
|
+
});
|
|
116
|
+
var __importStar = this && this.__importStar || function(mod) {
|
|
117
|
+
if (mod && mod.__esModule) return mod;
|
|
118
|
+
var result = {};
|
|
119
|
+
if (null != mod) {
|
|
120
|
+
for(var k in mod)if ("default" !== k && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
121
|
+
}
|
|
122
|
+
__setModuleDefault(result, mod);
|
|
123
|
+
return result;
|
|
124
|
+
};
|
|
125
|
+
var __exportStar = this && this.__exportStar || function(m, exports) {
|
|
126
|
+
for(var p in m)if ("default" !== p && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
127
|
+
};
|
|
128
|
+
Object.defineProperty(exports, "__esModule", {
|
|
129
|
+
value: true
|
|
130
|
+
});
|
|
131
|
+
exports.Agent = void 0;
|
|
132
|
+
const net = __importStar(__webpack_require__("net"));
|
|
133
|
+
const http = __importStar(__webpack_require__("http"));
|
|
134
|
+
const https_1 = __webpack_require__("https");
|
|
135
|
+
__exportStar(__webpack_require__("../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"), exports);
|
|
136
|
+
const INTERNAL = Symbol('AgentBaseInternalState');
|
|
137
|
+
class Agent extends http.Agent {
|
|
138
|
+
constructor(opts){
|
|
139
|
+
super(opts);
|
|
140
|
+
this[INTERNAL] = {};
|
|
141
|
+
}
|
|
142
|
+
isSecureEndpoint(options) {
|
|
143
|
+
if (options) {
|
|
144
|
+
if ('boolean' == typeof options.secureEndpoint) return options.secureEndpoint;
|
|
145
|
+
if ('string' == typeof options.protocol) return 'https:' === options.protocol;
|
|
146
|
+
}
|
|
147
|
+
const { stack } = new Error();
|
|
148
|
+
if ('string' != typeof stack) return false;
|
|
149
|
+
return stack.split('\n').some((l)=>-1 !== l.indexOf('(https.js:') || -1 !== l.indexOf('node:https:'));
|
|
150
|
+
}
|
|
151
|
+
incrementSockets(name) {
|
|
152
|
+
if (this.maxSockets === 1 / 0 && this.maxTotalSockets === 1 / 0) return null;
|
|
153
|
+
if (!this.sockets[name]) this.sockets[name] = [];
|
|
154
|
+
const fakeSocket = new net.Socket({
|
|
155
|
+
writable: false
|
|
156
|
+
});
|
|
157
|
+
this.sockets[name].push(fakeSocket);
|
|
158
|
+
this.totalSocketCount++;
|
|
159
|
+
return fakeSocket;
|
|
160
|
+
}
|
|
161
|
+
decrementSockets(name, socket) {
|
|
162
|
+
if (!this.sockets[name] || null === socket) return;
|
|
163
|
+
const sockets = this.sockets[name];
|
|
164
|
+
const index = sockets.indexOf(socket);
|
|
165
|
+
if (-1 !== index) {
|
|
166
|
+
sockets.splice(index, 1);
|
|
167
|
+
this.totalSocketCount--;
|
|
168
|
+
if (0 === sockets.length) delete this.sockets[name];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
getName(options) {
|
|
172
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
173
|
+
if (secureEndpoint) return https_1.Agent.prototype.getName.call(this, options);
|
|
174
|
+
return super.getName(options);
|
|
175
|
+
}
|
|
176
|
+
createSocket(req, options, cb) {
|
|
177
|
+
const connectOpts = {
|
|
178
|
+
...options,
|
|
179
|
+
secureEndpoint: this.isSecureEndpoint(options)
|
|
180
|
+
};
|
|
181
|
+
const name = this.getName(connectOpts);
|
|
182
|
+
const fakeSocket = this.incrementSockets(name);
|
|
183
|
+
Promise.resolve().then(()=>this.connect(req, connectOpts)).then((socket)=>{
|
|
184
|
+
this.decrementSockets(name, fakeSocket);
|
|
185
|
+
if (socket instanceof http.Agent) try {
|
|
186
|
+
return socket.addRequest(req, connectOpts);
|
|
187
|
+
} catch (err) {
|
|
188
|
+
return cb(err);
|
|
189
|
+
}
|
|
190
|
+
this[INTERNAL].currentSocket = socket;
|
|
191
|
+
super.createSocket(req, options, cb);
|
|
192
|
+
}, (err)=>{
|
|
193
|
+
this.decrementSockets(name, fakeSocket);
|
|
194
|
+
cb(err);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
createConnection() {
|
|
198
|
+
const socket = this[INTERNAL].currentSocket;
|
|
199
|
+
this[INTERNAL].currentSocket = void 0;
|
|
200
|
+
if (!socket) throw new Error('No socket was returned in the `connect()` function');
|
|
201
|
+
return socket;
|
|
202
|
+
}
|
|
203
|
+
get defaultPort() {
|
|
204
|
+
return this[INTERNAL].defaultPort ?? ('https:' === this.protocol ? 443 : 80);
|
|
205
|
+
}
|
|
206
|
+
set defaultPort(v) {
|
|
207
|
+
if (this[INTERNAL]) this[INTERNAL].defaultPort = v;
|
|
208
|
+
}
|
|
209
|
+
get protocol() {
|
|
210
|
+
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? 'https:' : 'http:');
|
|
211
|
+
}
|
|
212
|
+
set protocol(v) {
|
|
213
|
+
if (this[INTERNAL]) this[INTERNAL].protocol = v;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
exports.Agent = Agent;
|
|
217
|
+
},
|
|
218
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js": function(module, exports, __webpack_require__) {
|
|
219
|
+
exports.formatArgs = formatArgs;
|
|
220
|
+
exports.save = save;
|
|
221
|
+
exports.load = load;
|
|
222
|
+
exports.useColors = useColors;
|
|
223
|
+
exports.storage = localstorage();
|
|
224
|
+
exports.destroy = (()=>{
|
|
225
|
+
let warned = false;
|
|
226
|
+
return ()=>{
|
|
227
|
+
if (!warned) {
|
|
228
|
+
warned = true;
|
|
229
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
})();
|
|
233
|
+
exports.colors = [
|
|
234
|
+
'#0000CC',
|
|
235
|
+
'#0000FF',
|
|
236
|
+
'#0033CC',
|
|
237
|
+
'#0033FF',
|
|
238
|
+
'#0066CC',
|
|
239
|
+
'#0066FF',
|
|
240
|
+
'#0099CC',
|
|
241
|
+
'#0099FF',
|
|
242
|
+
'#00CC00',
|
|
243
|
+
'#00CC33',
|
|
244
|
+
'#00CC66',
|
|
245
|
+
'#00CC99',
|
|
246
|
+
'#00CCCC',
|
|
247
|
+
'#00CCFF',
|
|
248
|
+
'#3300CC',
|
|
249
|
+
'#3300FF',
|
|
250
|
+
'#3333CC',
|
|
251
|
+
'#3333FF',
|
|
252
|
+
'#3366CC',
|
|
253
|
+
'#3366FF',
|
|
254
|
+
'#3399CC',
|
|
255
|
+
'#3399FF',
|
|
256
|
+
'#33CC00',
|
|
257
|
+
'#33CC33',
|
|
258
|
+
'#33CC66',
|
|
259
|
+
'#33CC99',
|
|
260
|
+
'#33CCCC',
|
|
261
|
+
'#33CCFF',
|
|
262
|
+
'#6600CC',
|
|
263
|
+
'#6600FF',
|
|
264
|
+
'#6633CC',
|
|
265
|
+
'#6633FF',
|
|
266
|
+
'#66CC00',
|
|
267
|
+
'#66CC33',
|
|
268
|
+
'#9900CC',
|
|
269
|
+
'#9900FF',
|
|
270
|
+
'#9933CC',
|
|
271
|
+
'#9933FF',
|
|
272
|
+
'#99CC00',
|
|
273
|
+
'#99CC33',
|
|
274
|
+
'#CC0000',
|
|
275
|
+
'#CC0033',
|
|
276
|
+
'#CC0066',
|
|
277
|
+
'#CC0099',
|
|
278
|
+
'#CC00CC',
|
|
279
|
+
'#CC00FF',
|
|
280
|
+
'#CC3300',
|
|
281
|
+
'#CC3333',
|
|
282
|
+
'#CC3366',
|
|
283
|
+
'#CC3399',
|
|
284
|
+
'#CC33CC',
|
|
285
|
+
'#CC33FF',
|
|
286
|
+
'#CC6600',
|
|
287
|
+
'#CC6633',
|
|
288
|
+
'#CC9900',
|
|
289
|
+
'#CC9933',
|
|
290
|
+
'#CCCC00',
|
|
291
|
+
'#CCCC33',
|
|
292
|
+
'#FF0000',
|
|
293
|
+
'#FF0033',
|
|
294
|
+
'#FF0066',
|
|
295
|
+
'#FF0099',
|
|
296
|
+
'#FF00CC',
|
|
297
|
+
'#FF00FF',
|
|
298
|
+
'#FF3300',
|
|
299
|
+
'#FF3333',
|
|
300
|
+
'#FF3366',
|
|
301
|
+
'#FF3399',
|
|
302
|
+
'#FF33CC',
|
|
303
|
+
'#FF33FF',
|
|
304
|
+
'#FF6600',
|
|
305
|
+
'#FF6633',
|
|
306
|
+
'#FF9900',
|
|
307
|
+
'#FF9933',
|
|
308
|
+
'#FFCC00',
|
|
309
|
+
'#FFCC33'
|
|
310
|
+
];
|
|
311
|
+
function useColors() {
|
|
312
|
+
if ('undefined' != typeof window && window.process && ('renderer' === window.process.type || window.process.__nwjs)) return true;
|
|
313
|
+
if ('undefined' != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
314
|
+
let m;
|
|
315
|
+
return 'undefined' != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || 'undefined' != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || 'undefined' != typeof navigator && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || 'undefined' != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
316
|
+
}
|
|
317
|
+
function formatArgs(args) {
|
|
318
|
+
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
319
|
+
if (!this.useColors) return;
|
|
320
|
+
const c = 'color: ' + this.color;
|
|
321
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
322
|
+
let index = 0;
|
|
323
|
+
let lastC = 0;
|
|
324
|
+
args[0].replace(/%[a-zA-Z%]/g, (match)=>{
|
|
325
|
+
if ('%%' === match) return;
|
|
326
|
+
index++;
|
|
327
|
+
if ('%c' === match) lastC = index;
|
|
328
|
+
});
|
|
329
|
+
args.splice(lastC, 0, c);
|
|
330
|
+
}
|
|
331
|
+
exports.log = console.debug || console.log || (()=>{});
|
|
332
|
+
function save(namespaces) {
|
|
333
|
+
try {
|
|
334
|
+
if (namespaces) exports.storage.setItem('debug', namespaces);
|
|
335
|
+
else exports.storage.removeItem('debug');
|
|
336
|
+
} catch (error) {}
|
|
337
|
+
}
|
|
338
|
+
function load() {
|
|
339
|
+
let r;
|
|
340
|
+
try {
|
|
341
|
+
r = exports.storage.getItem('debug');
|
|
342
|
+
} catch (error) {}
|
|
343
|
+
if (!r && 'undefined' != typeof process && 'env' in process) r = process.env.DEBUG;
|
|
344
|
+
return r;
|
|
345
|
+
}
|
|
346
|
+
function localstorage() {
|
|
347
|
+
try {
|
|
348
|
+
return localStorage;
|
|
349
|
+
} catch (error) {}
|
|
350
|
+
}
|
|
351
|
+
module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js")(exports);
|
|
352
|
+
const { formatters } = module.exports;
|
|
353
|
+
formatters.j = function(v) {
|
|
354
|
+
try {
|
|
355
|
+
return JSON.stringify(v);
|
|
356
|
+
} catch (error) {
|
|
357
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
},
|
|
361
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
362
|
+
function setup(env) {
|
|
363
|
+
createDebug.debug = createDebug;
|
|
364
|
+
createDebug.default = createDebug;
|
|
365
|
+
createDebug.coerce = coerce;
|
|
366
|
+
createDebug.disable = disable;
|
|
367
|
+
createDebug.enable = enable;
|
|
368
|
+
createDebug.enabled = enabled;
|
|
369
|
+
createDebug.humanize = __webpack_require__("../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js");
|
|
370
|
+
createDebug.destroy = destroy;
|
|
371
|
+
Object.keys(env).forEach((key)=>{
|
|
372
|
+
createDebug[key] = env[key];
|
|
373
|
+
});
|
|
374
|
+
createDebug.names = [];
|
|
375
|
+
createDebug.skips = [];
|
|
376
|
+
createDebug.formatters = {};
|
|
377
|
+
function selectColor(namespace) {
|
|
378
|
+
let hash = 0;
|
|
379
|
+
for(let i = 0; i < namespace.length; i++){
|
|
380
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
381
|
+
hash |= 0;
|
|
382
|
+
}
|
|
383
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
384
|
+
}
|
|
385
|
+
createDebug.selectColor = selectColor;
|
|
386
|
+
function createDebug(namespace) {
|
|
387
|
+
let prevTime;
|
|
388
|
+
let enableOverride = null;
|
|
389
|
+
let namespacesCache;
|
|
390
|
+
let enabledCache;
|
|
391
|
+
function debug(...args) {
|
|
392
|
+
if (!debug.enabled) return;
|
|
393
|
+
const self = debug;
|
|
394
|
+
const curr = Number(new Date());
|
|
395
|
+
const ms = curr - (prevTime || curr);
|
|
396
|
+
self.diff = ms;
|
|
397
|
+
self.prev = prevTime;
|
|
398
|
+
self.curr = curr;
|
|
399
|
+
prevTime = curr;
|
|
400
|
+
args[0] = createDebug.coerce(args[0]);
|
|
401
|
+
if ('string' != typeof args[0]) args.unshift('%O');
|
|
402
|
+
let index = 0;
|
|
403
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format)=>{
|
|
404
|
+
if ('%%' === match) return '%';
|
|
405
|
+
index++;
|
|
406
|
+
const formatter = createDebug.formatters[format];
|
|
407
|
+
if ('function' == typeof formatter) {
|
|
408
|
+
const val = args[index];
|
|
409
|
+
match = formatter.call(self, val);
|
|
410
|
+
args.splice(index, 1);
|
|
411
|
+
index--;
|
|
412
|
+
}
|
|
413
|
+
return match;
|
|
414
|
+
});
|
|
415
|
+
createDebug.formatArgs.call(self, args);
|
|
416
|
+
const logFn = self.log || createDebug.log;
|
|
417
|
+
logFn.apply(self, args);
|
|
418
|
+
}
|
|
419
|
+
debug.namespace = namespace;
|
|
420
|
+
debug.useColors = createDebug.useColors();
|
|
421
|
+
debug.color = createDebug.selectColor(namespace);
|
|
422
|
+
debug.extend = extend;
|
|
423
|
+
debug.destroy = createDebug.destroy;
|
|
424
|
+
Object.defineProperty(debug, 'enabled', {
|
|
425
|
+
enumerable: true,
|
|
426
|
+
configurable: false,
|
|
427
|
+
get: ()=>{
|
|
428
|
+
if (null !== enableOverride) return enableOverride;
|
|
429
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
430
|
+
namespacesCache = createDebug.namespaces;
|
|
431
|
+
enabledCache = createDebug.enabled(namespace);
|
|
432
|
+
}
|
|
433
|
+
return enabledCache;
|
|
434
|
+
},
|
|
435
|
+
set: (v)=>{
|
|
436
|
+
enableOverride = v;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
if ('function' == typeof createDebug.init) createDebug.init(debug);
|
|
440
|
+
return debug;
|
|
441
|
+
}
|
|
442
|
+
function extend(namespace, delimiter) {
|
|
443
|
+
const newDebug = createDebug(this.namespace + (void 0 === delimiter ? ':' : delimiter) + namespace);
|
|
444
|
+
newDebug.log = this.log;
|
|
445
|
+
return newDebug;
|
|
446
|
+
}
|
|
447
|
+
function enable(namespaces) {
|
|
448
|
+
createDebug.save(namespaces);
|
|
449
|
+
createDebug.namespaces = namespaces;
|
|
450
|
+
createDebug.names = [];
|
|
451
|
+
createDebug.skips = [];
|
|
452
|
+
const split = ('string' == typeof namespaces ? namespaces : '').trim().replace(' ', ',').split(',').filter(Boolean);
|
|
453
|
+
for (const ns of split)if ('-' === ns[0]) createDebug.skips.push(ns.slice(1));
|
|
454
|
+
else createDebug.names.push(ns);
|
|
455
|
+
}
|
|
456
|
+
function matchesTemplate(search, template) {
|
|
457
|
+
let searchIndex = 0;
|
|
458
|
+
let templateIndex = 0;
|
|
459
|
+
let starIndex = -1;
|
|
460
|
+
let matchIndex = 0;
|
|
461
|
+
while(searchIndex < search.length)if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || '*' === template[templateIndex])) {
|
|
462
|
+
if ('*' === template[templateIndex]) {
|
|
463
|
+
starIndex = templateIndex;
|
|
464
|
+
matchIndex = searchIndex;
|
|
465
|
+
templateIndex++;
|
|
466
|
+
} else {
|
|
467
|
+
searchIndex++;
|
|
468
|
+
templateIndex++;
|
|
469
|
+
}
|
|
470
|
+
} else {
|
|
471
|
+
if (-1 === starIndex) return false;
|
|
472
|
+
templateIndex = starIndex + 1;
|
|
473
|
+
matchIndex++;
|
|
474
|
+
searchIndex = matchIndex;
|
|
475
|
+
}
|
|
476
|
+
while(templateIndex < template.length && '*' === template[templateIndex])templateIndex++;
|
|
477
|
+
return templateIndex === template.length;
|
|
478
|
+
}
|
|
479
|
+
function disable() {
|
|
480
|
+
const namespaces = [
|
|
481
|
+
...createDebug.names,
|
|
482
|
+
...createDebug.skips.map((namespace)=>'-' + namespace)
|
|
483
|
+
].join(',');
|
|
484
|
+
createDebug.enable('');
|
|
485
|
+
return namespaces;
|
|
486
|
+
}
|
|
487
|
+
function enabled(name) {
|
|
488
|
+
for (const skip of createDebug.skips)if (matchesTemplate(name, skip)) return false;
|
|
489
|
+
for (const ns of createDebug.names)if (matchesTemplate(name, ns)) return true;
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
function coerce(val) {
|
|
493
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
494
|
+
return val;
|
|
495
|
+
}
|
|
496
|
+
function destroy() {
|
|
497
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
498
|
+
}
|
|
499
|
+
createDebug.enable(createDebug.load());
|
|
500
|
+
return createDebug;
|
|
501
|
+
}
|
|
502
|
+
module.exports = setup;
|
|
503
|
+
},
|
|
504
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
505
|
+
if ('undefined' == typeof process || 'renderer' === process.type || true === process.browser || process.__nwjs) module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js");
|
|
506
|
+
else module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js");
|
|
507
|
+
},
|
|
508
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js": function(module, exports, __webpack_require__) {
|
|
509
|
+
const tty = __webpack_require__("tty");
|
|
510
|
+
const util = __webpack_require__("util");
|
|
511
|
+
exports.init = init;
|
|
512
|
+
exports.log = log;
|
|
513
|
+
exports.formatArgs = formatArgs;
|
|
514
|
+
exports.save = save;
|
|
515
|
+
exports.load = load;
|
|
516
|
+
exports.useColors = useColors;
|
|
517
|
+
exports.destroy = util.deprecate(()=>{}, 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
518
|
+
exports.colors = [
|
|
519
|
+
6,
|
|
520
|
+
2,
|
|
521
|
+
3,
|
|
522
|
+
4,
|
|
523
|
+
5,
|
|
524
|
+
1
|
|
525
|
+
];
|
|
526
|
+
try {
|
|
527
|
+
const supportsColor = __webpack_require__("../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js");
|
|
528
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
|
|
529
|
+
20,
|
|
530
|
+
21,
|
|
531
|
+
26,
|
|
532
|
+
27,
|
|
533
|
+
32,
|
|
534
|
+
33,
|
|
535
|
+
38,
|
|
536
|
+
39,
|
|
537
|
+
40,
|
|
538
|
+
41,
|
|
539
|
+
42,
|
|
540
|
+
43,
|
|
541
|
+
44,
|
|
542
|
+
45,
|
|
543
|
+
56,
|
|
544
|
+
57,
|
|
545
|
+
62,
|
|
546
|
+
63,
|
|
547
|
+
68,
|
|
548
|
+
69,
|
|
549
|
+
74,
|
|
550
|
+
75,
|
|
551
|
+
76,
|
|
552
|
+
77,
|
|
553
|
+
78,
|
|
554
|
+
79,
|
|
555
|
+
80,
|
|
556
|
+
81,
|
|
557
|
+
92,
|
|
558
|
+
93,
|
|
559
|
+
98,
|
|
560
|
+
99,
|
|
561
|
+
112,
|
|
562
|
+
113,
|
|
563
|
+
128,
|
|
564
|
+
129,
|
|
565
|
+
134,
|
|
566
|
+
135,
|
|
567
|
+
148,
|
|
568
|
+
149,
|
|
569
|
+
160,
|
|
570
|
+
161,
|
|
571
|
+
162,
|
|
572
|
+
163,
|
|
573
|
+
164,
|
|
574
|
+
165,
|
|
575
|
+
166,
|
|
576
|
+
167,
|
|
577
|
+
168,
|
|
578
|
+
169,
|
|
579
|
+
170,
|
|
580
|
+
171,
|
|
581
|
+
172,
|
|
582
|
+
173,
|
|
583
|
+
178,
|
|
584
|
+
179,
|
|
585
|
+
184,
|
|
586
|
+
185,
|
|
587
|
+
196,
|
|
588
|
+
197,
|
|
589
|
+
198,
|
|
590
|
+
199,
|
|
591
|
+
200,
|
|
592
|
+
201,
|
|
593
|
+
202,
|
|
594
|
+
203,
|
|
595
|
+
204,
|
|
596
|
+
205,
|
|
597
|
+
206,
|
|
598
|
+
207,
|
|
599
|
+
208,
|
|
600
|
+
209,
|
|
601
|
+
214,
|
|
602
|
+
215,
|
|
603
|
+
220,
|
|
604
|
+
221
|
|
605
|
+
];
|
|
606
|
+
} catch (error) {}
|
|
607
|
+
exports.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{
|
|
608
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase());
|
|
609
|
+
let val = process.env[key];
|
|
610
|
+
val = /^(yes|on|true|enabled)$/i.test(val) ? true : /^(no|off|false|disabled)$/i.test(val) ? false : 'null' === val ? null : Number(val);
|
|
611
|
+
obj[prop] = val;
|
|
612
|
+
return obj;
|
|
613
|
+
}, {});
|
|
614
|
+
function useColors() {
|
|
615
|
+
return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
616
|
+
}
|
|
617
|
+
function formatArgs(args) {
|
|
618
|
+
const { namespace: name, useColors } = this;
|
|
619
|
+
if (useColors) {
|
|
620
|
+
const c = this.color;
|
|
621
|
+
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
622
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
623
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
624
|
+
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
625
|
+
} else args[0] = getDate() + name + ' ' + args[0];
|
|
626
|
+
}
|
|
627
|
+
function getDate() {
|
|
628
|
+
if (exports.inspectOpts.hideDate) return '';
|
|
629
|
+
return new Date().toISOString() + ' ';
|
|
630
|
+
}
|
|
631
|
+
function log(...args) {
|
|
632
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
|
633
|
+
}
|
|
634
|
+
function save(namespaces) {
|
|
635
|
+
if (namespaces) process.env.DEBUG = namespaces;
|
|
636
|
+
else delete process.env.DEBUG;
|
|
637
|
+
}
|
|
638
|
+
function load() {
|
|
639
|
+
return process.env.DEBUG;
|
|
640
|
+
}
|
|
641
|
+
function init(debug) {
|
|
642
|
+
debug.inspectOpts = {};
|
|
643
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
644
|
+
for(let i = 0; i < keys.length; i++)debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
645
|
+
}
|
|
646
|
+
module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js")(exports);
|
|
647
|
+
const { formatters } = module.exports;
|
|
648
|
+
formatters.o = function(v) {
|
|
649
|
+
this.inspectOpts.colors = this.useColors;
|
|
650
|
+
return util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' ');
|
|
651
|
+
};
|
|
652
|
+
formatters.O = function(v) {
|
|
653
|
+
this.inspectOpts.colors = this.useColors;
|
|
654
|
+
return util.inspect(v, this.inspectOpts);
|
|
655
|
+
};
|
|
656
|
+
},
|
|
657
|
+
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js": function(module) {
|
|
658
|
+
module.exports = (flag, argv = process.argv)=>{
|
|
659
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
660
|
+
const position = argv.indexOf(prefix + flag);
|
|
661
|
+
const terminatorPosition = argv.indexOf('--');
|
|
662
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
663
|
+
};
|
|
664
|
+
},
|
|
665
|
+
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
666
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
667
|
+
if (void 0 === k2) k2 = k;
|
|
668
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
669
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
670
|
+
enumerable: true,
|
|
671
|
+
get: function() {
|
|
672
|
+
return m[k];
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
Object.defineProperty(o, k2, desc);
|
|
676
|
+
} : function(o, m, k, k2) {
|
|
677
|
+
if (void 0 === k2) k2 = k;
|
|
678
|
+
o[k2] = m[k];
|
|
679
|
+
});
|
|
680
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
681
|
+
Object.defineProperty(o, "default", {
|
|
682
|
+
enumerable: true,
|
|
683
|
+
value: v
|
|
684
|
+
});
|
|
685
|
+
} : function(o, v) {
|
|
686
|
+
o["default"] = v;
|
|
687
|
+
});
|
|
688
|
+
var __importStar = this && this.__importStar || function(mod) {
|
|
689
|
+
if (mod && mod.__esModule) return mod;
|
|
690
|
+
var result = {};
|
|
691
|
+
if (null != mod) {
|
|
692
|
+
for(var k in mod)if ("default" !== k && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
693
|
+
}
|
|
694
|
+
__setModuleDefault(result, mod);
|
|
695
|
+
return result;
|
|
696
|
+
};
|
|
697
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
698
|
+
return mod && mod.__esModule ? mod : {
|
|
699
|
+
default: mod
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
Object.defineProperty(exports, "__esModule", {
|
|
703
|
+
value: true
|
|
704
|
+
});
|
|
705
|
+
exports.HttpsProxyAgent = void 0;
|
|
706
|
+
const net = __importStar(__webpack_require__("net"));
|
|
707
|
+
const tls = __importStar(__webpack_require__("tls"));
|
|
708
|
+
const assert_1 = __importDefault(__webpack_require__("assert"));
|
|
709
|
+
const debug_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"));
|
|
710
|
+
const agent_base_1 = __webpack_require__("../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js");
|
|
711
|
+
const url_1 = __webpack_require__("url");
|
|
712
|
+
const parse_proxy_response_1 = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js");
|
|
713
|
+
const debug = (0, debug_1.default)('https-proxy-agent');
|
|
714
|
+
const setServernameFromNonIpHost = (options)=>{
|
|
715
|
+
if (void 0 === options.servername && options.host && !net.isIP(options.host)) return {
|
|
716
|
+
...options,
|
|
717
|
+
servername: options.host
|
|
718
|
+
};
|
|
719
|
+
return options;
|
|
720
|
+
};
|
|
721
|
+
class HttpsProxyAgent extends agent_base_1.Agent {
|
|
722
|
+
constructor(proxy, opts){
|
|
723
|
+
super(opts);
|
|
724
|
+
this.options = {
|
|
725
|
+
path: void 0
|
|
726
|
+
};
|
|
727
|
+
this.proxy = 'string' == typeof proxy ? new url_1.URL(proxy) : proxy;
|
|
728
|
+
this.proxyHeaders = opts?.headers ?? {};
|
|
729
|
+
debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
|
|
730
|
+
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
|
|
731
|
+
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : 'https:' === this.proxy.protocol ? 443 : 80;
|
|
732
|
+
this.connectOpts = {
|
|
733
|
+
ALPNProtocols: [
|
|
734
|
+
'http/1.1'
|
|
735
|
+
],
|
|
736
|
+
...opts ? omit(opts, 'headers') : null,
|
|
737
|
+
host,
|
|
738
|
+
port
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
async connect(req, opts) {
|
|
742
|
+
const { proxy } = this;
|
|
743
|
+
if (!opts.host) throw new TypeError('No "host" provided');
|
|
744
|
+
let socket;
|
|
745
|
+
if ('https:' === proxy.protocol) {
|
|
746
|
+
debug('Creating `tls.Socket`: %o', this.connectOpts);
|
|
747
|
+
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
748
|
+
} else {
|
|
749
|
+
debug('Creating `net.Socket`: %o', this.connectOpts);
|
|
750
|
+
socket = net.connect(this.connectOpts);
|
|
751
|
+
}
|
|
752
|
+
const headers = 'function' == typeof this.proxyHeaders ? this.proxyHeaders() : {
|
|
753
|
+
...this.proxyHeaders
|
|
754
|
+
};
|
|
755
|
+
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
756
|
+
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
|
|
757
|
+
if (proxy.username || proxy.password) {
|
|
758
|
+
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
759
|
+
headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;
|
|
760
|
+
}
|
|
761
|
+
headers.Host = `${host}:${opts.port}`;
|
|
762
|
+
if (!headers['Proxy-Connection']) headers['Proxy-Connection'] = this.keepAlive ? 'Keep-Alive' : 'close';
|
|
763
|
+
for (const name of Object.keys(headers))payload += `${name}: ${headers[name]}\r\n`;
|
|
764
|
+
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
765
|
+
socket.write(`${payload}\r\n`);
|
|
766
|
+
const { connect, buffered } = await proxyResponsePromise;
|
|
767
|
+
req.emit('proxyConnect', connect);
|
|
768
|
+
this.emit('proxyConnect', connect, req);
|
|
769
|
+
if (200 === connect.statusCode) {
|
|
770
|
+
req.once('socket', resume);
|
|
771
|
+
if (opts.secureEndpoint) {
|
|
772
|
+
debug('Upgrading socket connection to TLS');
|
|
773
|
+
return tls.connect({
|
|
774
|
+
...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'),
|
|
775
|
+
socket
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return socket;
|
|
779
|
+
}
|
|
780
|
+
socket.destroy();
|
|
781
|
+
const fakeSocket = new net.Socket({
|
|
782
|
+
writable: false
|
|
783
|
+
});
|
|
784
|
+
fakeSocket.readable = true;
|
|
785
|
+
req.once('socket', (s)=>{
|
|
786
|
+
debug('Replaying proxy buffer for failed request');
|
|
787
|
+
(0, assert_1.default)(s.listenerCount('data') > 0);
|
|
788
|
+
s.push(buffered);
|
|
789
|
+
s.push(null);
|
|
790
|
+
});
|
|
791
|
+
return fakeSocket;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
HttpsProxyAgent.protocols = [
|
|
795
|
+
'http',
|
|
796
|
+
'https'
|
|
797
|
+
];
|
|
798
|
+
exports.HttpsProxyAgent = HttpsProxyAgent;
|
|
799
|
+
function resume(socket) {
|
|
800
|
+
socket.resume();
|
|
801
|
+
}
|
|
802
|
+
function omit(obj, ...keys) {
|
|
803
|
+
const ret = {};
|
|
804
|
+
let key;
|
|
805
|
+
for(key in obj)if (!keys.includes(key)) ret[key] = obj[key];
|
|
806
|
+
return ret;
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
810
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
811
|
+
return mod && mod.__esModule ? mod : {
|
|
812
|
+
default: mod
|
|
813
|
+
};
|
|
814
|
+
};
|
|
815
|
+
Object.defineProperty(exports, "__esModule", {
|
|
816
|
+
value: true
|
|
817
|
+
});
|
|
818
|
+
exports.parseProxyResponse = void 0;
|
|
819
|
+
const debug_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"));
|
|
820
|
+
const debug = (0, debug_1.default)('https-proxy-agent:parse-proxy-response');
|
|
821
|
+
function parseProxyResponse(socket) {
|
|
822
|
+
return new Promise((resolve, reject)=>{
|
|
823
|
+
let buffersLength = 0;
|
|
824
|
+
const buffers = [];
|
|
825
|
+
function read() {
|
|
826
|
+
const b = socket.read();
|
|
827
|
+
if (b) ondata(b);
|
|
828
|
+
else socket.once('readable', read);
|
|
829
|
+
}
|
|
830
|
+
function cleanup() {
|
|
831
|
+
socket.removeListener('end', onend);
|
|
832
|
+
socket.removeListener('error', onerror);
|
|
833
|
+
socket.removeListener('readable', read);
|
|
834
|
+
}
|
|
835
|
+
function onend() {
|
|
836
|
+
cleanup();
|
|
837
|
+
debug('onend');
|
|
838
|
+
reject(new Error('Proxy connection ended before receiving CONNECT response'));
|
|
839
|
+
}
|
|
840
|
+
function onerror(err) {
|
|
841
|
+
cleanup();
|
|
842
|
+
debug('onerror %o', err);
|
|
843
|
+
reject(err);
|
|
844
|
+
}
|
|
845
|
+
function ondata(b) {
|
|
846
|
+
buffers.push(b);
|
|
847
|
+
buffersLength += b.length;
|
|
848
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
849
|
+
const endOfHeaders = buffered.indexOf('\r\n\r\n');
|
|
850
|
+
if (-1 === endOfHeaders) {
|
|
851
|
+
debug('have not received end of HTTP headers yet...');
|
|
852
|
+
read();
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
const headerParts = buffered.slice(0, endOfHeaders).toString('ascii').split('\r\n');
|
|
856
|
+
const firstLine = headerParts.shift();
|
|
857
|
+
if (!firstLine) {
|
|
858
|
+
socket.destroy();
|
|
859
|
+
return reject(new Error('No header received from proxy CONNECT response'));
|
|
860
|
+
}
|
|
861
|
+
const firstLineParts = firstLine.split(' ');
|
|
862
|
+
const statusCode = +firstLineParts[1];
|
|
863
|
+
const statusText = firstLineParts.slice(2).join(' ');
|
|
864
|
+
const headers = {};
|
|
865
|
+
for (const header of headerParts){
|
|
866
|
+
if (!header) continue;
|
|
867
|
+
const firstColon = header.indexOf(':');
|
|
868
|
+
if (-1 === firstColon) {
|
|
869
|
+
socket.destroy();
|
|
870
|
+
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
871
|
+
}
|
|
872
|
+
const key = header.slice(0, firstColon).toLowerCase();
|
|
873
|
+
const value = header.slice(firstColon + 1).trimStart();
|
|
874
|
+
const current = headers[key];
|
|
875
|
+
if ('string' == typeof current) headers[key] = [
|
|
876
|
+
current,
|
|
877
|
+
value
|
|
878
|
+
];
|
|
879
|
+
else if (Array.isArray(current)) current.push(value);
|
|
880
|
+
else headers[key] = value;
|
|
881
|
+
}
|
|
882
|
+
debug('got proxy server response: %o %o', firstLine, headers);
|
|
883
|
+
cleanup();
|
|
884
|
+
resolve({
|
|
885
|
+
connect: {
|
|
886
|
+
statusCode,
|
|
887
|
+
statusText,
|
|
888
|
+
headers
|
|
889
|
+
},
|
|
890
|
+
buffered
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
socket.on('error', onerror);
|
|
894
|
+
socket.on('end', onend);
|
|
895
|
+
read();
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
exports.parseProxyResponse = parseProxyResponse;
|
|
899
|
+
},
|
|
900
|
+
"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js": function(module) {
|
|
901
|
+
var s = 1000;
|
|
902
|
+
var m = 60 * s;
|
|
903
|
+
var h = 60 * m;
|
|
904
|
+
var d = 24 * h;
|
|
905
|
+
var w = 7 * d;
|
|
906
|
+
var y = 365.25 * d;
|
|
907
|
+
module.exports = function(val, options) {
|
|
908
|
+
options = options || {};
|
|
909
|
+
var type = typeof val;
|
|
910
|
+
if ('string' === type && val.length > 0) return parse(val);
|
|
911
|
+
if ('number' === type && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
|
|
912
|
+
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
913
|
+
};
|
|
914
|
+
function parse(str) {
|
|
915
|
+
str = String(str);
|
|
916
|
+
if (str.length > 100) return;
|
|
917
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
918
|
+
if (!match) return;
|
|
919
|
+
var n = parseFloat(match[1]);
|
|
920
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
921
|
+
switch(type){
|
|
922
|
+
case 'years':
|
|
923
|
+
case 'year':
|
|
924
|
+
case 'yrs':
|
|
925
|
+
case 'yr':
|
|
926
|
+
case 'y':
|
|
927
|
+
return n * y;
|
|
928
|
+
case 'weeks':
|
|
929
|
+
case 'week':
|
|
930
|
+
case 'w':
|
|
931
|
+
return n * w;
|
|
932
|
+
case 'days':
|
|
933
|
+
case 'day':
|
|
934
|
+
case 'd':
|
|
935
|
+
return n * d;
|
|
936
|
+
case 'hours':
|
|
937
|
+
case 'hour':
|
|
938
|
+
case 'hrs':
|
|
939
|
+
case 'hr':
|
|
940
|
+
case 'h':
|
|
941
|
+
return n * h;
|
|
942
|
+
case 'minutes':
|
|
943
|
+
case 'minute':
|
|
944
|
+
case 'mins':
|
|
945
|
+
case 'min':
|
|
946
|
+
case 'm':
|
|
947
|
+
return n * m;
|
|
948
|
+
case 'seconds':
|
|
949
|
+
case 'second':
|
|
950
|
+
case 'secs':
|
|
951
|
+
case 'sec':
|
|
952
|
+
case 's':
|
|
953
|
+
return n * s;
|
|
954
|
+
case 'milliseconds':
|
|
955
|
+
case 'millisecond':
|
|
956
|
+
case 'msecs':
|
|
957
|
+
case 'msec':
|
|
958
|
+
case 'ms':
|
|
959
|
+
return n;
|
|
960
|
+
default:
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
function fmtShort(ms) {
|
|
965
|
+
var msAbs = Math.abs(ms);
|
|
966
|
+
if (msAbs >= d) return Math.round(ms / d) + 'd';
|
|
967
|
+
if (msAbs >= h) return Math.round(ms / h) + 'h';
|
|
968
|
+
if (msAbs >= m) return Math.round(ms / m) + 'm';
|
|
969
|
+
if (msAbs >= s) return Math.round(ms / s) + 's';
|
|
970
|
+
return ms + 'ms';
|
|
971
|
+
}
|
|
972
|
+
function fmtLong(ms) {
|
|
973
|
+
var msAbs = Math.abs(ms);
|
|
974
|
+
if (msAbs >= d) return plural(ms, msAbs, d, 'day');
|
|
975
|
+
if (msAbs >= h) return plural(ms, msAbs, h, 'hour');
|
|
976
|
+
if (msAbs >= m) return plural(ms, msAbs, m, 'minute');
|
|
977
|
+
if (msAbs >= s) return plural(ms, msAbs, s, 'second');
|
|
978
|
+
return ms + ' ms';
|
|
979
|
+
}
|
|
980
|
+
function plural(ms, msAbs, n, name) {
|
|
981
|
+
var isPlural = msAbs >= 1.5 * n;
|
|
982
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
"../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
986
|
+
const os = __webpack_require__("os");
|
|
987
|
+
const tty = __webpack_require__("tty");
|
|
988
|
+
const hasFlag = __webpack_require__("../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js");
|
|
989
|
+
const { env } = process;
|
|
990
|
+
let flagForceColor;
|
|
991
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
992
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
993
|
+
function envForceColor() {
|
|
994
|
+
if ('FORCE_COLOR' in env) {
|
|
995
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
996
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
997
|
+
return 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
function translateLevel(level) {
|
|
1001
|
+
if (0 === level) return false;
|
|
1002
|
+
return {
|
|
1003
|
+
level,
|
|
1004
|
+
hasBasic: true,
|
|
1005
|
+
has256: level >= 2,
|
|
1006
|
+
has16m: level >= 3
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
1010
|
+
const noFlagForceColor = envForceColor();
|
|
1011
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
1012
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
1013
|
+
if (0 === forceColor) return 0;
|
|
1014
|
+
if (sniffFlags) {
|
|
1015
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
1016
|
+
if (hasFlag('color=256')) return 2;
|
|
1017
|
+
}
|
|
1018
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
1019
|
+
const min = forceColor || 0;
|
|
1020
|
+
if ('dumb' === env.TERM) return min;
|
|
1021
|
+
if ('win32' === process.platform) {
|
|
1022
|
+
const osRelease = os.release().split('.');
|
|
1023
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1024
|
+
return 1;
|
|
1025
|
+
}
|
|
1026
|
+
if ('CI' in env) {
|
|
1027
|
+
if ([
|
|
1028
|
+
'TRAVIS',
|
|
1029
|
+
'CIRCLECI',
|
|
1030
|
+
'APPVEYOR',
|
|
1031
|
+
'GITLAB_CI',
|
|
1032
|
+
'GITHUB_ACTIONS',
|
|
1033
|
+
'BUILDKITE',
|
|
1034
|
+
'DRONE'
|
|
1035
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
1036
|
+
return min;
|
|
1037
|
+
}
|
|
1038
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1039
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
1040
|
+
if ('TERM_PROGRAM' in env) {
|
|
1041
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
1042
|
+
switch(env.TERM_PROGRAM){
|
|
1043
|
+
case 'iTerm.app':
|
|
1044
|
+
return version >= 3 ? 3 : 2;
|
|
1045
|
+
case 'Apple_Terminal':
|
|
1046
|
+
return 2;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
1050
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
1051
|
+
if ('COLORTERM' in env) return 1;
|
|
1052
|
+
return min;
|
|
1053
|
+
}
|
|
1054
|
+
function getSupportLevel(stream, options = {}) {
|
|
1055
|
+
const level = supportsColor(stream, {
|
|
1056
|
+
streamIsTTY: stream && stream.isTTY,
|
|
1057
|
+
...options
|
|
1058
|
+
});
|
|
1059
|
+
return translateLevel(level);
|
|
1060
|
+
}
|
|
1061
|
+
module.exports = {
|
|
1062
|
+
supportsColor: getSupportLevel,
|
|
1063
|
+
stdout: getSupportLevel({
|
|
1064
|
+
isTTY: tty.isatty(1)
|
|
1065
|
+
}),
|
|
1066
|
+
stderr: getSupportLevel({
|
|
1067
|
+
isTTY: tty.isatty(2)
|
|
1068
|
+
})
|
|
1069
|
+
};
|
|
1070
|
+
},
|
|
13
1071
|
"./src/utils/XhsXsCommonEnc.js": function(module) {
|
|
14
1072
|
var encrypt_lookup = [
|
|
15
1073
|
"Z",
|
|
@@ -1757,6 +2815,33 @@ var __webpack_modules__ = {
|
|
|
1757
2815
|
return Data2A_B(Base2Data(EnvData2CharCode(_0x315138, _0x1c32b3, _0x56536b)));
|
|
1758
2816
|
}
|
|
1759
2817
|
module[a0_0x45db08(0xae)] = GenAB;
|
|
2818
|
+
},
|
|
2819
|
+
assert: function(module) {
|
|
2820
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_assert__;
|
|
2821
|
+
},
|
|
2822
|
+
http: function(module) {
|
|
2823
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_http__;
|
|
2824
|
+
},
|
|
2825
|
+
https: function(module) {
|
|
2826
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_https__;
|
|
2827
|
+
},
|
|
2828
|
+
net: function(module) {
|
|
2829
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_net__;
|
|
2830
|
+
},
|
|
2831
|
+
os: function(module) {
|
|
2832
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
2833
|
+
},
|
|
2834
|
+
tls: function(module) {
|
|
2835
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_tls__;
|
|
2836
|
+
},
|
|
2837
|
+
tty: function(module) {
|
|
2838
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_tty__;
|
|
2839
|
+
},
|
|
2840
|
+
url: function(module) {
|
|
2841
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_url__;
|
|
2842
|
+
},
|
|
2843
|
+
util: function(module) {
|
|
2844
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_util__;
|
|
1760
2845
|
}
|
|
1761
2846
|
};
|
|
1762
2847
|
var __webpack_module_cache__ = {};
|
|
@@ -1768,7 +2853,7 @@ function __webpack_require__(moduleId) {
|
|
|
1768
2853
|
loaded: false,
|
|
1769
2854
|
exports: {}
|
|
1770
2855
|
};
|
|
1771
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
2856
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
1772
2857
|
module.loaded = true;
|
|
1773
2858
|
return module.exports;
|
|
1774
2859
|
}
|
|
@@ -1779,6 +2864,23 @@ function __webpack_require__(moduleId) {
|
|
|
1779
2864
|
return module;
|
|
1780
2865
|
};
|
|
1781
2866
|
})();
|
|
2867
|
+
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
2868
|
+
const ProxyData = {
|
|
2869
|
+
api: "202101291430286754",
|
|
2870
|
+
md5akey: "6ec8d333e85044b7",
|
|
2871
|
+
akey: "91709114"
|
|
2872
|
+
};
|
|
2873
|
+
const ProxyAgent = async (adr)=>{
|
|
2874
|
+
const http = new Http({});
|
|
2875
|
+
let ProxyInfo = await http.api({
|
|
2876
|
+
method: "GET",
|
|
2877
|
+
url: "https://fetdev.iflysec.com/api/publish/zdy/ip",
|
|
2878
|
+
params: {
|
|
2879
|
+
addr: adr
|
|
2880
|
+
}
|
|
2881
|
+
});
|
|
2882
|
+
return 0 === ProxyInfo.code && ProxyInfo.data.length > 0 ? new dist.HttpsProxyAgent(`http://${ProxyData.api}:${ProxyData.akey}@${ProxyInfo.data[0].proxyAddress}`) : null;
|
|
2883
|
+
};
|
|
1782
2884
|
class Http {
|
|
1783
2885
|
static handleApiError(error) {
|
|
1784
2886
|
if (error && "object" == typeof error && "code" in error && "message" in error) return error;
|
|
@@ -1788,10 +2890,11 @@ class Http {
|
|
|
1788
2890
|
data: error
|
|
1789
2891
|
};
|
|
1790
2892
|
}
|
|
1791
|
-
constructor(config){
|
|
2893
|
+
constructor(config, adr){
|
|
1792
2894
|
this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create({
|
|
1793
2895
|
...config
|
|
1794
2896
|
});
|
|
2897
|
+
this.adr = adr;
|
|
1795
2898
|
}
|
|
1796
2899
|
addResponseInterceptor(findError) {
|
|
1797
2900
|
this.apiClient.interceptors.response.use((response)=>{
|
|
@@ -1825,7 +2928,14 @@ class Http {
|
|
|
1825
2928
|
}
|
|
1826
2929
|
async api(config) {
|
|
1827
2930
|
try {
|
|
1828
|
-
const
|
|
2931
|
+
const agent = this.adr ? await ProxyAgent(this.adr) : void 0;
|
|
2932
|
+
const response = await this.apiClient({
|
|
2933
|
+
...config,
|
|
2934
|
+
...agent ? {
|
|
2935
|
+
httpAgent: agent,
|
|
2936
|
+
httpsAgent: agent
|
|
2937
|
+
} : {}
|
|
2938
|
+
});
|
|
1829
2939
|
return response.data;
|
|
1830
2940
|
} catch (error) {
|
|
1831
2941
|
return Promise.reject(Http.handleApiError(error));
|
|
@@ -2053,11 +3163,12 @@ const errnoMap = {
|
|
|
2053
3163
|
const mockAction = async (task, params)=>{
|
|
2054
3164
|
const { baijiahaoSingleCover, baijiahaoMultCover, baijiahaoCoverType } = params.settingInfo;
|
|
2055
3165
|
const tmpCachePath = task.getTmpPath();
|
|
2056
|
-
const
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
3166
|
+
const headers = {
|
|
3167
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3168
|
+
token: params.token
|
|
3169
|
+
};
|
|
3170
|
+
let http = new Http({
|
|
3171
|
+
headers
|
|
2061
3172
|
});
|
|
2062
3173
|
http.addResponseInterceptor((response)=>{
|
|
2063
3174
|
const msgType = "draft" === params.saveType ? "同步" : "发布";
|
|
@@ -2174,7 +3285,10 @@ const mockAction = async (task, params)=>{
|
|
|
2174
3285
|
const isDraft = "draft" === params.saveType;
|
|
2175
3286
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
2176
3287
|
task._timerRecord['PrePublish'] = Date.now();
|
|
2177
|
-
const
|
|
3288
|
+
const proxyHttp = new Http({
|
|
3289
|
+
headers
|
|
3290
|
+
}, params.proxyLoc);
|
|
3291
|
+
const res = await proxyHttp.api({
|
|
2178
3292
|
method: "post",
|
|
2179
3293
|
url: saveUrl,
|
|
2180
3294
|
data: publishData,
|
|
@@ -2613,57 +3727,366 @@ const searchXiaohongshuLocation = async (_task, params)=>{
|
|
|
2613
3727
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
2614
3728
|
}
|
|
2615
3729
|
};
|
|
2616
|
-
class
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
}
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
3730
|
+
class CryptoConfig {
|
|
3731
|
+
static{
|
|
3732
|
+
this.MAX_32BIT = 0xFFFFFFFF;
|
|
3733
|
+
}
|
|
3734
|
+
static{
|
|
3735
|
+
this.MAX_SIGNED_32BIT = 0x7FFFFFFF;
|
|
3736
|
+
}
|
|
3737
|
+
static{
|
|
3738
|
+
this.BASE58_ALPHABET = "NOPQRStuvwxWXYZabcyz012DEFTKLMdefghijkl4563GHIJBC7mnop89+/AUVqrsOPQefghijkABCDEFGuvwz0123456789xy";
|
|
3739
|
+
}
|
|
3740
|
+
static{
|
|
3741
|
+
this.STANDARD_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3742
|
+
}
|
|
3743
|
+
static{
|
|
3744
|
+
this.CUSTOM_BASE64_ALPHABET = "ZmserbBoHQtNP+wOcza/LpngG8yJq42KWYj0DSfdikx3VT16IlUAFM97hECvuRX5";
|
|
3745
|
+
}
|
|
3746
|
+
static{
|
|
3747
|
+
this.BASE58_BASE = 58;
|
|
3748
|
+
}
|
|
3749
|
+
static{
|
|
3750
|
+
this.BYTE_SIZE = 256;
|
|
3751
|
+
}
|
|
3752
|
+
static{
|
|
3753
|
+
this.HEX_KEY = "af572b95ca65b2d9ec76bb5d2e97cb653299cc663399cc663399cce673399cce6733190c06030100000000008040209048241289c4e271381c0e0703018040a05028148ac56231180c0683c16030984c2693c964b259ac56abd5eaf5fafd7e3f9f4f279349a4d2e9743a9d4e279349a4d2e9f47a3d1e8f47239148a4d269341a8d4623110884422190c86432994ca6d3e974baddee773b1d8e47a35128148ac5623198cce6f3f97c3e1f8f47a3d168b45aad562b158ac5e2f1f87c3e9f4f279349a4d269b45aad56";
|
|
3754
|
+
}
|
|
3755
|
+
static{
|
|
3756
|
+
this.TIMESTAMP_BYTES_COUNT = 16;
|
|
3757
|
+
}
|
|
3758
|
+
static{
|
|
3759
|
+
this.TIMESTAMP_XOR_KEY = 41;
|
|
3760
|
+
}
|
|
3761
|
+
static{
|
|
3762
|
+
this.STARTUP_TIME_OFFSET_MIN = 1000;
|
|
3763
|
+
}
|
|
3764
|
+
static{
|
|
3765
|
+
this.STARTUP_TIME_OFFSET_MAX = 4000;
|
|
3766
|
+
}
|
|
3767
|
+
static{
|
|
3768
|
+
this.EXPECTED_HEX_LENGTH = 32;
|
|
3769
|
+
}
|
|
3770
|
+
static{
|
|
3771
|
+
this.OUTPUT_BYTE_COUNT = 8;
|
|
3772
|
+
}
|
|
3773
|
+
static{
|
|
3774
|
+
this.HEX_CHUNK_SIZE = 2;
|
|
3775
|
+
}
|
|
3776
|
+
static{
|
|
3777
|
+
this.VERSION_BYTES = [
|
|
3778
|
+
119,
|
|
3779
|
+
104,
|
|
3780
|
+
96,
|
|
3781
|
+
41
|
|
3782
|
+
];
|
|
3783
|
+
}
|
|
3784
|
+
static{
|
|
3785
|
+
this.FIXED_SEPARATOR_BYTES = [
|
|
3786
|
+
16,
|
|
3787
|
+
0,
|
|
3788
|
+
0,
|
|
3789
|
+
0,
|
|
3790
|
+
15,
|
|
3791
|
+
5,
|
|
3792
|
+
0,
|
|
3793
|
+
0,
|
|
3794
|
+
47,
|
|
3795
|
+
1,
|
|
3796
|
+
0,
|
|
3797
|
+
0
|
|
3798
|
+
];
|
|
3799
|
+
}
|
|
3800
|
+
static{
|
|
3801
|
+
this.RANDOM_BYTE_COUNT = 4;
|
|
3802
|
+
}
|
|
3803
|
+
static{
|
|
3804
|
+
this.FIXED_INT_VALUE_1 = 15;
|
|
3805
|
+
}
|
|
3806
|
+
static{
|
|
3807
|
+
this.FIXED_INT_VALUE_2 = 1291;
|
|
3808
|
+
}
|
|
3809
|
+
static{
|
|
3810
|
+
this.ENV_STATIC_BYTES = [
|
|
3811
|
+
1,
|
|
3812
|
+
249,
|
|
3813
|
+
83,
|
|
3814
|
+
102,
|
|
3815
|
+
103,
|
|
3816
|
+
201,
|
|
3817
|
+
181,
|
|
3818
|
+
131,
|
|
3819
|
+
99,
|
|
3820
|
+
94,
|
|
3821
|
+
7,
|
|
3822
|
+
68,
|
|
3823
|
+
250,
|
|
3824
|
+
132,
|
|
3825
|
+
21
|
|
3826
|
+
];
|
|
3827
|
+
}
|
|
3828
|
+
static{
|
|
3829
|
+
this.SIGNATURE_DATA_TEMPLATE = {
|
|
3830
|
+
x0: "4.2.2",
|
|
3831
|
+
x1: "xhs-pc-web",
|
|
3832
|
+
x2: "Windows",
|
|
3833
|
+
x3: "",
|
|
3834
|
+
x4: "object"
|
|
2638
3835
|
};
|
|
2639
|
-
const jsonString = JSON.stringify(obj, null, 0);
|
|
2640
|
-
return __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(jsonString).toString("base64");
|
|
2641
3836
|
}
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
|
|
3837
|
+
static{
|
|
3838
|
+
this.X3_PREFIX = "mns0101_";
|
|
2645
3839
|
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
3840
|
+
static{
|
|
3841
|
+
this.XYS_PREFIX = "XYS_";
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
class RandomGenerator {
|
|
3845
|
+
generateRandomBytes(byteCount) {
|
|
3846
|
+
return Array.from({
|
|
3847
|
+
length: byteCount
|
|
3848
|
+
}, ()=>Math.floor(Math.random() * CryptoConfig.BYTE_SIZE));
|
|
2649
3849
|
}
|
|
3850
|
+
generateRandomByteInRange(minVal, maxVal) {
|
|
3851
|
+
return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
|
|
3852
|
+
}
|
|
3853
|
+
generateRandomInt() {
|
|
3854
|
+
return Math.floor(Math.random() * (CryptoConfig.MAX_32BIT + 1));
|
|
3855
|
+
}
|
|
3856
|
+
}
|
|
3857
|
+
class HexProcessor {
|
|
3858
|
+
hexStringToBytes(hexString) {
|
|
3859
|
+
const byteValues = [];
|
|
3860
|
+
for(let i = 0; i < hexString.length; i += CryptoConfig.HEX_CHUNK_SIZE){
|
|
3861
|
+
const hexChunk = hexString.substr(i, CryptoConfig.HEX_CHUNK_SIZE);
|
|
3862
|
+
byteValues.push(parseInt(hexChunk, 16));
|
|
3863
|
+
}
|
|
3864
|
+
return byteValues;
|
|
3865
|
+
}
|
|
3866
|
+
processHexParameter(hexString, xorKey) {
|
|
3867
|
+
if (hexString.length !== CryptoConfig.EXPECTED_HEX_LENGTH) throw new Error(`hex parameter must be ${CryptoConfig.EXPECTED_HEX_LENGTH} characters`);
|
|
3868
|
+
const byteValues = this.hexStringToBytes(hexString);
|
|
3869
|
+
return byteValues.map((byteVal)=>byteVal ^ xorKey).slice(0, CryptoConfig.OUTPUT_BYTE_COUNT);
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
class BitOperations {
|
|
3873
|
+
normalizeTo32bit(value) {
|
|
3874
|
+
return value & CryptoConfig.MAX_32BIT;
|
|
3875
|
+
}
|
|
3876
|
+
toSigned32bit(unsignedValue) {
|
|
3877
|
+
if (unsignedValue > CryptoConfig.MAX_SIGNED_32BIT) return unsignedValue - 0x100000000;
|
|
3878
|
+
return unsignedValue;
|
|
3879
|
+
}
|
|
3880
|
+
computeSeedValue(seed32bit) {
|
|
3881
|
+
const normalizedSeed = this.normalizeTo32bit(seed32bit);
|
|
3882
|
+
const shift15Bits = normalizedSeed >> 15;
|
|
3883
|
+
const shift13Bits = normalizedSeed >> 13;
|
|
3884
|
+
const shift12Bits = normalizedSeed >> 12;
|
|
3885
|
+
const shift10Bits = normalizedSeed >> 10;
|
|
3886
|
+
const xorMaskedResult = shift15Bits & ~shift13Bits | shift13Bits & ~shift15Bits;
|
|
3887
|
+
const shiftedResult = (xorMaskedResult ^ shift12Bits ^ shift10Bits) << 31 & CryptoConfig.MAX_32BIT;
|
|
3888
|
+
return this.toSigned32bit(shiftedResult);
|
|
3889
|
+
}
|
|
3890
|
+
xorTransformArray(sourceIntegers) {
|
|
3891
|
+
const resultBytes = new Uint8Array(sourceIntegers.length);
|
|
3892
|
+
const hexKeyBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(CryptoConfig.HEX_KEY, 'hex');
|
|
3893
|
+
for(let index = 0; index < sourceIntegers.length; index++)resultBytes[index] = (sourceIntegers[index] ^ hexKeyBytes[index]) & 0xFF;
|
|
3894
|
+
return resultBytes;
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
class Base58Encoder {
|
|
3898
|
+
encodeToB58(inputBytes) {
|
|
3899
|
+
const bytesArray = Array.isArray(inputBytes) ? inputBytes : Array.from(inputBytes);
|
|
3900
|
+
const numberAccumulator = this.bytesToNumber(bytesArray);
|
|
3901
|
+
const leadingZerosCount = this.countLeadingZeros(bytesArray);
|
|
3902
|
+
const encodedCharacters = this.numberToBase58Chars(numberAccumulator);
|
|
3903
|
+
encodedCharacters.push(...Array(leadingZerosCount).fill(CryptoConfig.BASE58_ALPHABET[0]));
|
|
3904
|
+
return encodedCharacters.reverse().join('');
|
|
3905
|
+
}
|
|
3906
|
+
bytesToNumber(inputBytes) {
|
|
3907
|
+
const bytesArray = Array.isArray(inputBytes) ? inputBytes : Array.from(inputBytes);
|
|
3908
|
+
let result = 0n;
|
|
3909
|
+
const BYTE_SIZE = 256n;
|
|
3910
|
+
for (const byteValue of bytesArray)result = result * BYTE_SIZE + BigInt(byteValue);
|
|
3911
|
+
return result;
|
|
3912
|
+
}
|
|
3913
|
+
countLeadingZeros(inputBytes) {
|
|
3914
|
+
let count = 0;
|
|
3915
|
+
for (const byteValue of inputBytes)if (0 === byteValue) count++;
|
|
3916
|
+
else break;
|
|
3917
|
+
return count;
|
|
3918
|
+
}
|
|
3919
|
+
numberToBase58Chars(number) {
|
|
3920
|
+
const characters = [];
|
|
3921
|
+
const base = BigInt(CryptoConfig.BASE58_BASE);
|
|
3922
|
+
while(number > 0n){
|
|
3923
|
+
const remainder = number % base;
|
|
3924
|
+
characters.push(CryptoConfig.BASE58_ALPHABET[Number(remainder)]);
|
|
3925
|
+
number /= base;
|
|
3926
|
+
}
|
|
3927
|
+
return characters;
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
class Base64Encoder {
|
|
3931
|
+
encodeToB64(dataToEncode) {
|
|
3932
|
+
const dataBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(dataToEncode, 'utf-8');
|
|
3933
|
+
const standardEncodedString = dataBytes.toString('base64');
|
|
3934
|
+
let result = '';
|
|
3935
|
+
for (const char of standardEncodedString){
|
|
3936
|
+
const index = CryptoConfig.STANDARD_BASE64_ALPHABET.indexOf(char);
|
|
3937
|
+
if (-1 !== index) result += CryptoConfig.CUSTOM_BASE64_ALPHABET[index];
|
|
3938
|
+
else result += char;
|
|
3939
|
+
}
|
|
3940
|
+
return result;
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
class RequestSignatureValidator {
|
|
3944
|
+
static validateMethod(method) {
|
|
3945
|
+
if ('string' != typeof method) throw new TypeError(`method must be string, got ${typeof method}`);
|
|
3946
|
+
const upperMethod = method.trim().toUpperCase();
|
|
3947
|
+
if ('GET' !== upperMethod && 'POST' !== upperMethod) throw new Error(`method must be 'GET' or 'POST', got '${upperMethod}'`);
|
|
3948
|
+
return upperMethod;
|
|
3949
|
+
}
|
|
3950
|
+
static validateUri(uri) {
|
|
3951
|
+
if ('string' != typeof uri) throw new TypeError(`uri must be string, got ${typeof uri}`);
|
|
3952
|
+
if (!uri.trim()) throw new Error('uri cannot be empty');
|
|
3953
|
+
return uri.trim();
|
|
3954
|
+
}
|
|
3955
|
+
static validateA1Value(a1Value) {
|
|
3956
|
+
if ('string' != typeof a1Value) throw new TypeError(`a1_value must be string, got ${typeof a1Value}`);
|
|
3957
|
+
if (!a1Value.trim()) throw new Error('a1_value cannot be empty');
|
|
3958
|
+
return a1Value.trim();
|
|
3959
|
+
}
|
|
3960
|
+
static validateXsecAppid(xsecAppid) {
|
|
3961
|
+
if ('string' != typeof xsecAppid) throw new TypeError(`xsec_appid must be string, got ${typeof xsecAppid}`);
|
|
3962
|
+
if (!xsecAppid.trim()) throw new Error('xsec_appid cannot be empty');
|
|
3963
|
+
return xsecAppid.trim();
|
|
3964
|
+
}
|
|
3965
|
+
static validatePayload(payload) {
|
|
3966
|
+
if (null !== payload && 'object' != typeof payload) throw new TypeError(`payload must be object or null, got ${typeof payload}`);
|
|
3967
|
+
if (null != payload) {
|
|
3968
|
+
for(const key in payload)if ('string' != typeof key) throw new TypeError(`payload keys must be string, got ${typeof key} for key '${key}'`);
|
|
3969
|
+
}
|
|
3970
|
+
return payload;
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
class CryptoProcessor {
|
|
2650
3974
|
constructor(){
|
|
2651
|
-
this.
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
3975
|
+
this.bitOps = new BitOperations();
|
|
3976
|
+
this.b58encoder = new Base58Encoder();
|
|
3977
|
+
this.b64encoder = new Base64Encoder();
|
|
3978
|
+
this.hexProcessor = new HexProcessor();
|
|
3979
|
+
this.randomGen = new RandomGenerator();
|
|
3980
|
+
}
|
|
3981
|
+
encodeTimestamp(ts, randomizeFirst = true) {
|
|
3982
|
+
const key = Array(8).fill(CryptoConfig.TIMESTAMP_XOR_KEY);
|
|
3983
|
+
const arr = this.intToLeBytes(ts, 8);
|
|
3984
|
+
const encoded = arr.map((a, i)=>a ^ key[i]);
|
|
3985
|
+
if (randomizeFirst) encoded[0] = this.randomGen.generateRandomByteInRange(0, 255);
|
|
3986
|
+
return encoded;
|
|
3987
|
+
}
|
|
3988
|
+
intToLeBytes(val, length = 4) {
|
|
3989
|
+
const arr = [];
|
|
3990
|
+
for(let i = 0; i < length; i++){
|
|
3991
|
+
arr.push(0xFF & val);
|
|
3992
|
+
val >>>= 8;
|
|
3993
|
+
}
|
|
3994
|
+
return arr;
|
|
3995
|
+
}
|
|
3996
|
+
strToLenPrefixedBytes(s) {
|
|
3997
|
+
const buf = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(s, 'utf-8');
|
|
3998
|
+
return [
|
|
3999
|
+
buf.length,
|
|
4000
|
+
...Array.from(buf)
|
|
4001
|
+
];
|
|
4002
|
+
}
|
|
4003
|
+
buildEnvironmentBytes() {
|
|
4004
|
+
return [
|
|
4005
|
+
CryptoConfig.ENV_STATIC_BYTES[0],
|
|
4006
|
+
this.randomGen.generateRandomByteInRange(10, 254),
|
|
4007
|
+
...CryptoConfig.ENV_STATIC_BYTES.slice(1)
|
|
2656
4008
|
];
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
4009
|
+
}
|
|
4010
|
+
buildPayloadArray(hexParameter, a1Value, appIdentifier = "xhs-pc-web", stringParam = "") {
|
|
4011
|
+
const randNum = this.randomGen.generateRandomInt();
|
|
4012
|
+
const ts = Date.now();
|
|
4013
|
+
const startupTs = ts - (CryptoConfig.STARTUP_TIME_OFFSET_MIN + this.randomGen.generateRandomByteInRange(0, CryptoConfig.STARTUP_TIME_OFFSET_MAX - CryptoConfig.STARTUP_TIME_OFFSET_MIN));
|
|
4014
|
+
const arr = [];
|
|
4015
|
+
arr.push(...CryptoConfig.VERSION_BYTES);
|
|
4016
|
+
const randBytes = this.intToLeBytes(randNum, 4);
|
|
4017
|
+
arr.push(...randBytes);
|
|
4018
|
+
const xorKey = randBytes[0];
|
|
4019
|
+
arr.push(...this.encodeTimestamp(ts, true));
|
|
4020
|
+
arr.push(...this.intToLeBytes(startupTs, 8));
|
|
4021
|
+
arr.push(...this.intToLeBytes(CryptoConfig.FIXED_INT_VALUE_1));
|
|
4022
|
+
arr.push(...this.intToLeBytes(CryptoConfig.FIXED_INT_VALUE_2));
|
|
4023
|
+
const stringParamLength = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(stringParam, 'utf-8').length;
|
|
4024
|
+
arr.push(...this.intToLeBytes(stringParamLength));
|
|
4025
|
+
const md5Bytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(hexParameter, 'hex');
|
|
4026
|
+
const xorMd5Bytes = Array.from(md5Bytes).map((b)=>b ^ xorKey);
|
|
4027
|
+
arr.push(...xorMd5Bytes.slice(0, 8));
|
|
4028
|
+
arr.push(...this.strToLenPrefixedBytes(a1Value));
|
|
4029
|
+
arr.push(...this.strToLenPrefixedBytes(appIdentifier));
|
|
4030
|
+
arr.push(CryptoConfig.ENV_STATIC_BYTES[0], this.randomGen.generateRandomByteInRange(0, 255), ...CryptoConfig.ENV_STATIC_BYTES.slice(1));
|
|
4031
|
+
return arr;
|
|
2664
4032
|
}
|
|
2665
4033
|
}
|
|
2666
|
-
|
|
4034
|
+
class Xhshow {
|
|
4035
|
+
constructor(){
|
|
4036
|
+
this.cryptoProcessor = new CryptoProcessor();
|
|
4037
|
+
}
|
|
4038
|
+
buildContentString(method, uri, payload) {
|
|
4039
|
+
payload = payload || {};
|
|
4040
|
+
if ("POST" === method.toUpperCase()) return uri + JSON.stringify(payload);
|
|
4041
|
+
if (!payload || 0 === Object.keys(payload).length) return uri;
|
|
4042
|
+
{
|
|
4043
|
+
const params = Object.entries(payload).map(([key, value])=>{
|
|
4044
|
+
let valueStr = '';
|
|
4045
|
+
if (Array.isArray(value)) valueStr = value.map((v)=>String(v)).join(',');
|
|
4046
|
+
else if (null != value) valueStr = String(value);
|
|
4047
|
+
return `${key}=${valueStr}`;
|
|
4048
|
+
});
|
|
4049
|
+
return `${uri}?${params.join('&')}`;
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
generateDValue(content) {
|
|
4053
|
+
return __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createHash('md5').update(content, 'utf-8').digest('hex');
|
|
4054
|
+
}
|
|
4055
|
+
buildSignature(dValue, a1Value, xsecAppid = "xhs-pc-web", stringParam = "") {
|
|
4056
|
+
const payloadArray = this.cryptoProcessor.buildPayloadArray(dValue, a1Value, xsecAppid, stringParam);
|
|
4057
|
+
const xorResult = this.cryptoProcessor.bitOps.xorTransformArray(payloadArray);
|
|
4058
|
+
return this.cryptoProcessor.b58encoder.encodeToB58(xorResult);
|
|
4059
|
+
}
|
|
4060
|
+
signXs(method, uri, a1Value, xsecAppid = "xhs-pc-web", payload) {
|
|
4061
|
+
const validatedMethod = RequestSignatureValidator.validateMethod(method);
|
|
4062
|
+
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
4063
|
+
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
4064
|
+
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
4065
|
+
const validatedPayload = RequestSignatureValidator.validatePayload(payload);
|
|
4066
|
+
const signatureData = {
|
|
4067
|
+
...CryptoConfig.SIGNATURE_DATA_TEMPLATE
|
|
4068
|
+
};
|
|
4069
|
+
const contentString = this.buildContentString(validatedMethod, validatedUri, validatedPayload);
|
|
4070
|
+
const dValue = this.generateDValue(contentString);
|
|
4071
|
+
signatureData.x3 = CryptoConfig.X3_PREFIX + this.buildSignature(dValue, validatedA1Value, validatedXsecAppid, contentString);
|
|
4072
|
+
return CryptoConfig.XYS_PREFIX + this.cryptoProcessor.b64encoder.encodeToB64(JSON.stringify(signatureData));
|
|
4073
|
+
}
|
|
4074
|
+
signXsGet(uri, a1Value, xsecAppid = "xhs-pc-web", params) {
|
|
4075
|
+
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
4076
|
+
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
4077
|
+
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
4078
|
+
const validatedParams = RequestSignatureValidator.validatePayload(params);
|
|
4079
|
+
return this.signXs("GET", validatedUri, validatedA1Value, validatedXsecAppid, validatedParams);
|
|
4080
|
+
}
|
|
4081
|
+
signXsPost(uri, a1Value, xsecAppid = "xhs-pc-web", payload) {
|
|
4082
|
+
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
4083
|
+
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
4084
|
+
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
4085
|
+
const validatedPayload = RequestSignatureValidator.validatePayload(payload);
|
|
4086
|
+
return this.signXs("POST", validatedUri, validatedA1Value, validatedXsecAppid, validatedPayload);
|
|
4087
|
+
}
|
|
4088
|
+
}
|
|
4089
|
+
const searchXiaohongshuTopicList_xsEncrypt = new Xhshow();
|
|
2667
4090
|
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
2668
4091
|
const http = new Http({
|
|
2669
4092
|
headers: {
|
|
@@ -2691,9 +4114,8 @@ const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
|
2691
4114
|
page: 1
|
|
2692
4115
|
}
|
|
2693
4116
|
};
|
|
2694
|
-
const
|
|
2695
|
-
const
|
|
2696
|
-
const xs = await searchXiaohongshuTopicList_xsEncrypt.encryptXs(fatchTopic, a1Cookie, xt);
|
|
4117
|
+
const fatchTopic = "/web_api/sns/v1/search/topic";
|
|
4118
|
+
const xs = searchXiaohongshuTopicList_xsEncrypt.signXsPost(fatchTopic, a1Cookie, "xhs-pc-web", topicData);
|
|
2697
4119
|
const result = await http.api({
|
|
2698
4120
|
method: "post",
|
|
2699
4121
|
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
@@ -2742,12 +4164,13 @@ const get3101DetailError = (errorList, message, saveType)=>{
|
|
|
2742
4164
|
const mock_mockAction = async (task, params)=>{
|
|
2743
4165
|
const { toutiaoSingleCover, toutiaoMultCover, toutiaoCoverType, toutiaoOriginal, toutiaoExclusive, toutiaoClaim } = params.settingInfo;
|
|
2744
4166
|
const tmpCachePath = task.getTmpPath();
|
|
4167
|
+
const headers = {
|
|
4168
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
4169
|
+
origin: "https://mp.toutiao.com",
|
|
4170
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
4171
|
+
};
|
|
2745
4172
|
const http = new Http({
|
|
2746
|
-
headers
|
|
2747
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2748
|
-
origin: "https://mp.toutiao.com",
|
|
2749
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2750
|
-
}
|
|
4173
|
+
headers
|
|
2751
4174
|
});
|
|
2752
4175
|
http.addResponseInterceptor((response)=>{
|
|
2753
4176
|
if (response.data?.code !== 0) {
|
|
@@ -2906,7 +4329,10 @@ const mock_mockAction = async (task, params)=>{
|
|
|
2906
4329
|
},
|
|
2907
4330
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
2908
4331
|
};
|
|
2909
|
-
const
|
|
4332
|
+
const proxyHttp = new Http({
|
|
4333
|
+
headers
|
|
4334
|
+
}, params.proxyLoc);
|
|
4335
|
+
const publishResult = await proxyHttp.api(publishOption);
|
|
2910
4336
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id);
|
|
2911
4337
|
};
|
|
2912
4338
|
const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
|
|
@@ -3527,10 +4953,10 @@ async function getXiaohongshuData(params) {
|
|
|
3527
4953
|
origin: "https://creator.xiaohongshu.com"
|
|
3528
4954
|
}
|
|
3529
4955
|
});
|
|
3530
|
-
const xsEncrypt = new
|
|
4956
|
+
const xsEncrypt = new Xhshow();
|
|
3531
4957
|
const xt = Date.now().toString();
|
|
3532
4958
|
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
3533
|
-
const xs =
|
|
4959
|
+
const xs = xsEncrypt.signXsGet(sevenDataUrl, a1Cookie, "xhs-pc-web", null);
|
|
3534
4960
|
const [overAllData, sevenData] = await Promise.all([
|
|
3535
4961
|
http.api({
|
|
3536
4962
|
method: "get",
|
|
@@ -3891,7 +5317,7 @@ async function handleBaijiahaoData(params) {
|
|
|
3891
5317
|
async function handleXiaohongshuData(params) {
|
|
3892
5318
|
try {
|
|
3893
5319
|
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3894
|
-
const xsEncrypt = new
|
|
5320
|
+
const xsEncrypt = new Xhshow();
|
|
3895
5321
|
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
3896
5322
|
if (!a1Cookie) return {
|
|
3897
5323
|
code: 200,
|
|
@@ -3912,8 +5338,12 @@ async function handleXiaohongshuData(params) {
|
|
|
3912
5338
|
});
|
|
3913
5339
|
async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
|
|
3914
5340
|
const xt = Date.now().toString();
|
|
3915
|
-
const serveUrl =
|
|
3916
|
-
const
|
|
5341
|
+
const serveUrl = "/web_api/sns/v5/creator/note/user/posted";
|
|
5342
|
+
const serveParams = {
|
|
5343
|
+
tab: onlySuccess ? 1 : 0,
|
|
5344
|
+
page: pageNum - 1
|
|
5345
|
+
};
|
|
5346
|
+
const xs = xsEncrypt.signXsGet(serveUrl, a1Cookie, "xhs-pc-web", serveParams);
|
|
3917
5347
|
return await http.api({
|
|
3918
5348
|
method: "get",
|
|
3919
5349
|
baseURL: "https://edith.xiaohongshu.com",
|
|
@@ -3921,7 +5351,8 @@ async function handleXiaohongshuData(params) {
|
|
|
3921
5351
|
headers: {
|
|
3922
5352
|
"x-s": xs,
|
|
3923
5353
|
"x-t": xt
|
|
3924
|
-
}
|
|
5354
|
+
},
|
|
5355
|
+
params: serveParams
|
|
3925
5356
|
});
|
|
3926
5357
|
}
|
|
3927
5358
|
const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
|
|
@@ -4206,13 +5637,14 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
4206
5637
|
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
4207
5638
|
const client_time_diff = +Number("1743488763") - Math.floor(new Date().getTime() / 1000);
|
|
4208
5639
|
const tmpCachePath = task.getTmpPath();
|
|
5640
|
+
const headers = {
|
|
5641
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0",
|
|
5642
|
+
Cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
5643
|
+
origin: "https://mp.weixin.qq.com",
|
|
5644
|
+
referer: `https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit&action=edit&isNew=1&type=77&createType=0&token=${params.token}&lang=zh_CN×tamp=${Date.now()}`
|
|
5645
|
+
};
|
|
4209
5646
|
const http = new Http({
|
|
4210
|
-
headers
|
|
4211
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0",
|
|
4212
|
-
Cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
4213
|
-
origin: "https://mp.weixin.qq.com",
|
|
4214
|
-
referer: `https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit&action=edit&isNew=1&type=77&createType=0&token=${params.token}&lang=zh_CN×tamp=${Date.now()}`
|
|
4215
|
-
}
|
|
5647
|
+
headers
|
|
4216
5648
|
});
|
|
4217
5649
|
http.addResponseInterceptor((response)=>{
|
|
4218
5650
|
const responseData = response.data;
|
|
@@ -4759,6 +6191,9 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
4759
6191
|
};
|
|
4760
6192
|
const uuid = getUuidResult.uuid;
|
|
4761
6193
|
await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.sleep)(1000);
|
|
6194
|
+
new Http({
|
|
6195
|
+
headers
|
|
6196
|
+
}, params.proxyLoc);
|
|
4762
6197
|
const qrcodeResult = await http.api({
|
|
4763
6198
|
method: "get",
|
|
4764
6199
|
url: "https://mp.weixin.qq.com/safe/safeqrcode",
|
|
@@ -4778,7 +6213,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
4778
6213
|
responseType: "arraybuffer"
|
|
4779
6214
|
});
|
|
4780
6215
|
const qrcodeBuffer = Buffer.from(qrcodeResult);
|
|
4781
|
-
const qrcodeFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath,
|
|
6216
|
+
const qrcodeFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, `weixin_qrcode_${Date.now()}.jpg`);
|
|
4782
6217
|
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].writeFileSync(qrcodeFilePath, new Uint8Array(qrcodeBuffer));
|
|
4783
6218
|
params.safeQrcodeCallback?.(qrcodeFilePath);
|
|
4784
6219
|
let code = "";
|
|
@@ -5545,7 +6980,7 @@ const xiaohongshuPublish_mock_errnoMap = {
|
|
|
5545
6980
|
902: "登录已过期,请重新登录!",
|
|
5546
6981
|
906: "账号存在风险,请重新登录"
|
|
5547
6982
|
};
|
|
5548
|
-
const mock_xsEncrypt = new
|
|
6983
|
+
const mock_xsEncrypt = new Xhshow();
|
|
5549
6984
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
5550
6985
|
const tmpCachePath = task.getTmpPath();
|
|
5551
6986
|
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
@@ -5554,13 +6989,14 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
5554
6989
|
message: "账号数据异常,请重新绑定账号后重试。",
|
|
5555
6990
|
data: ""
|
|
5556
6991
|
};
|
|
6992
|
+
const headers = {
|
|
6993
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
6994
|
+
origin: "https://creator.xiaohongshu.com",
|
|
6995
|
+
referer: "https://creator.xiaohongshu.com/",
|
|
6996
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
|
|
6997
|
+
};
|
|
5557
6998
|
const http = new Http({
|
|
5558
|
-
headers
|
|
5559
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
5560
|
-
origin: "https://creator.xiaohongshu.com",
|
|
5561
|
-
referer: "https://creator.xiaohongshu.com/",
|
|
5562
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
|
|
5563
|
-
}
|
|
6999
|
+
headers
|
|
5564
7000
|
});
|
|
5565
7001
|
http.addResponseInterceptor((response)=>{
|
|
5566
7002
|
const responseData = response.data;
|
|
@@ -5573,9 +7009,16 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
5573
7009
|
};
|
|
5574
7010
|
}
|
|
5575
7011
|
});
|
|
5576
|
-
const fetchCoverUrl =
|
|
7012
|
+
const fetchCoverUrl = "/api/media/v1/upload/creator/permit";
|
|
7013
|
+
const fetchCoverParams = {
|
|
7014
|
+
biz_name: "spectrum",
|
|
7015
|
+
scene: "image",
|
|
7016
|
+
file_count: params.banners.length,
|
|
7017
|
+
version: 1,
|
|
7018
|
+
source: "web"
|
|
7019
|
+
};
|
|
5577
7020
|
const xt = Date.now().toString();
|
|
5578
|
-
const xs =
|
|
7021
|
+
const xs = mock_xsEncrypt.signXsGet(fetchCoverUrl, a1Cookie, "xhs-pc-web", fetchCoverParams);
|
|
5579
7022
|
const coverIdInfo = await http.api({
|
|
5580
7023
|
method: "get",
|
|
5581
7024
|
baseURL: "https://creator.xiaohongshu.com",
|
|
@@ -5584,7 +7027,8 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
5584
7027
|
headers: {
|
|
5585
7028
|
"x-s": xs,
|
|
5586
7029
|
"x-t": xt
|
|
5587
|
-
}
|
|
7030
|
+
},
|
|
7031
|
+
params: fetchCoverParams
|
|
5588
7032
|
});
|
|
5589
7033
|
let uploadInfos = [];
|
|
5590
7034
|
coverIdInfo.data.uploadTempPermits.forEach((item)=>{
|
|
@@ -5658,9 +7102,8 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
5658
7102
|
const topicData = {
|
|
5659
7103
|
topic_names: topic["name"]
|
|
5660
7104
|
};
|
|
5661
|
-
const topicDataStr = mock_xsEncrypt.dumps(topicData);
|
|
5662
7105
|
const publishXt = Date.now().toString();
|
|
5663
|
-
const publishXs =
|
|
7106
|
+
const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/capa/postgw/topic/batch_customized", a1Cookie, "xhs-pc-web", topicData);
|
|
5664
7107
|
let createTopic = await http.api({
|
|
5665
7108
|
method: "POST",
|
|
5666
7109
|
url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
|
|
@@ -5743,7 +7186,6 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
5743
7186
|
};
|
|
5744
7187
|
}
|
|
5745
7188
|
}
|
|
5746
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
5747
7189
|
const business_binds = {
|
|
5748
7190
|
version: 1,
|
|
5749
7191
|
bizType: "",
|
|
@@ -5760,11 +7202,14 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
5760
7202
|
} : {}
|
|
5761
7203
|
};
|
|
5762
7204
|
publishData.common.business_binds = JSON.stringify(business_binds);
|
|
5763
|
-
const publishDataStr = mock_xsEncrypt.dumps(publishData);
|
|
5764
7205
|
const publishXt = Date.now().toString();
|
|
5765
|
-
const publishXs =
|
|
7206
|
+
const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/v2/note", a1Cookie, "xhs-pc-web", publishData);
|
|
5766
7207
|
const xscommon = GenXSCommon(a1Cookie, publishXt, publishXs);
|
|
5767
|
-
const
|
|
7208
|
+
const proxyHttp = new Http({
|
|
7209
|
+
headers
|
|
7210
|
+
}, params.proxyLoc);
|
|
7211
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
7212
|
+
const publishResult = await proxyHttp.api({
|
|
5768
7213
|
method: "post",
|
|
5769
7214
|
url: "https://edith.xiaohongshu.com/web_api/sns/v2/note",
|
|
5770
7215
|
data: publishData,
|
|
@@ -5778,7 +7223,7 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
5778
7223
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data?.id);
|
|
5779
7224
|
};
|
|
5780
7225
|
const rpa_GenXSCommon = __webpack_require__("./src/utils/XhsXsCommonEnc.js");
|
|
5781
|
-
const rpa_xsEncrypt = new
|
|
7226
|
+
const rpa_xsEncrypt = new Xhshow();
|
|
5782
7227
|
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
5783
7228
|
const commonCookies = {
|
|
5784
7229
|
path: "/",
|
|
@@ -5809,7 +7254,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
5809
7254
|
const url = request.url();
|
|
5810
7255
|
if (interceptUrls.some((pattern)=>url.includes(pattern))) {
|
|
5811
7256
|
const urlObj = new URL(url);
|
|
5812
|
-
|
|
7257
|
+
urlObj.pathname, urlObj.search;
|
|
7258
|
+
const fetchCoverParams = Object.fromEntries(new URLSearchParams(urlObj.search));
|
|
5813
7259
|
const xt = Date.now().toString();
|
|
5814
7260
|
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
5815
7261
|
if (!a1Cookie) {
|
|
@@ -5827,9 +7273,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
5827
7273
|
const isNoteRequest = urlObj.pathname.includes(interceptUrls[5]);
|
|
5828
7274
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
5829
7275
|
const publishData = JSON.parse(request.postData() || "");
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
7276
|
+
return rpa_xsEncrypt.signXsPost(interceptUrls[5], a1Cookie, "xhs-pc-web", publishData);
|
|
7277
|
+
})() : rpa_xsEncrypt.signXsGet(urlObj.pathname, a1Cookie, "xhs-pc-web", fetchCoverParams));
|
|
5833
7278
|
const xscommon = rpa_GenXSCommon(a1Cookie, xt, xs);
|
|
5834
7279
|
const newHeaders = {
|
|
5835
7280
|
...request.headers(),
|
|
@@ -5997,7 +7442,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
5997
7442
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
5998
7443
|
};
|
|
5999
7444
|
var package_namespaceObject = {
|
|
6000
|
-
i8: "1.2.
|
|
7445
|
+
i8: "1.2.23"
|
|
6001
7446
|
};
|
|
6002
7447
|
const BetaFlag = "HuiwenCanary";
|
|
6003
7448
|
class Action {
|
|
@@ -6006,7 +7451,7 @@ class Action {
|
|
|
6006
7451
|
}
|
|
6007
7452
|
async bindTask(func, params) {
|
|
6008
7453
|
let responseData;
|
|
6009
|
-
this.task.isBeta = this.task
|
|
7454
|
+
this.task.isBeta = this.task.isFeatOn(BetaFlag);
|
|
6010
7455
|
this.task._timerRecord = {
|
|
6011
7456
|
ActionStart: Date.now()
|
|
6012
7457
|
};
|
|
@@ -6027,6 +7472,11 @@ class Action {
|
|
|
6027
7472
|
this.task.logger.error(responseData.message || `${func.name} 执行失败`, stringifyError(responseData.data), responseData.extra);
|
|
6028
7473
|
this.task.logger.info(`${func.name} action failed`);
|
|
6029
7474
|
} else this.task.logger.info(`${func.name} action success`);
|
|
7475
|
+
if (this.task.debug && this.task._timerRecord['PrePublish']) {
|
|
7476
|
+
console.log("预处理图片耗时:", (this.task._timerRecord['PrePublish'] - this.task._timerRecord['ActionStart']) / 1000, "s");
|
|
7477
|
+
console.log("发文接口耗时:", (this.task._timerRecord['ActionEnd'] - this.task._timerRecord['PrePublish']) / 1000, "s");
|
|
7478
|
+
}
|
|
7479
|
+
this.task.debug && console.log("Action整体耗时:", (this.task._timerRecord['ActionEnd'] - this.task._timerRecord['ActionStart']) / 1000, "s");
|
|
6030
7480
|
return responseData;
|
|
6031
7481
|
}
|
|
6032
7482
|
FetchArticles(params) {
|