@iflyrpa/actions 1.2.23 → 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 +1475 -123
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1573 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1567 -98
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +1 -0
- 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.js
CHANGED
|
@@ -1,4 +1,1059 @@
|
|
|
1
1
|
var __webpack_modules__ = {
|
|
2
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
3
|
+
"use strict";
|
|
4
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
5
|
+
if (void 0 === k2) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function() {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
} : function(o, m, k, k2) {
|
|
15
|
+
if (void 0 === k2) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
});
|
|
18
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
value: v
|
|
22
|
+
});
|
|
23
|
+
} : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = this && this.__importStar || function(mod) {
|
|
27
|
+
if (mod && mod.__esModule) return mod;
|
|
28
|
+
var result = {};
|
|
29
|
+
if (null != mod) {
|
|
30
|
+
for(var k in mod)if ("default" !== k && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
+
}
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
36
|
+
value: true
|
|
37
|
+
});
|
|
38
|
+
exports1.req = exports1.json = exports1.toBuffer = void 0;
|
|
39
|
+
const http = __importStar(__webpack_require__("http"));
|
|
40
|
+
const https = __importStar(__webpack_require__("https"));
|
|
41
|
+
async function toBuffer(stream) {
|
|
42
|
+
let length = 0;
|
|
43
|
+
const chunks = [];
|
|
44
|
+
for await (const chunk of stream){
|
|
45
|
+
length += chunk.length;
|
|
46
|
+
chunks.push(chunk);
|
|
47
|
+
}
|
|
48
|
+
return Buffer.concat(chunks, length);
|
|
49
|
+
}
|
|
50
|
+
exports1.toBuffer = toBuffer;
|
|
51
|
+
async function json(stream) {
|
|
52
|
+
const buf = await toBuffer(stream);
|
|
53
|
+
const str = buf.toString('utf8');
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(str);
|
|
56
|
+
} catch (_err) {
|
|
57
|
+
const err = _err;
|
|
58
|
+
err.message += ` (input: ${str})`;
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports1.json = json;
|
|
63
|
+
function req(url, opts = {}) {
|
|
64
|
+
const href = 'string' == typeof url ? url : url.href;
|
|
65
|
+
const req1 = (href.startsWith('https:') ? https : http).request(url, opts);
|
|
66
|
+
const promise = new Promise((resolve, reject)=>{
|
|
67
|
+
req1.once('response', resolve).once('error', reject).end();
|
|
68
|
+
});
|
|
69
|
+
req1.then = promise.then.bind(promise);
|
|
70
|
+
return req1;
|
|
71
|
+
}
|
|
72
|
+
exports1.req = req;
|
|
73
|
+
},
|
|
74
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
75
|
+
"use strict";
|
|
76
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
77
|
+
if (void 0 === k2) k2 = k;
|
|
78
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
79
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function() {
|
|
82
|
+
return m[k];
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
Object.defineProperty(o, k2, desc);
|
|
86
|
+
} : function(o, m, k, k2) {
|
|
87
|
+
if (void 0 === k2) k2 = k;
|
|
88
|
+
o[k2] = m[k];
|
|
89
|
+
});
|
|
90
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
91
|
+
Object.defineProperty(o, "default", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
value: v
|
|
94
|
+
});
|
|
95
|
+
} : function(o, v) {
|
|
96
|
+
o["default"] = v;
|
|
97
|
+
});
|
|
98
|
+
var __importStar = this && this.__importStar || function(mod) {
|
|
99
|
+
if (mod && mod.__esModule) return mod;
|
|
100
|
+
var result = {};
|
|
101
|
+
if (null != mod) {
|
|
102
|
+
for(var k in mod)if ("default" !== k && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
103
|
+
}
|
|
104
|
+
__setModuleDefault(result, mod);
|
|
105
|
+
return result;
|
|
106
|
+
};
|
|
107
|
+
var __exportStar = this && this.__exportStar || function(m, exports1) {
|
|
108
|
+
for(var p in m)if ("default" !== p && !Object.prototype.hasOwnProperty.call(exports1, p)) __createBinding(exports1, m, p);
|
|
109
|
+
};
|
|
110
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
111
|
+
value: true
|
|
112
|
+
});
|
|
113
|
+
exports1.Agent = void 0;
|
|
114
|
+
const net = __importStar(__webpack_require__("net"));
|
|
115
|
+
const http = __importStar(__webpack_require__("http"));
|
|
116
|
+
const https_1 = __webpack_require__("https");
|
|
117
|
+
__exportStar(__webpack_require__("../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"), exports1);
|
|
118
|
+
const INTERNAL = Symbol('AgentBaseInternalState');
|
|
119
|
+
class Agent extends http.Agent {
|
|
120
|
+
constructor(opts){
|
|
121
|
+
super(opts);
|
|
122
|
+
this[INTERNAL] = {};
|
|
123
|
+
}
|
|
124
|
+
isSecureEndpoint(options) {
|
|
125
|
+
if (options) {
|
|
126
|
+
if ('boolean' == typeof options.secureEndpoint) return options.secureEndpoint;
|
|
127
|
+
if ('string' == typeof options.protocol) return 'https:' === options.protocol;
|
|
128
|
+
}
|
|
129
|
+
const { stack } = new Error();
|
|
130
|
+
if ('string' != typeof stack) return false;
|
|
131
|
+
return stack.split('\n').some((l)=>-1 !== l.indexOf('(https.js:') || -1 !== l.indexOf('node:https:'));
|
|
132
|
+
}
|
|
133
|
+
incrementSockets(name) {
|
|
134
|
+
if (this.maxSockets === 1 / 0 && this.maxTotalSockets === 1 / 0) return null;
|
|
135
|
+
if (!this.sockets[name]) this.sockets[name] = [];
|
|
136
|
+
const fakeSocket = new net.Socket({
|
|
137
|
+
writable: false
|
|
138
|
+
});
|
|
139
|
+
this.sockets[name].push(fakeSocket);
|
|
140
|
+
this.totalSocketCount++;
|
|
141
|
+
return fakeSocket;
|
|
142
|
+
}
|
|
143
|
+
decrementSockets(name, socket) {
|
|
144
|
+
if (!this.sockets[name] || null === socket) return;
|
|
145
|
+
const sockets = this.sockets[name];
|
|
146
|
+
const index = sockets.indexOf(socket);
|
|
147
|
+
if (-1 !== index) {
|
|
148
|
+
sockets.splice(index, 1);
|
|
149
|
+
this.totalSocketCount--;
|
|
150
|
+
if (0 === sockets.length) delete this.sockets[name];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
getName(options) {
|
|
154
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
155
|
+
if (secureEndpoint) return https_1.Agent.prototype.getName.call(this, options);
|
|
156
|
+
return super.getName(options);
|
|
157
|
+
}
|
|
158
|
+
createSocket(req, options, cb) {
|
|
159
|
+
const connectOpts = {
|
|
160
|
+
...options,
|
|
161
|
+
secureEndpoint: this.isSecureEndpoint(options)
|
|
162
|
+
};
|
|
163
|
+
const name = this.getName(connectOpts);
|
|
164
|
+
const fakeSocket = this.incrementSockets(name);
|
|
165
|
+
Promise.resolve().then(()=>this.connect(req, connectOpts)).then((socket)=>{
|
|
166
|
+
this.decrementSockets(name, fakeSocket);
|
|
167
|
+
if (socket instanceof http.Agent) try {
|
|
168
|
+
return socket.addRequest(req, connectOpts);
|
|
169
|
+
} catch (err) {
|
|
170
|
+
return cb(err);
|
|
171
|
+
}
|
|
172
|
+
this[INTERNAL].currentSocket = socket;
|
|
173
|
+
super.createSocket(req, options, cb);
|
|
174
|
+
}, (err)=>{
|
|
175
|
+
this.decrementSockets(name, fakeSocket);
|
|
176
|
+
cb(err);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
createConnection() {
|
|
180
|
+
const socket = this[INTERNAL].currentSocket;
|
|
181
|
+
this[INTERNAL].currentSocket = void 0;
|
|
182
|
+
if (!socket) throw new Error('No socket was returned in the `connect()` function');
|
|
183
|
+
return socket;
|
|
184
|
+
}
|
|
185
|
+
get defaultPort() {
|
|
186
|
+
return this[INTERNAL].defaultPort ?? ('https:' === this.protocol ? 443 : 80);
|
|
187
|
+
}
|
|
188
|
+
set defaultPort(v) {
|
|
189
|
+
if (this[INTERNAL]) this[INTERNAL].defaultPort = v;
|
|
190
|
+
}
|
|
191
|
+
get protocol() {
|
|
192
|
+
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? 'https:' : 'http:');
|
|
193
|
+
}
|
|
194
|
+
set protocol(v) {
|
|
195
|
+
if (this[INTERNAL]) this[INTERNAL].protocol = v;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports1.Agent = Agent;
|
|
199
|
+
},
|
|
200
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js": function(module, exports1, __webpack_require__) {
|
|
201
|
+
exports1.formatArgs = formatArgs;
|
|
202
|
+
exports1.save = save;
|
|
203
|
+
exports1.load = load;
|
|
204
|
+
exports1.useColors = useColors;
|
|
205
|
+
exports1.storage = localstorage();
|
|
206
|
+
exports1.destroy = (()=>{
|
|
207
|
+
let warned = false;
|
|
208
|
+
return ()=>{
|
|
209
|
+
if (!warned) {
|
|
210
|
+
warned = true;
|
|
211
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
})();
|
|
215
|
+
exports1.colors = [
|
|
216
|
+
'#0000CC',
|
|
217
|
+
'#0000FF',
|
|
218
|
+
'#0033CC',
|
|
219
|
+
'#0033FF',
|
|
220
|
+
'#0066CC',
|
|
221
|
+
'#0066FF',
|
|
222
|
+
'#0099CC',
|
|
223
|
+
'#0099FF',
|
|
224
|
+
'#00CC00',
|
|
225
|
+
'#00CC33',
|
|
226
|
+
'#00CC66',
|
|
227
|
+
'#00CC99',
|
|
228
|
+
'#00CCCC',
|
|
229
|
+
'#00CCFF',
|
|
230
|
+
'#3300CC',
|
|
231
|
+
'#3300FF',
|
|
232
|
+
'#3333CC',
|
|
233
|
+
'#3333FF',
|
|
234
|
+
'#3366CC',
|
|
235
|
+
'#3366FF',
|
|
236
|
+
'#3399CC',
|
|
237
|
+
'#3399FF',
|
|
238
|
+
'#33CC00',
|
|
239
|
+
'#33CC33',
|
|
240
|
+
'#33CC66',
|
|
241
|
+
'#33CC99',
|
|
242
|
+
'#33CCCC',
|
|
243
|
+
'#33CCFF',
|
|
244
|
+
'#6600CC',
|
|
245
|
+
'#6600FF',
|
|
246
|
+
'#6633CC',
|
|
247
|
+
'#6633FF',
|
|
248
|
+
'#66CC00',
|
|
249
|
+
'#66CC33',
|
|
250
|
+
'#9900CC',
|
|
251
|
+
'#9900FF',
|
|
252
|
+
'#9933CC',
|
|
253
|
+
'#9933FF',
|
|
254
|
+
'#99CC00',
|
|
255
|
+
'#99CC33',
|
|
256
|
+
'#CC0000',
|
|
257
|
+
'#CC0033',
|
|
258
|
+
'#CC0066',
|
|
259
|
+
'#CC0099',
|
|
260
|
+
'#CC00CC',
|
|
261
|
+
'#CC00FF',
|
|
262
|
+
'#CC3300',
|
|
263
|
+
'#CC3333',
|
|
264
|
+
'#CC3366',
|
|
265
|
+
'#CC3399',
|
|
266
|
+
'#CC33CC',
|
|
267
|
+
'#CC33FF',
|
|
268
|
+
'#CC6600',
|
|
269
|
+
'#CC6633',
|
|
270
|
+
'#CC9900',
|
|
271
|
+
'#CC9933',
|
|
272
|
+
'#CCCC00',
|
|
273
|
+
'#CCCC33',
|
|
274
|
+
'#FF0000',
|
|
275
|
+
'#FF0033',
|
|
276
|
+
'#FF0066',
|
|
277
|
+
'#FF0099',
|
|
278
|
+
'#FF00CC',
|
|
279
|
+
'#FF00FF',
|
|
280
|
+
'#FF3300',
|
|
281
|
+
'#FF3333',
|
|
282
|
+
'#FF3366',
|
|
283
|
+
'#FF3399',
|
|
284
|
+
'#FF33CC',
|
|
285
|
+
'#FF33FF',
|
|
286
|
+
'#FF6600',
|
|
287
|
+
'#FF6633',
|
|
288
|
+
'#FF9900',
|
|
289
|
+
'#FF9933',
|
|
290
|
+
'#FFCC00',
|
|
291
|
+
'#FFCC33'
|
|
292
|
+
];
|
|
293
|
+
function useColors() {
|
|
294
|
+
if ('undefined' != typeof window && window.process && ('renderer' === window.process.type || window.process.__nwjs)) return true;
|
|
295
|
+
if ('undefined' != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
296
|
+
let m;
|
|
297
|
+
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+)/);
|
|
298
|
+
}
|
|
299
|
+
function formatArgs(args) {
|
|
300
|
+
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
301
|
+
if (!this.useColors) return;
|
|
302
|
+
const c = 'color: ' + this.color;
|
|
303
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
304
|
+
let index = 0;
|
|
305
|
+
let lastC = 0;
|
|
306
|
+
args[0].replace(/%[a-zA-Z%]/g, (match)=>{
|
|
307
|
+
if ('%%' === match) return;
|
|
308
|
+
index++;
|
|
309
|
+
if ('%c' === match) lastC = index;
|
|
310
|
+
});
|
|
311
|
+
args.splice(lastC, 0, c);
|
|
312
|
+
}
|
|
313
|
+
exports1.log = console.debug || console.log || (()=>{});
|
|
314
|
+
function save(namespaces) {
|
|
315
|
+
try {
|
|
316
|
+
if (namespaces) exports1.storage.setItem('debug', namespaces);
|
|
317
|
+
else exports1.storage.removeItem('debug');
|
|
318
|
+
} catch (error) {}
|
|
319
|
+
}
|
|
320
|
+
function load() {
|
|
321
|
+
let r;
|
|
322
|
+
try {
|
|
323
|
+
r = exports1.storage.getItem('debug');
|
|
324
|
+
} catch (error) {}
|
|
325
|
+
if (!r && 'undefined' != typeof process && 'env' in process) r = process.env.DEBUG;
|
|
326
|
+
return r;
|
|
327
|
+
}
|
|
328
|
+
function localstorage() {
|
|
329
|
+
try {
|
|
330
|
+
return localStorage;
|
|
331
|
+
} catch (error) {}
|
|
332
|
+
}
|
|
333
|
+
module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js")(exports1);
|
|
334
|
+
const { formatters } = module.exports;
|
|
335
|
+
formatters.j = function(v) {
|
|
336
|
+
try {
|
|
337
|
+
return JSON.stringify(v);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
344
|
+
function setup(env) {
|
|
345
|
+
createDebug.debug = createDebug;
|
|
346
|
+
createDebug.default = createDebug;
|
|
347
|
+
createDebug.coerce = coerce;
|
|
348
|
+
createDebug.disable = disable;
|
|
349
|
+
createDebug.enable = enable;
|
|
350
|
+
createDebug.enabled = enabled;
|
|
351
|
+
createDebug.humanize = __webpack_require__("../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js");
|
|
352
|
+
createDebug.destroy = destroy;
|
|
353
|
+
Object.keys(env).forEach((key)=>{
|
|
354
|
+
createDebug[key] = env[key];
|
|
355
|
+
});
|
|
356
|
+
createDebug.names = [];
|
|
357
|
+
createDebug.skips = [];
|
|
358
|
+
createDebug.formatters = {};
|
|
359
|
+
function selectColor(namespace) {
|
|
360
|
+
let hash = 0;
|
|
361
|
+
for(let i = 0; i < namespace.length; i++){
|
|
362
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
363
|
+
hash |= 0;
|
|
364
|
+
}
|
|
365
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
366
|
+
}
|
|
367
|
+
createDebug.selectColor = selectColor;
|
|
368
|
+
function createDebug(namespace) {
|
|
369
|
+
let prevTime;
|
|
370
|
+
let enableOverride = null;
|
|
371
|
+
let namespacesCache;
|
|
372
|
+
let enabledCache;
|
|
373
|
+
function debug(...args) {
|
|
374
|
+
if (!debug.enabled) return;
|
|
375
|
+
const self = debug;
|
|
376
|
+
const curr = Number(new Date());
|
|
377
|
+
const ms = curr - (prevTime || curr);
|
|
378
|
+
self.diff = ms;
|
|
379
|
+
self.prev = prevTime;
|
|
380
|
+
self.curr = curr;
|
|
381
|
+
prevTime = curr;
|
|
382
|
+
args[0] = createDebug.coerce(args[0]);
|
|
383
|
+
if ('string' != typeof args[0]) args.unshift('%O');
|
|
384
|
+
let index = 0;
|
|
385
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format)=>{
|
|
386
|
+
if ('%%' === match) return '%';
|
|
387
|
+
index++;
|
|
388
|
+
const formatter = createDebug.formatters[format];
|
|
389
|
+
if ('function' == typeof formatter) {
|
|
390
|
+
const val = args[index];
|
|
391
|
+
match = formatter.call(self, val);
|
|
392
|
+
args.splice(index, 1);
|
|
393
|
+
index--;
|
|
394
|
+
}
|
|
395
|
+
return match;
|
|
396
|
+
});
|
|
397
|
+
createDebug.formatArgs.call(self, args);
|
|
398
|
+
const logFn = self.log || createDebug.log;
|
|
399
|
+
logFn.apply(self, args);
|
|
400
|
+
}
|
|
401
|
+
debug.namespace = namespace;
|
|
402
|
+
debug.useColors = createDebug.useColors();
|
|
403
|
+
debug.color = createDebug.selectColor(namespace);
|
|
404
|
+
debug.extend = extend;
|
|
405
|
+
debug.destroy = createDebug.destroy;
|
|
406
|
+
Object.defineProperty(debug, 'enabled', {
|
|
407
|
+
enumerable: true,
|
|
408
|
+
configurable: false,
|
|
409
|
+
get: ()=>{
|
|
410
|
+
if (null !== enableOverride) return enableOverride;
|
|
411
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
412
|
+
namespacesCache = createDebug.namespaces;
|
|
413
|
+
enabledCache = createDebug.enabled(namespace);
|
|
414
|
+
}
|
|
415
|
+
return enabledCache;
|
|
416
|
+
},
|
|
417
|
+
set: (v)=>{
|
|
418
|
+
enableOverride = v;
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
if ('function' == typeof createDebug.init) createDebug.init(debug);
|
|
422
|
+
return debug;
|
|
423
|
+
}
|
|
424
|
+
function extend(namespace, delimiter) {
|
|
425
|
+
const newDebug = createDebug(this.namespace + (void 0 === delimiter ? ':' : delimiter) + namespace);
|
|
426
|
+
newDebug.log = this.log;
|
|
427
|
+
return newDebug;
|
|
428
|
+
}
|
|
429
|
+
function enable(namespaces) {
|
|
430
|
+
createDebug.save(namespaces);
|
|
431
|
+
createDebug.namespaces = namespaces;
|
|
432
|
+
createDebug.names = [];
|
|
433
|
+
createDebug.skips = [];
|
|
434
|
+
const split = ('string' == typeof namespaces ? namespaces : '').trim().replace(' ', ',').split(',').filter(Boolean);
|
|
435
|
+
for (const ns of split)if ('-' === ns[0]) createDebug.skips.push(ns.slice(1));
|
|
436
|
+
else createDebug.names.push(ns);
|
|
437
|
+
}
|
|
438
|
+
function matchesTemplate(search, template) {
|
|
439
|
+
let searchIndex = 0;
|
|
440
|
+
let templateIndex = 0;
|
|
441
|
+
let starIndex = -1;
|
|
442
|
+
let matchIndex = 0;
|
|
443
|
+
while(searchIndex < search.length)if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || '*' === template[templateIndex])) {
|
|
444
|
+
if ('*' === template[templateIndex]) {
|
|
445
|
+
starIndex = templateIndex;
|
|
446
|
+
matchIndex = searchIndex;
|
|
447
|
+
templateIndex++;
|
|
448
|
+
} else {
|
|
449
|
+
searchIndex++;
|
|
450
|
+
templateIndex++;
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
if (-1 === starIndex) return false;
|
|
454
|
+
templateIndex = starIndex + 1;
|
|
455
|
+
matchIndex++;
|
|
456
|
+
searchIndex = matchIndex;
|
|
457
|
+
}
|
|
458
|
+
while(templateIndex < template.length && '*' === template[templateIndex])templateIndex++;
|
|
459
|
+
return templateIndex === template.length;
|
|
460
|
+
}
|
|
461
|
+
function disable() {
|
|
462
|
+
const namespaces = [
|
|
463
|
+
...createDebug.names,
|
|
464
|
+
...createDebug.skips.map((namespace)=>'-' + namespace)
|
|
465
|
+
].join(',');
|
|
466
|
+
createDebug.enable('');
|
|
467
|
+
return namespaces;
|
|
468
|
+
}
|
|
469
|
+
function enabled(name) {
|
|
470
|
+
for (const skip of createDebug.skips)if (matchesTemplate(name, skip)) return false;
|
|
471
|
+
for (const ns of createDebug.names)if (matchesTemplate(name, ns)) return true;
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
function coerce(val) {
|
|
475
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
476
|
+
return val;
|
|
477
|
+
}
|
|
478
|
+
function destroy() {
|
|
479
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
480
|
+
}
|
|
481
|
+
createDebug.enable(createDebug.load());
|
|
482
|
+
return createDebug;
|
|
483
|
+
}
|
|
484
|
+
module.exports = setup;
|
|
485
|
+
},
|
|
486
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
487
|
+
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");
|
|
488
|
+
else module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js");
|
|
489
|
+
},
|
|
490
|
+
"../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js": function(module, exports1, __webpack_require__) {
|
|
491
|
+
const tty = __webpack_require__("tty");
|
|
492
|
+
const util = __webpack_require__("util");
|
|
493
|
+
exports1.init = init;
|
|
494
|
+
exports1.log = log;
|
|
495
|
+
exports1.formatArgs = formatArgs;
|
|
496
|
+
exports1.save = save;
|
|
497
|
+
exports1.load = load;
|
|
498
|
+
exports1.useColors = useColors;
|
|
499
|
+
exports1.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`.');
|
|
500
|
+
exports1.colors = [
|
|
501
|
+
6,
|
|
502
|
+
2,
|
|
503
|
+
3,
|
|
504
|
+
4,
|
|
505
|
+
5,
|
|
506
|
+
1
|
|
507
|
+
];
|
|
508
|
+
try {
|
|
509
|
+
const supportsColor = __webpack_require__("../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js");
|
|
510
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports1.colors = [
|
|
511
|
+
20,
|
|
512
|
+
21,
|
|
513
|
+
26,
|
|
514
|
+
27,
|
|
515
|
+
32,
|
|
516
|
+
33,
|
|
517
|
+
38,
|
|
518
|
+
39,
|
|
519
|
+
40,
|
|
520
|
+
41,
|
|
521
|
+
42,
|
|
522
|
+
43,
|
|
523
|
+
44,
|
|
524
|
+
45,
|
|
525
|
+
56,
|
|
526
|
+
57,
|
|
527
|
+
62,
|
|
528
|
+
63,
|
|
529
|
+
68,
|
|
530
|
+
69,
|
|
531
|
+
74,
|
|
532
|
+
75,
|
|
533
|
+
76,
|
|
534
|
+
77,
|
|
535
|
+
78,
|
|
536
|
+
79,
|
|
537
|
+
80,
|
|
538
|
+
81,
|
|
539
|
+
92,
|
|
540
|
+
93,
|
|
541
|
+
98,
|
|
542
|
+
99,
|
|
543
|
+
112,
|
|
544
|
+
113,
|
|
545
|
+
128,
|
|
546
|
+
129,
|
|
547
|
+
134,
|
|
548
|
+
135,
|
|
549
|
+
148,
|
|
550
|
+
149,
|
|
551
|
+
160,
|
|
552
|
+
161,
|
|
553
|
+
162,
|
|
554
|
+
163,
|
|
555
|
+
164,
|
|
556
|
+
165,
|
|
557
|
+
166,
|
|
558
|
+
167,
|
|
559
|
+
168,
|
|
560
|
+
169,
|
|
561
|
+
170,
|
|
562
|
+
171,
|
|
563
|
+
172,
|
|
564
|
+
173,
|
|
565
|
+
178,
|
|
566
|
+
179,
|
|
567
|
+
184,
|
|
568
|
+
185,
|
|
569
|
+
196,
|
|
570
|
+
197,
|
|
571
|
+
198,
|
|
572
|
+
199,
|
|
573
|
+
200,
|
|
574
|
+
201,
|
|
575
|
+
202,
|
|
576
|
+
203,
|
|
577
|
+
204,
|
|
578
|
+
205,
|
|
579
|
+
206,
|
|
580
|
+
207,
|
|
581
|
+
208,
|
|
582
|
+
209,
|
|
583
|
+
214,
|
|
584
|
+
215,
|
|
585
|
+
220,
|
|
586
|
+
221
|
|
587
|
+
];
|
|
588
|
+
} catch (error) {}
|
|
589
|
+
exports1.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{
|
|
590
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase());
|
|
591
|
+
let val = process.env[key];
|
|
592
|
+
val = /^(yes|on|true|enabled)$/i.test(val) ? true : /^(no|off|false|disabled)$/i.test(val) ? false : 'null' === val ? null : Number(val);
|
|
593
|
+
obj[prop] = val;
|
|
594
|
+
return obj;
|
|
595
|
+
}, {});
|
|
596
|
+
function useColors() {
|
|
597
|
+
return 'colors' in exports1.inspectOpts ? Boolean(exports1.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
598
|
+
}
|
|
599
|
+
function formatArgs(args) {
|
|
600
|
+
const { namespace: name, useColors } = this;
|
|
601
|
+
if (useColors) {
|
|
602
|
+
const c = this.color;
|
|
603
|
+
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
604
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
605
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
606
|
+
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
607
|
+
} else args[0] = getDate() + name + ' ' + args[0];
|
|
608
|
+
}
|
|
609
|
+
function getDate() {
|
|
610
|
+
if (exports1.inspectOpts.hideDate) return '';
|
|
611
|
+
return new Date().toISOString() + ' ';
|
|
612
|
+
}
|
|
613
|
+
function log(...args) {
|
|
614
|
+
return process.stderr.write(util.formatWithOptions(exports1.inspectOpts, ...args) + '\n');
|
|
615
|
+
}
|
|
616
|
+
function save(namespaces) {
|
|
617
|
+
if (namespaces) process.env.DEBUG = namespaces;
|
|
618
|
+
else delete process.env.DEBUG;
|
|
619
|
+
}
|
|
620
|
+
function load() {
|
|
621
|
+
return process.env.DEBUG;
|
|
622
|
+
}
|
|
623
|
+
function init(debug) {
|
|
624
|
+
debug.inspectOpts = {};
|
|
625
|
+
const keys = Object.keys(exports1.inspectOpts);
|
|
626
|
+
for(let i = 0; i < keys.length; i++)debug.inspectOpts[keys[i]] = exports1.inspectOpts[keys[i]];
|
|
627
|
+
}
|
|
628
|
+
module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js")(exports1);
|
|
629
|
+
const { formatters } = module.exports;
|
|
630
|
+
formatters.o = function(v) {
|
|
631
|
+
this.inspectOpts.colors = this.useColors;
|
|
632
|
+
return util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' ');
|
|
633
|
+
};
|
|
634
|
+
formatters.O = function(v) {
|
|
635
|
+
this.inspectOpts.colors = this.useColors;
|
|
636
|
+
return util.inspect(v, this.inspectOpts);
|
|
637
|
+
};
|
|
638
|
+
},
|
|
639
|
+
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js": function(module) {
|
|
640
|
+
"use strict";
|
|
641
|
+
module.exports = (flag, argv = process.argv)=>{
|
|
642
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
643
|
+
const position = argv.indexOf(prefix + flag);
|
|
644
|
+
const terminatorPosition = argv.indexOf('--');
|
|
645
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
646
|
+
};
|
|
647
|
+
},
|
|
648
|
+
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
649
|
+
"use strict";
|
|
650
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
651
|
+
if (void 0 === k2) k2 = k;
|
|
652
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
653
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
654
|
+
enumerable: true,
|
|
655
|
+
get: function() {
|
|
656
|
+
return m[k];
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
Object.defineProperty(o, k2, desc);
|
|
660
|
+
} : function(o, m, k, k2) {
|
|
661
|
+
if (void 0 === k2) k2 = k;
|
|
662
|
+
o[k2] = m[k];
|
|
663
|
+
});
|
|
664
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
665
|
+
Object.defineProperty(o, "default", {
|
|
666
|
+
enumerable: true,
|
|
667
|
+
value: v
|
|
668
|
+
});
|
|
669
|
+
} : function(o, v) {
|
|
670
|
+
o["default"] = v;
|
|
671
|
+
});
|
|
672
|
+
var __importStar = this && this.__importStar || function(mod) {
|
|
673
|
+
if (mod && mod.__esModule) return mod;
|
|
674
|
+
var result = {};
|
|
675
|
+
if (null != mod) {
|
|
676
|
+
for(var k in mod)if ("default" !== k && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
677
|
+
}
|
|
678
|
+
__setModuleDefault(result, mod);
|
|
679
|
+
return result;
|
|
680
|
+
};
|
|
681
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
682
|
+
return mod && mod.__esModule ? mod : {
|
|
683
|
+
default: mod
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
687
|
+
value: true
|
|
688
|
+
});
|
|
689
|
+
exports1.HttpsProxyAgent = void 0;
|
|
690
|
+
const net = __importStar(__webpack_require__("net"));
|
|
691
|
+
const tls = __importStar(__webpack_require__("tls"));
|
|
692
|
+
const assert_1 = __importDefault(__webpack_require__("assert"));
|
|
693
|
+
const debug_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"));
|
|
694
|
+
const agent_base_1 = __webpack_require__("../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js");
|
|
695
|
+
const url_1 = __webpack_require__("url");
|
|
696
|
+
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");
|
|
697
|
+
const debug = (0, debug_1.default)('https-proxy-agent');
|
|
698
|
+
const setServernameFromNonIpHost = (options)=>{
|
|
699
|
+
if (void 0 === options.servername && options.host && !net.isIP(options.host)) return {
|
|
700
|
+
...options,
|
|
701
|
+
servername: options.host
|
|
702
|
+
};
|
|
703
|
+
return options;
|
|
704
|
+
};
|
|
705
|
+
class HttpsProxyAgent extends agent_base_1.Agent {
|
|
706
|
+
constructor(proxy, opts){
|
|
707
|
+
super(opts);
|
|
708
|
+
this.options = {
|
|
709
|
+
path: void 0
|
|
710
|
+
};
|
|
711
|
+
this.proxy = 'string' == typeof proxy ? new url_1.URL(proxy) : proxy;
|
|
712
|
+
this.proxyHeaders = opts?.headers ?? {};
|
|
713
|
+
debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
|
|
714
|
+
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
|
|
715
|
+
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : 'https:' === this.proxy.protocol ? 443 : 80;
|
|
716
|
+
this.connectOpts = {
|
|
717
|
+
ALPNProtocols: [
|
|
718
|
+
'http/1.1'
|
|
719
|
+
],
|
|
720
|
+
...opts ? omit(opts, 'headers') : null,
|
|
721
|
+
host,
|
|
722
|
+
port
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
async connect(req, opts) {
|
|
726
|
+
const { proxy } = this;
|
|
727
|
+
if (!opts.host) throw new TypeError('No "host" provided');
|
|
728
|
+
let socket;
|
|
729
|
+
if ('https:' === proxy.protocol) {
|
|
730
|
+
debug('Creating `tls.Socket`: %o', this.connectOpts);
|
|
731
|
+
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
732
|
+
} else {
|
|
733
|
+
debug('Creating `net.Socket`: %o', this.connectOpts);
|
|
734
|
+
socket = net.connect(this.connectOpts);
|
|
735
|
+
}
|
|
736
|
+
const headers = 'function' == typeof this.proxyHeaders ? this.proxyHeaders() : {
|
|
737
|
+
...this.proxyHeaders
|
|
738
|
+
};
|
|
739
|
+
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
740
|
+
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
|
|
741
|
+
if (proxy.username || proxy.password) {
|
|
742
|
+
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
743
|
+
headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;
|
|
744
|
+
}
|
|
745
|
+
headers.Host = `${host}:${opts.port}`;
|
|
746
|
+
if (!headers['Proxy-Connection']) headers['Proxy-Connection'] = this.keepAlive ? 'Keep-Alive' : 'close';
|
|
747
|
+
for (const name of Object.keys(headers))payload += `${name}: ${headers[name]}\r\n`;
|
|
748
|
+
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
749
|
+
socket.write(`${payload}\r\n`);
|
|
750
|
+
const { connect, buffered } = await proxyResponsePromise;
|
|
751
|
+
req.emit('proxyConnect', connect);
|
|
752
|
+
this.emit('proxyConnect', connect, req);
|
|
753
|
+
if (200 === connect.statusCode) {
|
|
754
|
+
req.once('socket', resume);
|
|
755
|
+
if (opts.secureEndpoint) {
|
|
756
|
+
debug('Upgrading socket connection to TLS');
|
|
757
|
+
return tls.connect({
|
|
758
|
+
...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'),
|
|
759
|
+
socket
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
return socket;
|
|
763
|
+
}
|
|
764
|
+
socket.destroy();
|
|
765
|
+
const fakeSocket = new net.Socket({
|
|
766
|
+
writable: false
|
|
767
|
+
});
|
|
768
|
+
fakeSocket.readable = true;
|
|
769
|
+
req.once('socket', (s)=>{
|
|
770
|
+
debug('Replaying proxy buffer for failed request');
|
|
771
|
+
(0, assert_1.default)(s.listenerCount('data') > 0);
|
|
772
|
+
s.push(buffered);
|
|
773
|
+
s.push(null);
|
|
774
|
+
});
|
|
775
|
+
return fakeSocket;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
HttpsProxyAgent.protocols = [
|
|
779
|
+
'http',
|
|
780
|
+
'https'
|
|
781
|
+
];
|
|
782
|
+
exports1.HttpsProxyAgent = HttpsProxyAgent;
|
|
783
|
+
function resume(socket) {
|
|
784
|
+
socket.resume();
|
|
785
|
+
}
|
|
786
|
+
function omit(obj, ...keys) {
|
|
787
|
+
const ret = {};
|
|
788
|
+
let key;
|
|
789
|
+
for(key in obj)if (!keys.includes(key)) ret[key] = obj[key];
|
|
790
|
+
return ret;
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
794
|
+
"use strict";
|
|
795
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
796
|
+
return mod && mod.__esModule ? mod : {
|
|
797
|
+
default: mod
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
801
|
+
value: true
|
|
802
|
+
});
|
|
803
|
+
exports1.parseProxyResponse = void 0;
|
|
804
|
+
const debug_1 = __importDefault(__webpack_require__("../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"));
|
|
805
|
+
const debug = (0, debug_1.default)('https-proxy-agent:parse-proxy-response');
|
|
806
|
+
function parseProxyResponse(socket) {
|
|
807
|
+
return new Promise((resolve, reject)=>{
|
|
808
|
+
let buffersLength = 0;
|
|
809
|
+
const buffers = [];
|
|
810
|
+
function read() {
|
|
811
|
+
const b = socket.read();
|
|
812
|
+
if (b) ondata(b);
|
|
813
|
+
else socket.once('readable', read);
|
|
814
|
+
}
|
|
815
|
+
function cleanup() {
|
|
816
|
+
socket.removeListener('end', onend);
|
|
817
|
+
socket.removeListener('error', onerror);
|
|
818
|
+
socket.removeListener('readable', read);
|
|
819
|
+
}
|
|
820
|
+
function onend() {
|
|
821
|
+
cleanup();
|
|
822
|
+
debug('onend');
|
|
823
|
+
reject(new Error('Proxy connection ended before receiving CONNECT response'));
|
|
824
|
+
}
|
|
825
|
+
function onerror(err) {
|
|
826
|
+
cleanup();
|
|
827
|
+
debug('onerror %o', err);
|
|
828
|
+
reject(err);
|
|
829
|
+
}
|
|
830
|
+
function ondata(b) {
|
|
831
|
+
buffers.push(b);
|
|
832
|
+
buffersLength += b.length;
|
|
833
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
834
|
+
const endOfHeaders = buffered.indexOf('\r\n\r\n');
|
|
835
|
+
if (-1 === endOfHeaders) {
|
|
836
|
+
debug('have not received end of HTTP headers yet...');
|
|
837
|
+
read();
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
const headerParts = buffered.slice(0, endOfHeaders).toString('ascii').split('\r\n');
|
|
841
|
+
const firstLine = headerParts.shift();
|
|
842
|
+
if (!firstLine) {
|
|
843
|
+
socket.destroy();
|
|
844
|
+
return reject(new Error('No header received from proxy CONNECT response'));
|
|
845
|
+
}
|
|
846
|
+
const firstLineParts = firstLine.split(' ');
|
|
847
|
+
const statusCode = +firstLineParts[1];
|
|
848
|
+
const statusText = firstLineParts.slice(2).join(' ');
|
|
849
|
+
const headers = {};
|
|
850
|
+
for (const header of headerParts){
|
|
851
|
+
if (!header) continue;
|
|
852
|
+
const firstColon = header.indexOf(':');
|
|
853
|
+
if (-1 === firstColon) {
|
|
854
|
+
socket.destroy();
|
|
855
|
+
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
856
|
+
}
|
|
857
|
+
const key = header.slice(0, firstColon).toLowerCase();
|
|
858
|
+
const value = header.slice(firstColon + 1).trimStart();
|
|
859
|
+
const current = headers[key];
|
|
860
|
+
if ('string' == typeof current) headers[key] = [
|
|
861
|
+
current,
|
|
862
|
+
value
|
|
863
|
+
];
|
|
864
|
+
else if (Array.isArray(current)) current.push(value);
|
|
865
|
+
else headers[key] = value;
|
|
866
|
+
}
|
|
867
|
+
debug('got proxy server response: %o %o', firstLine, headers);
|
|
868
|
+
cleanup();
|
|
869
|
+
resolve({
|
|
870
|
+
connect: {
|
|
871
|
+
statusCode,
|
|
872
|
+
statusText,
|
|
873
|
+
headers
|
|
874
|
+
},
|
|
875
|
+
buffered
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
socket.on('error', onerror);
|
|
879
|
+
socket.on('end', onend);
|
|
880
|
+
read();
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
exports1.parseProxyResponse = parseProxyResponse;
|
|
884
|
+
},
|
|
885
|
+
"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js": function(module) {
|
|
886
|
+
var s = 1000;
|
|
887
|
+
var m = 60 * s;
|
|
888
|
+
var h = 60 * m;
|
|
889
|
+
var d = 24 * h;
|
|
890
|
+
var w = 7 * d;
|
|
891
|
+
var y = 365.25 * d;
|
|
892
|
+
module.exports = function(val, options) {
|
|
893
|
+
options = options || {};
|
|
894
|
+
var type = typeof val;
|
|
895
|
+
if ('string' === type && val.length > 0) return parse(val);
|
|
896
|
+
if ('number' === type && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
|
|
897
|
+
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
898
|
+
};
|
|
899
|
+
function parse(str) {
|
|
900
|
+
str = String(str);
|
|
901
|
+
if (str.length > 100) return;
|
|
902
|
+
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);
|
|
903
|
+
if (!match) return;
|
|
904
|
+
var n = parseFloat(match[1]);
|
|
905
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
906
|
+
switch(type){
|
|
907
|
+
case 'years':
|
|
908
|
+
case 'year':
|
|
909
|
+
case 'yrs':
|
|
910
|
+
case 'yr':
|
|
911
|
+
case 'y':
|
|
912
|
+
return n * y;
|
|
913
|
+
case 'weeks':
|
|
914
|
+
case 'week':
|
|
915
|
+
case 'w':
|
|
916
|
+
return n * w;
|
|
917
|
+
case 'days':
|
|
918
|
+
case 'day':
|
|
919
|
+
case 'd':
|
|
920
|
+
return n * d;
|
|
921
|
+
case 'hours':
|
|
922
|
+
case 'hour':
|
|
923
|
+
case 'hrs':
|
|
924
|
+
case 'hr':
|
|
925
|
+
case 'h':
|
|
926
|
+
return n * h;
|
|
927
|
+
case 'minutes':
|
|
928
|
+
case 'minute':
|
|
929
|
+
case 'mins':
|
|
930
|
+
case 'min':
|
|
931
|
+
case 'm':
|
|
932
|
+
return n * m;
|
|
933
|
+
case 'seconds':
|
|
934
|
+
case 'second':
|
|
935
|
+
case 'secs':
|
|
936
|
+
case 'sec':
|
|
937
|
+
case 's':
|
|
938
|
+
return n * s;
|
|
939
|
+
case 'milliseconds':
|
|
940
|
+
case 'millisecond':
|
|
941
|
+
case 'msecs':
|
|
942
|
+
case 'msec':
|
|
943
|
+
case 'ms':
|
|
944
|
+
return n;
|
|
945
|
+
default:
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
function fmtShort(ms) {
|
|
950
|
+
var msAbs = Math.abs(ms);
|
|
951
|
+
if (msAbs >= d) return Math.round(ms / d) + 'd';
|
|
952
|
+
if (msAbs >= h) return Math.round(ms / h) + 'h';
|
|
953
|
+
if (msAbs >= m) return Math.round(ms / m) + 'm';
|
|
954
|
+
if (msAbs >= s) return Math.round(ms / s) + 's';
|
|
955
|
+
return ms + 'ms';
|
|
956
|
+
}
|
|
957
|
+
function fmtLong(ms) {
|
|
958
|
+
var msAbs = Math.abs(ms);
|
|
959
|
+
if (msAbs >= d) return plural(ms, msAbs, d, 'day');
|
|
960
|
+
if (msAbs >= h) return plural(ms, msAbs, h, 'hour');
|
|
961
|
+
if (msAbs >= m) return plural(ms, msAbs, m, 'minute');
|
|
962
|
+
if (msAbs >= s) return plural(ms, msAbs, s, 'second');
|
|
963
|
+
return ms + ' ms';
|
|
964
|
+
}
|
|
965
|
+
function plural(ms, msAbs, n, name) {
|
|
966
|
+
var isPlural = msAbs >= 1.5 * n;
|
|
967
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
"../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
971
|
+
"use strict";
|
|
972
|
+
const os = __webpack_require__("os");
|
|
973
|
+
const tty = __webpack_require__("tty");
|
|
974
|
+
const hasFlag = __webpack_require__("../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js");
|
|
975
|
+
const { env } = process;
|
|
976
|
+
let flagForceColor;
|
|
977
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
978
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
979
|
+
function envForceColor() {
|
|
980
|
+
if ('FORCE_COLOR' in env) {
|
|
981
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
982
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
983
|
+
return 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
function translateLevel(level) {
|
|
987
|
+
if (0 === level) return false;
|
|
988
|
+
return {
|
|
989
|
+
level,
|
|
990
|
+
hasBasic: true,
|
|
991
|
+
has256: level >= 2,
|
|
992
|
+
has16m: level >= 3
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
996
|
+
const noFlagForceColor = envForceColor();
|
|
997
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
998
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
999
|
+
if (0 === forceColor) return 0;
|
|
1000
|
+
if (sniffFlags) {
|
|
1001
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
1002
|
+
if (hasFlag('color=256')) return 2;
|
|
1003
|
+
}
|
|
1004
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
1005
|
+
const min = forceColor || 0;
|
|
1006
|
+
if ('dumb' === env.TERM) return min;
|
|
1007
|
+
if ('win32' === process.platform) {
|
|
1008
|
+
const osRelease = os.release().split('.');
|
|
1009
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1010
|
+
return 1;
|
|
1011
|
+
}
|
|
1012
|
+
if ('CI' in env) {
|
|
1013
|
+
if ([
|
|
1014
|
+
'TRAVIS',
|
|
1015
|
+
'CIRCLECI',
|
|
1016
|
+
'APPVEYOR',
|
|
1017
|
+
'GITLAB_CI',
|
|
1018
|
+
'GITHUB_ACTIONS',
|
|
1019
|
+
'BUILDKITE',
|
|
1020
|
+
'DRONE'
|
|
1021
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
1022
|
+
return min;
|
|
1023
|
+
}
|
|
1024
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1025
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
1026
|
+
if ('TERM_PROGRAM' in env) {
|
|
1027
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
1028
|
+
switch(env.TERM_PROGRAM){
|
|
1029
|
+
case 'iTerm.app':
|
|
1030
|
+
return version >= 3 ? 3 : 2;
|
|
1031
|
+
case 'Apple_Terminal':
|
|
1032
|
+
return 2;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
1036
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
1037
|
+
if ('COLORTERM' in env) return 1;
|
|
1038
|
+
return min;
|
|
1039
|
+
}
|
|
1040
|
+
function getSupportLevel(stream, options = {}) {
|
|
1041
|
+
const level = supportsColor(stream, {
|
|
1042
|
+
streamIsTTY: stream && stream.isTTY,
|
|
1043
|
+
...options
|
|
1044
|
+
});
|
|
1045
|
+
return translateLevel(level);
|
|
1046
|
+
}
|
|
1047
|
+
module.exports = {
|
|
1048
|
+
supportsColor: getSupportLevel,
|
|
1049
|
+
stdout: getSupportLevel({
|
|
1050
|
+
isTTY: tty.isatty(1)
|
|
1051
|
+
}),
|
|
1052
|
+
stderr: getSupportLevel({
|
|
1053
|
+
isTTY: tty.isatty(2)
|
|
1054
|
+
})
|
|
1055
|
+
};
|
|
1056
|
+
},
|
|
2
1057
|
"./src/utils/XhsXsCommonEnc.js": function(module) {
|
|
3
1058
|
var encrypt_lookup = [
|
|
4
1059
|
"Z",
|
|
@@ -1746,6 +2801,42 @@ var __webpack_modules__ = {
|
|
|
1746
2801
|
return Data2A_B(Base2Data(EnvData2CharCode(_0x315138, _0x1c32b3, _0x56536b)));
|
|
1747
2802
|
}
|
|
1748
2803
|
module[a0_0x45db08(0xae)] = GenAB;
|
|
2804
|
+
},
|
|
2805
|
+
assert: function(module) {
|
|
2806
|
+
"use strict";
|
|
2807
|
+
module.exports = require("assert");
|
|
2808
|
+
},
|
|
2809
|
+
http: function(module) {
|
|
2810
|
+
"use strict";
|
|
2811
|
+
module.exports = require("http");
|
|
2812
|
+
},
|
|
2813
|
+
https: function(module) {
|
|
2814
|
+
"use strict";
|
|
2815
|
+
module.exports = require("https");
|
|
2816
|
+
},
|
|
2817
|
+
net: function(module) {
|
|
2818
|
+
"use strict";
|
|
2819
|
+
module.exports = require("net");
|
|
2820
|
+
},
|
|
2821
|
+
os: function(module) {
|
|
2822
|
+
"use strict";
|
|
2823
|
+
module.exports = require("os");
|
|
2824
|
+
},
|
|
2825
|
+
tls: function(module) {
|
|
2826
|
+
"use strict";
|
|
2827
|
+
module.exports = require("tls");
|
|
2828
|
+
},
|
|
2829
|
+
tty: function(module) {
|
|
2830
|
+
"use strict";
|
|
2831
|
+
module.exports = require("tty");
|
|
2832
|
+
},
|
|
2833
|
+
url: function(module) {
|
|
2834
|
+
"use strict";
|
|
2835
|
+
module.exports = require("url");
|
|
2836
|
+
},
|
|
2837
|
+
util: function(module) {
|
|
2838
|
+
"use strict";
|
|
2839
|
+
module.exports = require("util");
|
|
1749
2840
|
}
|
|
1750
2841
|
};
|
|
1751
2842
|
var __webpack_module_cache__ = {};
|
|
@@ -1757,7 +2848,7 @@ function __webpack_require__(moduleId) {
|
|
|
1757
2848
|
loaded: false,
|
|
1758
2849
|
exports: {}
|
|
1759
2850
|
};
|
|
1760
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
2851
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
1761
2852
|
module.loaded = true;
|
|
1762
2853
|
return module.exports;
|
|
1763
2854
|
}
|
|
@@ -1810,6 +2901,7 @@ var __webpack_exports__ = {};
|
|
|
1810
2901
|
__webpack_require__.r(__webpack_exports__);
|
|
1811
2902
|
__webpack_require__.d(__webpack_exports__, {
|
|
1812
2903
|
version: ()=>package_namespaceObject.i8,
|
|
2904
|
+
BetaFlag: ()=>BetaFlag,
|
|
1813
2905
|
Action: ()=>Action
|
|
1814
2906
|
});
|
|
1815
2907
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
@@ -1824,6 +2916,23 @@ var __webpack_exports__ = {};
|
|
|
1824
2916
|
var external_mime_types_default = /*#__PURE__*/ __webpack_require__.n(external_mime_types_namespaceObject);
|
|
1825
2917
|
const external_axios_namespaceObject = require("axios");
|
|
1826
2918
|
var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
|
|
2919
|
+
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
2920
|
+
const ProxyData = {
|
|
2921
|
+
api: "202101291430286754",
|
|
2922
|
+
md5akey: "6ec8d333e85044b7",
|
|
2923
|
+
akey: "91709114"
|
|
2924
|
+
};
|
|
2925
|
+
const ProxyAgent = async (adr)=>{
|
|
2926
|
+
const http = new Http({});
|
|
2927
|
+
let ProxyInfo = await http.api({
|
|
2928
|
+
method: "GET",
|
|
2929
|
+
url: "https://fetdev.iflysec.com/api/publish/zdy/ip",
|
|
2930
|
+
params: {
|
|
2931
|
+
addr: adr
|
|
2932
|
+
}
|
|
2933
|
+
});
|
|
2934
|
+
return 0 === ProxyInfo.code && ProxyInfo.data.length > 0 ? new dist.HttpsProxyAgent(`http://${ProxyData.api}:${ProxyData.akey}@${ProxyInfo.data[0].proxyAddress}`) : null;
|
|
2935
|
+
};
|
|
1827
2936
|
class Http {
|
|
1828
2937
|
static handleApiError(error) {
|
|
1829
2938
|
if (error && "object" == typeof error && "code" in error && "message" in error) return error;
|
|
@@ -1833,10 +2942,11 @@ var __webpack_exports__ = {};
|
|
|
1833
2942
|
data: error
|
|
1834
2943
|
};
|
|
1835
2944
|
}
|
|
1836
|
-
constructor(config){
|
|
2945
|
+
constructor(config, adr){
|
|
1837
2946
|
this.apiClient = external_axios_default().create({
|
|
1838
2947
|
...config
|
|
1839
2948
|
});
|
|
2949
|
+
this.adr = adr;
|
|
1840
2950
|
}
|
|
1841
2951
|
addResponseInterceptor(findError) {
|
|
1842
2952
|
this.apiClient.interceptors.response.use((response)=>{
|
|
@@ -1870,7 +2980,14 @@ var __webpack_exports__ = {};
|
|
|
1870
2980
|
}
|
|
1871
2981
|
async api(config) {
|
|
1872
2982
|
try {
|
|
1873
|
-
const
|
|
2983
|
+
const agent = this.adr ? await ProxyAgent(this.adr) : void 0;
|
|
2984
|
+
const response = await this.apiClient({
|
|
2985
|
+
...config,
|
|
2986
|
+
...agent ? {
|
|
2987
|
+
httpAgent: agent,
|
|
2988
|
+
httpsAgent: agent
|
|
2989
|
+
} : {}
|
|
2990
|
+
});
|
|
1874
2991
|
return response.data;
|
|
1875
2992
|
} catch (error) {
|
|
1876
2993
|
return Promise.reject(Http.handleApiError(error));
|
|
@@ -2095,16 +3212,18 @@ var __webpack_exports__ = {};
|
|
|
2095
3212
|
20040034: "封面图片推荐jpg、png格式,不支持gif格式。",
|
|
2096
3213
|
20040124: "服务器异常,请稍后重试!",
|
|
2097
3214
|
20040001: "当前用户未登录,请登陆后重试!",
|
|
2098
|
-
401100025: "该应用不支持此媒资类型"
|
|
3215
|
+
401100025: "该应用不支持此媒资类型",
|
|
3216
|
+
401100033: "图片宽高不满足要求"
|
|
2099
3217
|
};
|
|
2100
3218
|
const mockAction = async (task, params)=>{
|
|
2101
3219
|
const { baijiahaoSingleCover, baijiahaoMultCover, baijiahaoCoverType } = params.settingInfo;
|
|
2102
3220
|
const tmpCachePath = task.getTmpPath();
|
|
2103
|
-
const
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
3221
|
+
const headers = {
|
|
3222
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3223
|
+
token: params.token
|
|
3224
|
+
};
|
|
3225
|
+
let http = new Http({
|
|
3226
|
+
headers
|
|
2108
3227
|
});
|
|
2109
3228
|
http.addResponseInterceptor((response)=>{
|
|
2110
3229
|
const msgType = "draft" === params.saveType ? "同步" : "发布";
|
|
@@ -2220,7 +3339,11 @@ var __webpack_exports__ = {};
|
|
|
2220
3339
|
};
|
|
2221
3340
|
const isDraft = "draft" === params.saveType;
|
|
2222
3341
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
2223
|
-
|
|
3342
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
3343
|
+
const proxyHttp = new Http({
|
|
3344
|
+
headers
|
|
3345
|
+
}, params.proxyLoc);
|
|
3346
|
+
const res = await proxyHttp.api({
|
|
2224
3347
|
method: "post",
|
|
2225
3348
|
url: saveUrl,
|
|
2226
3349
|
data: publishData,
|
|
@@ -2357,6 +3480,7 @@ var __webpack_exports__ = {};
|
|
|
2357
3480
|
}
|
|
2358
3481
|
};
|
|
2359
3482
|
page.on("response", handleResponse);
|
|
3483
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
2360
3484
|
const operatorContainer = page.locator(".editor-component-operator");
|
|
2361
3485
|
if ("draft" === params.saveType) await operatorContainer.locator(".op-btn-outter-content").filter({
|
|
2362
3486
|
hasText: "存草稿"
|
|
@@ -2661,57 +3785,366 @@ var __webpack_exports__ = {};
|
|
|
2661
3785
|
const external_node_buffer_namespaceObject = require("node:buffer");
|
|
2662
3786
|
const external_node_crypto_namespaceObject = require("node:crypto");
|
|
2663
3787
|
var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
|
|
2664
|
-
class
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
}
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
3788
|
+
class CryptoConfig {
|
|
3789
|
+
static{
|
|
3790
|
+
this.MAX_32BIT = 0xFFFFFFFF;
|
|
3791
|
+
}
|
|
3792
|
+
static{
|
|
3793
|
+
this.MAX_SIGNED_32BIT = 0x7FFFFFFF;
|
|
3794
|
+
}
|
|
3795
|
+
static{
|
|
3796
|
+
this.BASE58_ALPHABET = "NOPQRStuvwxWXYZabcyz012DEFTKLMdefghijkl4563GHIJBC7mnop89+/AUVqrsOPQefghijkABCDEFGuvwz0123456789xy";
|
|
3797
|
+
}
|
|
3798
|
+
static{
|
|
3799
|
+
this.STANDARD_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3800
|
+
}
|
|
3801
|
+
static{
|
|
3802
|
+
this.CUSTOM_BASE64_ALPHABET = "ZmserbBoHQtNP+wOcza/LpngG8yJq42KWYj0DSfdikx3VT16IlUAFM97hECvuRX5";
|
|
3803
|
+
}
|
|
3804
|
+
static{
|
|
3805
|
+
this.BASE58_BASE = 58;
|
|
3806
|
+
}
|
|
3807
|
+
static{
|
|
3808
|
+
this.BYTE_SIZE = 256;
|
|
3809
|
+
}
|
|
3810
|
+
static{
|
|
3811
|
+
this.HEX_KEY = "af572b95ca65b2d9ec76bb5d2e97cb653299cc663399cc663399cce673399cce6733190c06030100000000008040209048241289c4e271381c0e0703018040a05028148ac56231180c0683c16030984c2693c964b259ac56abd5eaf5fafd7e3f9f4f279349a4d2e9743a9d4e279349a4d2e9f47a3d1e8f47239148a4d269341a8d4623110884422190c86432994ca6d3e974baddee773b1d8e47a35128148ac5623198cce6f3f97c3e1f8f47a3d168b45aad562b158ac5e2f1f87c3e9f4f279349a4d269b45aad56";
|
|
3812
|
+
}
|
|
3813
|
+
static{
|
|
3814
|
+
this.TIMESTAMP_BYTES_COUNT = 16;
|
|
3815
|
+
}
|
|
3816
|
+
static{
|
|
3817
|
+
this.TIMESTAMP_XOR_KEY = 41;
|
|
3818
|
+
}
|
|
3819
|
+
static{
|
|
3820
|
+
this.STARTUP_TIME_OFFSET_MIN = 1000;
|
|
3821
|
+
}
|
|
3822
|
+
static{
|
|
3823
|
+
this.STARTUP_TIME_OFFSET_MAX = 4000;
|
|
3824
|
+
}
|
|
3825
|
+
static{
|
|
3826
|
+
this.EXPECTED_HEX_LENGTH = 32;
|
|
3827
|
+
}
|
|
3828
|
+
static{
|
|
3829
|
+
this.OUTPUT_BYTE_COUNT = 8;
|
|
3830
|
+
}
|
|
3831
|
+
static{
|
|
3832
|
+
this.HEX_CHUNK_SIZE = 2;
|
|
3833
|
+
}
|
|
3834
|
+
static{
|
|
3835
|
+
this.VERSION_BYTES = [
|
|
3836
|
+
119,
|
|
3837
|
+
104,
|
|
3838
|
+
96,
|
|
3839
|
+
41
|
|
3840
|
+
];
|
|
3841
|
+
}
|
|
3842
|
+
static{
|
|
3843
|
+
this.FIXED_SEPARATOR_BYTES = [
|
|
3844
|
+
16,
|
|
3845
|
+
0,
|
|
3846
|
+
0,
|
|
3847
|
+
0,
|
|
3848
|
+
15,
|
|
3849
|
+
5,
|
|
3850
|
+
0,
|
|
3851
|
+
0,
|
|
3852
|
+
47,
|
|
3853
|
+
1,
|
|
3854
|
+
0,
|
|
3855
|
+
0
|
|
3856
|
+
];
|
|
3857
|
+
}
|
|
3858
|
+
static{
|
|
3859
|
+
this.RANDOM_BYTE_COUNT = 4;
|
|
3860
|
+
}
|
|
3861
|
+
static{
|
|
3862
|
+
this.FIXED_INT_VALUE_1 = 15;
|
|
3863
|
+
}
|
|
3864
|
+
static{
|
|
3865
|
+
this.FIXED_INT_VALUE_2 = 1291;
|
|
3866
|
+
}
|
|
3867
|
+
static{
|
|
3868
|
+
this.ENV_STATIC_BYTES = [
|
|
3869
|
+
1,
|
|
3870
|
+
249,
|
|
3871
|
+
83,
|
|
3872
|
+
102,
|
|
3873
|
+
103,
|
|
3874
|
+
201,
|
|
3875
|
+
181,
|
|
3876
|
+
131,
|
|
3877
|
+
99,
|
|
3878
|
+
94,
|
|
3879
|
+
7,
|
|
3880
|
+
68,
|
|
3881
|
+
250,
|
|
3882
|
+
132,
|
|
3883
|
+
21
|
|
3884
|
+
];
|
|
3885
|
+
}
|
|
3886
|
+
static{
|
|
3887
|
+
this.SIGNATURE_DATA_TEMPLATE = {
|
|
3888
|
+
x0: "4.2.2",
|
|
3889
|
+
x1: "xhs-pc-web",
|
|
3890
|
+
x2: "Windows",
|
|
3891
|
+
x3: "",
|
|
3892
|
+
x4: "object"
|
|
2686
3893
|
};
|
|
2687
|
-
const jsonString = JSON.stringify(obj, null, 0);
|
|
2688
|
-
return external_node_buffer_namespaceObject.Buffer.from(jsonString).toString("base64");
|
|
2689
3894
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
3895
|
+
static{
|
|
3896
|
+
this.X3_PREFIX = "mns0101_";
|
|
3897
|
+
}
|
|
3898
|
+
static{
|
|
3899
|
+
this.XYS_PREFIX = "XYS_";
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
class RandomGenerator {
|
|
3903
|
+
generateRandomBytes(byteCount) {
|
|
3904
|
+
return Array.from({
|
|
3905
|
+
length: byteCount
|
|
3906
|
+
}, ()=>Math.floor(Math.random() * CryptoConfig.BYTE_SIZE));
|
|
3907
|
+
}
|
|
3908
|
+
generateRandomByteInRange(minVal, maxVal) {
|
|
3909
|
+
return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
|
|
3910
|
+
}
|
|
3911
|
+
generateRandomInt() {
|
|
3912
|
+
return Math.floor(Math.random() * (CryptoConfig.MAX_32BIT + 1));
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
class HexProcessor {
|
|
3916
|
+
hexStringToBytes(hexString) {
|
|
3917
|
+
const byteValues = [];
|
|
3918
|
+
for(let i = 0; i < hexString.length; i += CryptoConfig.HEX_CHUNK_SIZE){
|
|
3919
|
+
const hexChunk = hexString.substr(i, CryptoConfig.HEX_CHUNK_SIZE);
|
|
3920
|
+
byteValues.push(parseInt(hexChunk, 16));
|
|
3921
|
+
}
|
|
3922
|
+
return byteValues;
|
|
3923
|
+
}
|
|
3924
|
+
processHexParameter(hexString, xorKey) {
|
|
3925
|
+
if (hexString.length !== CryptoConfig.EXPECTED_HEX_LENGTH) throw new Error(`hex parameter must be ${CryptoConfig.EXPECTED_HEX_LENGTH} characters`);
|
|
3926
|
+
const byteValues = this.hexStringToBytes(hexString);
|
|
3927
|
+
return byteValues.map((byteVal)=>byteVal ^ xorKey).slice(0, CryptoConfig.OUTPUT_BYTE_COUNT);
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
class BitOperations {
|
|
3931
|
+
normalizeTo32bit(value) {
|
|
3932
|
+
return value & CryptoConfig.MAX_32BIT;
|
|
3933
|
+
}
|
|
3934
|
+
toSigned32bit(unsignedValue) {
|
|
3935
|
+
if (unsignedValue > CryptoConfig.MAX_SIGNED_32BIT) return unsignedValue - 0x100000000;
|
|
3936
|
+
return unsignedValue;
|
|
2693
3937
|
}
|
|
2694
|
-
|
|
2695
|
-
const
|
|
2696
|
-
|
|
3938
|
+
computeSeedValue(seed32bit) {
|
|
3939
|
+
const normalizedSeed = this.normalizeTo32bit(seed32bit);
|
|
3940
|
+
const shift15Bits = normalizedSeed >> 15;
|
|
3941
|
+
const shift13Bits = normalizedSeed >> 13;
|
|
3942
|
+
const shift12Bits = normalizedSeed >> 12;
|
|
3943
|
+
const shift10Bits = normalizedSeed >> 10;
|
|
3944
|
+
const xorMaskedResult = shift15Bits & ~shift13Bits | shift13Bits & ~shift15Bits;
|
|
3945
|
+
const shiftedResult = (xorMaskedResult ^ shift12Bits ^ shift10Bits) << 31 & CryptoConfig.MAX_32BIT;
|
|
3946
|
+
return this.toSigned32bit(shiftedResult);
|
|
3947
|
+
}
|
|
3948
|
+
xorTransformArray(sourceIntegers) {
|
|
3949
|
+
const resultBytes = new Uint8Array(sourceIntegers.length);
|
|
3950
|
+
const hexKeyBytes = external_node_buffer_namespaceObject.Buffer.from(CryptoConfig.HEX_KEY, 'hex');
|
|
3951
|
+
for(let index = 0; index < sourceIntegers.length; index++)resultBytes[index] = (sourceIntegers[index] ^ hexKeyBytes[index]) & 0xFF;
|
|
3952
|
+
return resultBytes;
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
class Base58Encoder {
|
|
3956
|
+
encodeToB58(inputBytes) {
|
|
3957
|
+
const bytesArray = Array.isArray(inputBytes) ? inputBytes : Array.from(inputBytes);
|
|
3958
|
+
const numberAccumulator = this.bytesToNumber(bytesArray);
|
|
3959
|
+
const leadingZerosCount = this.countLeadingZeros(bytesArray);
|
|
3960
|
+
const encodedCharacters = this.numberToBase58Chars(numberAccumulator);
|
|
3961
|
+
encodedCharacters.push(...Array(leadingZerosCount).fill(CryptoConfig.BASE58_ALPHABET[0]));
|
|
3962
|
+
return encodedCharacters.reverse().join('');
|
|
3963
|
+
}
|
|
3964
|
+
bytesToNumber(inputBytes) {
|
|
3965
|
+
const bytesArray = Array.isArray(inputBytes) ? inputBytes : Array.from(inputBytes);
|
|
3966
|
+
let result = 0n;
|
|
3967
|
+
const BYTE_SIZE = 256n;
|
|
3968
|
+
for (const byteValue of bytesArray)result = result * BYTE_SIZE + BigInt(byteValue);
|
|
3969
|
+
return result;
|
|
2697
3970
|
}
|
|
3971
|
+
countLeadingZeros(inputBytes) {
|
|
3972
|
+
let count = 0;
|
|
3973
|
+
for (const byteValue of inputBytes)if (0 === byteValue) count++;
|
|
3974
|
+
else break;
|
|
3975
|
+
return count;
|
|
3976
|
+
}
|
|
3977
|
+
numberToBase58Chars(number) {
|
|
3978
|
+
const characters = [];
|
|
3979
|
+
const base = BigInt(CryptoConfig.BASE58_BASE);
|
|
3980
|
+
while(number > 0n){
|
|
3981
|
+
const remainder = number % base;
|
|
3982
|
+
characters.push(CryptoConfig.BASE58_ALPHABET[Number(remainder)]);
|
|
3983
|
+
number /= base;
|
|
3984
|
+
}
|
|
3985
|
+
return characters;
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
class Base64Encoder {
|
|
3989
|
+
encodeToB64(dataToEncode) {
|
|
3990
|
+
const dataBytes = external_node_buffer_namespaceObject.Buffer.from(dataToEncode, 'utf-8');
|
|
3991
|
+
const standardEncodedString = dataBytes.toString('base64');
|
|
3992
|
+
let result = '';
|
|
3993
|
+
for (const char of standardEncodedString){
|
|
3994
|
+
const index = CryptoConfig.STANDARD_BASE64_ALPHABET.indexOf(char);
|
|
3995
|
+
if (-1 !== index) result += CryptoConfig.CUSTOM_BASE64_ALPHABET[index];
|
|
3996
|
+
else result += char;
|
|
3997
|
+
}
|
|
3998
|
+
return result;
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
class RequestSignatureValidator {
|
|
4002
|
+
static validateMethod(method) {
|
|
4003
|
+
if ('string' != typeof method) throw new TypeError(`method must be string, got ${typeof method}`);
|
|
4004
|
+
const upperMethod = method.trim().toUpperCase();
|
|
4005
|
+
if ('GET' !== upperMethod && 'POST' !== upperMethod) throw new Error(`method must be 'GET' or 'POST', got '${upperMethod}'`);
|
|
4006
|
+
return upperMethod;
|
|
4007
|
+
}
|
|
4008
|
+
static validateUri(uri) {
|
|
4009
|
+
if ('string' != typeof uri) throw new TypeError(`uri must be string, got ${typeof uri}`);
|
|
4010
|
+
if (!uri.trim()) throw new Error('uri cannot be empty');
|
|
4011
|
+
return uri.trim();
|
|
4012
|
+
}
|
|
4013
|
+
static validateA1Value(a1Value) {
|
|
4014
|
+
if ('string' != typeof a1Value) throw new TypeError(`a1_value must be string, got ${typeof a1Value}`);
|
|
4015
|
+
if (!a1Value.trim()) throw new Error('a1_value cannot be empty');
|
|
4016
|
+
return a1Value.trim();
|
|
4017
|
+
}
|
|
4018
|
+
static validateXsecAppid(xsecAppid) {
|
|
4019
|
+
if ('string' != typeof xsecAppid) throw new TypeError(`xsec_appid must be string, got ${typeof xsecAppid}`);
|
|
4020
|
+
if (!xsecAppid.trim()) throw new Error('xsec_appid cannot be empty');
|
|
4021
|
+
return xsecAppid.trim();
|
|
4022
|
+
}
|
|
4023
|
+
static validatePayload(payload) {
|
|
4024
|
+
if (null !== payload && 'object' != typeof payload) throw new TypeError(`payload must be object or null, got ${typeof payload}`);
|
|
4025
|
+
if (null != payload) {
|
|
4026
|
+
for(const key in payload)if ('string' != typeof key) throw new TypeError(`payload keys must be string, got ${typeof key} for key '${key}'`);
|
|
4027
|
+
}
|
|
4028
|
+
return payload;
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
class CryptoProcessor {
|
|
2698
4032
|
constructor(){
|
|
2699
|
-
this.
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
4033
|
+
this.bitOps = new BitOperations();
|
|
4034
|
+
this.b58encoder = new Base58Encoder();
|
|
4035
|
+
this.b64encoder = new Base64Encoder();
|
|
4036
|
+
this.hexProcessor = new HexProcessor();
|
|
4037
|
+
this.randomGen = new RandomGenerator();
|
|
4038
|
+
}
|
|
4039
|
+
encodeTimestamp(ts, randomizeFirst = true) {
|
|
4040
|
+
const key = Array(8).fill(CryptoConfig.TIMESTAMP_XOR_KEY);
|
|
4041
|
+
const arr = this.intToLeBytes(ts, 8);
|
|
4042
|
+
const encoded = arr.map((a, i)=>a ^ key[i]);
|
|
4043
|
+
if (randomizeFirst) encoded[0] = this.randomGen.generateRandomByteInRange(0, 255);
|
|
4044
|
+
return encoded;
|
|
4045
|
+
}
|
|
4046
|
+
intToLeBytes(val, length = 4) {
|
|
4047
|
+
const arr = [];
|
|
4048
|
+
for(let i = 0; i < length; i++){
|
|
4049
|
+
arr.push(0xFF & val);
|
|
4050
|
+
val >>>= 8;
|
|
4051
|
+
}
|
|
4052
|
+
return arr;
|
|
4053
|
+
}
|
|
4054
|
+
strToLenPrefixedBytes(s) {
|
|
4055
|
+
const buf = external_node_buffer_namespaceObject.Buffer.from(s, 'utf-8');
|
|
4056
|
+
return [
|
|
4057
|
+
buf.length,
|
|
4058
|
+
...Array.from(buf)
|
|
2704
4059
|
];
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
4060
|
+
}
|
|
4061
|
+
buildEnvironmentBytes() {
|
|
4062
|
+
return [
|
|
4063
|
+
CryptoConfig.ENV_STATIC_BYTES[0],
|
|
4064
|
+
this.randomGen.generateRandomByteInRange(10, 254),
|
|
4065
|
+
...CryptoConfig.ENV_STATIC_BYTES.slice(1)
|
|
4066
|
+
];
|
|
4067
|
+
}
|
|
4068
|
+
buildPayloadArray(hexParameter, a1Value, appIdentifier = "xhs-pc-web", stringParam = "") {
|
|
4069
|
+
const randNum = this.randomGen.generateRandomInt();
|
|
4070
|
+
const ts = Date.now();
|
|
4071
|
+
const startupTs = ts - (CryptoConfig.STARTUP_TIME_OFFSET_MIN + this.randomGen.generateRandomByteInRange(0, CryptoConfig.STARTUP_TIME_OFFSET_MAX - CryptoConfig.STARTUP_TIME_OFFSET_MIN));
|
|
4072
|
+
const arr = [];
|
|
4073
|
+
arr.push(...CryptoConfig.VERSION_BYTES);
|
|
4074
|
+
const randBytes = this.intToLeBytes(randNum, 4);
|
|
4075
|
+
arr.push(...randBytes);
|
|
4076
|
+
const xorKey = randBytes[0];
|
|
4077
|
+
arr.push(...this.encodeTimestamp(ts, true));
|
|
4078
|
+
arr.push(...this.intToLeBytes(startupTs, 8));
|
|
4079
|
+
arr.push(...this.intToLeBytes(CryptoConfig.FIXED_INT_VALUE_1));
|
|
4080
|
+
arr.push(...this.intToLeBytes(CryptoConfig.FIXED_INT_VALUE_2));
|
|
4081
|
+
const stringParamLength = external_node_buffer_namespaceObject.Buffer.from(stringParam, 'utf-8').length;
|
|
4082
|
+
arr.push(...this.intToLeBytes(stringParamLength));
|
|
4083
|
+
const md5Bytes = external_node_buffer_namespaceObject.Buffer.from(hexParameter, 'hex');
|
|
4084
|
+
const xorMd5Bytes = Array.from(md5Bytes).map((b)=>b ^ xorKey);
|
|
4085
|
+
arr.push(...xorMd5Bytes.slice(0, 8));
|
|
4086
|
+
arr.push(...this.strToLenPrefixedBytes(a1Value));
|
|
4087
|
+
arr.push(...this.strToLenPrefixedBytes(appIdentifier));
|
|
4088
|
+
arr.push(CryptoConfig.ENV_STATIC_BYTES[0], this.randomGen.generateRandomByteInRange(0, 255), ...CryptoConfig.ENV_STATIC_BYTES.slice(1));
|
|
4089
|
+
return arr;
|
|
2712
4090
|
}
|
|
2713
4091
|
}
|
|
2714
|
-
|
|
4092
|
+
class Xhshow {
|
|
4093
|
+
constructor(){
|
|
4094
|
+
this.cryptoProcessor = new CryptoProcessor();
|
|
4095
|
+
}
|
|
4096
|
+
buildContentString(method, uri, payload) {
|
|
4097
|
+
payload = payload || {};
|
|
4098
|
+
if ("POST" === method.toUpperCase()) return uri + JSON.stringify(payload);
|
|
4099
|
+
if (!payload || 0 === Object.keys(payload).length) return uri;
|
|
4100
|
+
{
|
|
4101
|
+
const params = Object.entries(payload).map(([key, value])=>{
|
|
4102
|
+
let valueStr = '';
|
|
4103
|
+
if (Array.isArray(value)) valueStr = value.map((v)=>String(v)).join(',');
|
|
4104
|
+
else if (null != value) valueStr = String(value);
|
|
4105
|
+
return `${key}=${valueStr}`;
|
|
4106
|
+
});
|
|
4107
|
+
return `${uri}?${params.join('&')}`;
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
generateDValue(content) {
|
|
4111
|
+
return external_node_crypto_default().createHash('md5').update(content, 'utf-8').digest('hex');
|
|
4112
|
+
}
|
|
4113
|
+
buildSignature(dValue, a1Value, xsecAppid = "xhs-pc-web", stringParam = "") {
|
|
4114
|
+
const payloadArray = this.cryptoProcessor.buildPayloadArray(dValue, a1Value, xsecAppid, stringParam);
|
|
4115
|
+
const xorResult = this.cryptoProcessor.bitOps.xorTransformArray(payloadArray);
|
|
4116
|
+
return this.cryptoProcessor.b58encoder.encodeToB58(xorResult);
|
|
4117
|
+
}
|
|
4118
|
+
signXs(method, uri, a1Value, xsecAppid = "xhs-pc-web", payload) {
|
|
4119
|
+
const validatedMethod = RequestSignatureValidator.validateMethod(method);
|
|
4120
|
+
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
4121
|
+
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
4122
|
+
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
4123
|
+
const validatedPayload = RequestSignatureValidator.validatePayload(payload);
|
|
4124
|
+
const signatureData = {
|
|
4125
|
+
...CryptoConfig.SIGNATURE_DATA_TEMPLATE
|
|
4126
|
+
};
|
|
4127
|
+
const contentString = this.buildContentString(validatedMethod, validatedUri, validatedPayload);
|
|
4128
|
+
const dValue = this.generateDValue(contentString);
|
|
4129
|
+
signatureData.x3 = CryptoConfig.X3_PREFIX + this.buildSignature(dValue, validatedA1Value, validatedXsecAppid, contentString);
|
|
4130
|
+
return CryptoConfig.XYS_PREFIX + this.cryptoProcessor.b64encoder.encodeToB64(JSON.stringify(signatureData));
|
|
4131
|
+
}
|
|
4132
|
+
signXsGet(uri, a1Value, xsecAppid = "xhs-pc-web", params) {
|
|
4133
|
+
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
4134
|
+
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
4135
|
+
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
4136
|
+
const validatedParams = RequestSignatureValidator.validatePayload(params);
|
|
4137
|
+
return this.signXs("GET", validatedUri, validatedA1Value, validatedXsecAppid, validatedParams);
|
|
4138
|
+
}
|
|
4139
|
+
signXsPost(uri, a1Value, xsecAppid = "xhs-pc-web", payload) {
|
|
4140
|
+
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
4141
|
+
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
4142
|
+
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
4143
|
+
const validatedPayload = RequestSignatureValidator.validatePayload(payload);
|
|
4144
|
+
return this.signXs("POST", validatedUri, validatedA1Value, validatedXsecAppid, validatedPayload);
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
const searchXiaohongshuTopicList_xsEncrypt = new Xhshow();
|
|
2715
4148
|
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
2716
4149
|
const http = new Http({
|
|
2717
4150
|
headers: {
|
|
@@ -2739,9 +4172,8 @@ var __webpack_exports__ = {};
|
|
|
2739
4172
|
page: 1
|
|
2740
4173
|
}
|
|
2741
4174
|
};
|
|
2742
|
-
const
|
|
2743
|
-
const
|
|
2744
|
-
const xs = await searchXiaohongshuTopicList_xsEncrypt.encryptXs(fatchTopic, a1Cookie, xt);
|
|
4175
|
+
const fatchTopic = "/web_api/sns/v1/search/topic";
|
|
4176
|
+
const xs = searchXiaohongshuTopicList_xsEncrypt.signXsPost(fatchTopic, a1Cookie, "xhs-pc-web", topicData);
|
|
2745
4177
|
const result = await http.api({
|
|
2746
4178
|
method: "post",
|
|
2747
4179
|
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
@@ -2790,12 +4222,13 @@ var __webpack_exports__ = {};
|
|
|
2790
4222
|
const mock_mockAction = async (task, params)=>{
|
|
2791
4223
|
const { toutiaoSingleCover, toutiaoMultCover, toutiaoCoverType, toutiaoOriginal, toutiaoExclusive, toutiaoClaim } = params.settingInfo;
|
|
2792
4224
|
const tmpCachePath = task.getTmpPath();
|
|
4225
|
+
const headers = {
|
|
4226
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
4227
|
+
origin: "https://mp.toutiao.com",
|
|
4228
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
4229
|
+
};
|
|
2793
4230
|
const http = new Http({
|
|
2794
|
-
headers
|
|
2795
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2796
|
-
origin: "https://mp.toutiao.com",
|
|
2797
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2798
|
-
}
|
|
4231
|
+
headers
|
|
2799
4232
|
});
|
|
2800
4233
|
http.addResponseInterceptor((response)=>{
|
|
2801
4234
|
if (response.data?.code !== 0) {
|
|
@@ -2922,6 +4355,7 @@ var __webpack_exports__ = {};
|
|
|
2922
4355
|
article_ad_type: getAddTypeValue(params.settingInfo.toutiaoAd),
|
|
2923
4356
|
claim_exclusive: toutiaoExclusive ? toutiaoExclusive : toutiaoOriginal?.includes("exclusive") ? 1 : 0
|
|
2924
4357
|
};
|
|
4358
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
2925
4359
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
2926
4360
|
let publishOption = {};
|
|
2927
4361
|
if (msToken) {
|
|
@@ -2953,7 +4387,10 @@ var __webpack_exports__ = {};
|
|
|
2953
4387
|
},
|
|
2954
4388
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
2955
4389
|
};
|
|
2956
|
-
const
|
|
4390
|
+
const proxyHttp = new Http({
|
|
4391
|
+
headers
|
|
4392
|
+
}, params.proxyLoc);
|
|
4393
|
+
const publishResult = await proxyHttp.api(publishOption);
|
|
2957
4394
|
return (0, share_namespaceObject.success)(publishResult.data.pgc_id);
|
|
2958
4395
|
};
|
|
2959
4396
|
const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
|
|
@@ -3166,6 +4603,7 @@ var __webpack_exports__ = {};
|
|
|
3166
4603
|
const confirmBtn = page.locator('div.byte-modal-footer button.byte-btn-primary:has-text("确定")');
|
|
3167
4604
|
if (await confirmBtn.isVisible()) await confirmBtn.click();
|
|
3168
4605
|
}
|
|
4606
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
3169
4607
|
if ("publish" === params.saveType) {
|
|
3170
4608
|
await page.locator(".publish-footer button").filter({
|
|
3171
4609
|
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
@@ -3573,10 +5011,10 @@ var __webpack_exports__ = {};
|
|
|
3573
5011
|
origin: "https://creator.xiaohongshu.com"
|
|
3574
5012
|
}
|
|
3575
5013
|
});
|
|
3576
|
-
const xsEncrypt = new
|
|
5014
|
+
const xsEncrypt = new Xhshow();
|
|
3577
5015
|
const xt = Date.now().toString();
|
|
3578
5016
|
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
3579
|
-
const xs =
|
|
5017
|
+
const xs = xsEncrypt.signXsGet(sevenDataUrl, a1Cookie, "xhs-pc-web", null);
|
|
3580
5018
|
const [overAllData, sevenData] = await Promise.all([
|
|
3581
5019
|
http.api({
|
|
3582
5020
|
method: "get",
|
|
@@ -3937,7 +5375,7 @@ var __webpack_exports__ = {};
|
|
|
3937
5375
|
async function handleXiaohongshuData(params) {
|
|
3938
5376
|
try {
|
|
3939
5377
|
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3940
|
-
const xsEncrypt = new
|
|
5378
|
+
const xsEncrypt = new Xhshow();
|
|
3941
5379
|
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
3942
5380
|
if (!a1Cookie) return {
|
|
3943
5381
|
code: 200,
|
|
@@ -3958,8 +5396,12 @@ var __webpack_exports__ = {};
|
|
|
3958
5396
|
});
|
|
3959
5397
|
async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
|
|
3960
5398
|
const xt = Date.now().toString();
|
|
3961
|
-
const serveUrl =
|
|
3962
|
-
const
|
|
5399
|
+
const serveUrl = "/web_api/sns/v5/creator/note/user/posted";
|
|
5400
|
+
const serveParams = {
|
|
5401
|
+
tab: onlySuccess ? 1 : 0,
|
|
5402
|
+
page: pageNum - 1
|
|
5403
|
+
};
|
|
5404
|
+
const xs = xsEncrypt.signXsGet(serveUrl, a1Cookie, "xhs-pc-web", serveParams);
|
|
3963
5405
|
return await http.api({
|
|
3964
5406
|
method: "get",
|
|
3965
5407
|
baseURL: "https://edith.xiaohongshu.com",
|
|
@@ -3967,7 +5409,8 @@ var __webpack_exports__ = {};
|
|
|
3967
5409
|
headers: {
|
|
3968
5410
|
"x-s": xs,
|
|
3969
5411
|
"x-t": xt
|
|
3970
|
-
}
|
|
5412
|
+
},
|
|
5413
|
+
params: serveParams
|
|
3971
5414
|
});
|
|
3972
5415
|
}
|
|
3973
5416
|
const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
|
|
@@ -4252,13 +5695,14 @@ var __webpack_exports__ = {};
|
|
|
4252
5695
|
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
4253
5696
|
const client_time_diff = +Number("1743488763") - Math.floor(new Date().getTime() / 1000);
|
|
4254
5697
|
const tmpCachePath = task.getTmpPath();
|
|
5698
|
+
const headers = {
|
|
5699
|
+
"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",
|
|
5700
|
+
Cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
5701
|
+
origin: "https://mp.weixin.qq.com",
|
|
5702
|
+
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()}`
|
|
5703
|
+
};
|
|
4255
5704
|
const http = new Http({
|
|
4256
|
-
headers
|
|
4257
|
-
"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",
|
|
4258
|
-
Cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
4259
|
-
origin: "https://mp.weixin.qq.com",
|
|
4260
|
-
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()}`
|
|
4261
|
-
}
|
|
5705
|
+
headers
|
|
4262
5706
|
});
|
|
4263
5707
|
http.addResponseInterceptor((response)=>{
|
|
4264
5708
|
const responseData = response.data;
|
|
@@ -4598,6 +6042,7 @@ var __webpack_exports__ = {};
|
|
|
4598
6042
|
masssend_check: 1,
|
|
4599
6043
|
is_masssend: 1
|
|
4600
6044
|
};
|
|
6045
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
4601
6046
|
const { appMsgId } = await http.api({
|
|
4602
6047
|
method: "post",
|
|
4603
6048
|
url: "https://mp.weixin.qq.com/cgi-bin/operate_appmsg",
|
|
@@ -4804,6 +6249,9 @@ var __webpack_exports__ = {};
|
|
|
4804
6249
|
};
|
|
4805
6250
|
const uuid = getUuidResult.uuid;
|
|
4806
6251
|
await (0, share_namespaceObject.sleep)(1000);
|
|
6252
|
+
new Http({
|
|
6253
|
+
headers
|
|
6254
|
+
}, params.proxyLoc);
|
|
4807
6255
|
const qrcodeResult = await http.api({
|
|
4808
6256
|
method: "get",
|
|
4809
6257
|
url: "https://mp.weixin.qq.com/safe/safeqrcode",
|
|
@@ -4823,7 +6271,7 @@ var __webpack_exports__ = {};
|
|
|
4823
6271
|
responseType: "arraybuffer"
|
|
4824
6272
|
});
|
|
4825
6273
|
const qrcodeBuffer = Buffer.from(qrcodeResult);
|
|
4826
|
-
const qrcodeFilePath = external_node_path_default().join(tmpCachePath,
|
|
6274
|
+
const qrcodeFilePath = external_node_path_default().join(tmpCachePath, `weixin_qrcode_${Date.now()}.jpg`);
|
|
4827
6275
|
external_node_fs_default().writeFileSync(qrcodeFilePath, new Uint8Array(qrcodeBuffer));
|
|
4828
6276
|
params.safeQrcodeCallback?.(qrcodeFilePath);
|
|
4829
6277
|
let code = "";
|
|
@@ -5256,6 +6704,7 @@ var __webpack_exports__ = {};
|
|
|
5256
6704
|
await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
|
|
5257
6705
|
}
|
|
5258
6706
|
await page.waitForTimeout(1000);
|
|
6707
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
5259
6708
|
const articleId = await new Promise(async (resolve)=>{
|
|
5260
6709
|
const handleResponse = async (response)=>{
|
|
5261
6710
|
const url = response.url();
|
|
@@ -5589,7 +7038,7 @@ var __webpack_exports__ = {};
|
|
|
5589
7038
|
902: "登录已过期,请重新登录!",
|
|
5590
7039
|
906: "账号存在风险,请重新登录"
|
|
5591
7040
|
};
|
|
5592
|
-
const mock_xsEncrypt = new
|
|
7041
|
+
const mock_xsEncrypt = new Xhshow();
|
|
5593
7042
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
5594
7043
|
const tmpCachePath = task.getTmpPath();
|
|
5595
7044
|
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
@@ -5598,13 +7047,14 @@ var __webpack_exports__ = {};
|
|
|
5598
7047
|
message: "账号数据异常,请重新绑定账号后重试。",
|
|
5599
7048
|
data: ""
|
|
5600
7049
|
};
|
|
7050
|
+
const headers = {
|
|
7051
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
7052
|
+
origin: "https://creator.xiaohongshu.com",
|
|
7053
|
+
referer: "https://creator.xiaohongshu.com/",
|
|
7054
|
+
"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"
|
|
7055
|
+
};
|
|
5601
7056
|
const http = new Http({
|
|
5602
|
-
headers
|
|
5603
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
5604
|
-
origin: "https://creator.xiaohongshu.com",
|
|
5605
|
-
referer: "https://creator.xiaohongshu.com/",
|
|
5606
|
-
"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"
|
|
5607
|
-
}
|
|
7057
|
+
headers
|
|
5608
7058
|
});
|
|
5609
7059
|
http.addResponseInterceptor((response)=>{
|
|
5610
7060
|
const responseData = response.data;
|
|
@@ -5617,9 +7067,16 @@ var __webpack_exports__ = {};
|
|
|
5617
7067
|
};
|
|
5618
7068
|
}
|
|
5619
7069
|
});
|
|
5620
|
-
const fetchCoverUrl =
|
|
7070
|
+
const fetchCoverUrl = "/api/media/v1/upload/creator/permit";
|
|
7071
|
+
const fetchCoverParams = {
|
|
7072
|
+
biz_name: "spectrum",
|
|
7073
|
+
scene: "image",
|
|
7074
|
+
file_count: params.banners.length,
|
|
7075
|
+
version: 1,
|
|
7076
|
+
source: "web"
|
|
7077
|
+
};
|
|
5621
7078
|
const xt = Date.now().toString();
|
|
5622
|
-
const xs =
|
|
7079
|
+
const xs = mock_xsEncrypt.signXsGet(fetchCoverUrl, a1Cookie, "xhs-pc-web", fetchCoverParams);
|
|
5623
7080
|
const coverIdInfo = await http.api({
|
|
5624
7081
|
method: "get",
|
|
5625
7082
|
baseURL: "https://creator.xiaohongshu.com",
|
|
@@ -5628,7 +7085,8 @@ var __webpack_exports__ = {};
|
|
|
5628
7085
|
headers: {
|
|
5629
7086
|
"x-s": xs,
|
|
5630
7087
|
"x-t": xt
|
|
5631
|
-
}
|
|
7088
|
+
},
|
|
7089
|
+
params: fetchCoverParams
|
|
5632
7090
|
});
|
|
5633
7091
|
let uploadInfos = [];
|
|
5634
7092
|
coverIdInfo.data.uploadTempPermits.forEach((item)=>{
|
|
@@ -5702,9 +7160,8 @@ var __webpack_exports__ = {};
|
|
|
5702
7160
|
const topicData = {
|
|
5703
7161
|
topic_names: topic["name"]
|
|
5704
7162
|
};
|
|
5705
|
-
const topicDataStr = mock_xsEncrypt.dumps(topicData);
|
|
5706
7163
|
const publishXt = Date.now().toString();
|
|
5707
|
-
const publishXs =
|
|
7164
|
+
const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/capa/postgw/topic/batch_customized", a1Cookie, "xhs-pc-web", topicData);
|
|
5708
7165
|
let createTopic = await http.api({
|
|
5709
7166
|
method: "POST",
|
|
5710
7167
|
url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
|
|
@@ -5803,11 +7260,14 @@ var __webpack_exports__ = {};
|
|
|
5803
7260
|
} : {}
|
|
5804
7261
|
};
|
|
5805
7262
|
publishData.common.business_binds = JSON.stringify(business_binds);
|
|
5806
|
-
const publishDataStr = mock_xsEncrypt.dumps(publishData);
|
|
5807
7263
|
const publishXt = Date.now().toString();
|
|
5808
|
-
const publishXs =
|
|
7264
|
+
const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/v2/note", a1Cookie, "xhs-pc-web", publishData);
|
|
5809
7265
|
const xscommon = GenXSCommon(a1Cookie, publishXt, publishXs);
|
|
5810
|
-
const
|
|
7266
|
+
const proxyHttp = new Http({
|
|
7267
|
+
headers
|
|
7268
|
+
}, params.proxyLoc);
|
|
7269
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
7270
|
+
const publishResult = await proxyHttp.api({
|
|
5811
7271
|
method: "post",
|
|
5812
7272
|
url: "https://edith.xiaohongshu.com/web_api/sns/v2/note",
|
|
5813
7273
|
data: publishData,
|
|
@@ -5821,7 +7281,7 @@ var __webpack_exports__ = {};
|
|
|
5821
7281
|
return (0, share_namespaceObject.success)(publishResult.data?.id);
|
|
5822
7282
|
};
|
|
5823
7283
|
const rpa_GenXSCommon = __webpack_require__("./src/utils/XhsXsCommonEnc.js");
|
|
5824
|
-
const rpa_xsEncrypt = new
|
|
7284
|
+
const rpa_xsEncrypt = new Xhshow();
|
|
5825
7285
|
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
5826
7286
|
const commonCookies = {
|
|
5827
7287
|
path: "/",
|
|
@@ -5852,7 +7312,8 @@ var __webpack_exports__ = {};
|
|
|
5852
7312
|
const url = request.url();
|
|
5853
7313
|
if (interceptUrls.some((pattern)=>url.includes(pattern))) {
|
|
5854
7314
|
const urlObj = new URL(url);
|
|
5855
|
-
|
|
7315
|
+
urlObj.pathname, urlObj.search;
|
|
7316
|
+
const fetchCoverParams = Object.fromEntries(new URLSearchParams(urlObj.search));
|
|
5856
7317
|
const xt = Date.now().toString();
|
|
5857
7318
|
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
5858
7319
|
if (!a1Cookie) {
|
|
@@ -5870,9 +7331,8 @@ var __webpack_exports__ = {};
|
|
|
5870
7331
|
const isNoteRequest = urlObj.pathname.includes(interceptUrls[5]);
|
|
5871
7332
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
5872
7333
|
const publishData = JSON.parse(request.postData() || "");
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
7334
|
+
return rpa_xsEncrypt.signXsPost(interceptUrls[5], a1Cookie, "xhs-pc-web", publishData);
|
|
7335
|
+
})() : rpa_xsEncrypt.signXsGet(urlObj.pathname, a1Cookie, "xhs-pc-web", fetchCoverParams));
|
|
5876
7336
|
const xscommon = rpa_GenXSCommon(a1Cookie, xt, xs);
|
|
5877
7337
|
const newHeaders = {
|
|
5878
7338
|
...request.headers(),
|
|
@@ -6014,6 +7474,7 @@ var __webpack_exports__ = {};
|
|
|
6014
7474
|
hasText: "仅自己可见"
|
|
6015
7475
|
}).click();
|
|
6016
7476
|
}
|
|
7477
|
+
task._timerRecord['PrePublish'] = Date.now();
|
|
6017
7478
|
const releaseTimeInstance = page.locator("label").filter({
|
|
6018
7479
|
hasText: params.isImmediatelyPublish ? "立即发布" : "定时发布"
|
|
6019
7480
|
});
|
|
@@ -6039,26 +7500,41 @@ var __webpack_exports__ = {};
|
|
|
6039
7500
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
6040
7501
|
};
|
|
6041
7502
|
var package_namespaceObject = {
|
|
6042
|
-
i8: "1.2.
|
|
7503
|
+
i8: "1.2.23"
|
|
6043
7504
|
};
|
|
7505
|
+
const BetaFlag = "HuiwenCanary";
|
|
6044
7506
|
class Action {
|
|
6045
7507
|
constructor(task){
|
|
6046
7508
|
this.task = task;
|
|
6047
7509
|
}
|
|
6048
7510
|
async bindTask(func, params) {
|
|
6049
7511
|
let responseData;
|
|
7512
|
+
this.task.isBeta = this.task.isFeatOn(BetaFlag);
|
|
7513
|
+
this.task._timerRecord = {
|
|
7514
|
+
ActionStart: Date.now()
|
|
7515
|
+
};
|
|
6050
7516
|
if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
|
|
6051
|
-
if (
|
|
7517
|
+
if (this.task.setSaveType) this.task.setSaveType(params.saveType ?? "");
|
|
7518
|
+
if (void 0 !== this.task.isInitializedGB) this.task.setGbInitType(this.task.isInitializedGB);
|
|
7519
|
+
if ("object" == typeof params) params.cookies = params?.cookies ?? [];
|
|
6052
7520
|
try {
|
|
6053
7521
|
responseData = await func(this.task, params);
|
|
6054
7522
|
} catch (error) {
|
|
6055
7523
|
responseData = Http.handleApiError(error);
|
|
7524
|
+
} finally{
|
|
7525
|
+
this.task._timerRecord['ActionEnd'] = Date.now();
|
|
6056
7526
|
}
|
|
7527
|
+
if (this.task.isBeta && this.task.setTimeConsuming) this.task.setTimeConsuming(this.task._timerRecord);
|
|
6057
7528
|
if (200 === responseData.code) this.task.logger.info(`${func.name} action params error`, responseData);
|
|
6058
7529
|
else if (0 !== responseData.code) {
|
|
6059
7530
|
this.task.logger.error(responseData.message || `${func.name} 执行失败`, stringifyError(responseData.data), responseData.extra);
|
|
6060
7531
|
this.task.logger.info(`${func.name} action failed`);
|
|
6061
7532
|
} else this.task.logger.info(`${func.name} action success`);
|
|
7533
|
+
if (this.task.debug && this.task._timerRecord['PrePublish']) {
|
|
7534
|
+
console.log("预处理图片耗时:", (this.task._timerRecord['PrePublish'] - this.task._timerRecord['ActionStart']) / 1000, "s");
|
|
7535
|
+
console.log("发文接口耗时:", (this.task._timerRecord['ActionEnd'] - this.task._timerRecord['PrePublish']) / 1000, "s");
|
|
7536
|
+
}
|
|
7537
|
+
this.task.debug && console.log("Action整体耗时:", (this.task._timerRecord['ActionEnd'] - this.task._timerRecord['ActionStart']) / 1000, "s");
|
|
6062
7538
|
return responseData;
|
|
6063
7539
|
}
|
|
6064
7540
|
FetchArticles(params) {
|