@iflyrpa/actions 1.2.23 → 1.2.24

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/bundle.js CHANGED
@@ -15547,57 +15547,366 @@ var __webpack_exports__ = {};
15547
15547
  const external_node_buffer_namespaceObject = require("node:buffer");
15548
15548
  const external_node_crypto_namespaceObject = require("node:crypto");
15549
15549
  var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
15550
- class XsEncrypt {
15551
- async encryptMD5(url) {
15552
- return external_node_crypto_default().createHash("md5").update(url, "utf8").digest("hex");
15553
- }
15554
- async encryptText(text) {
15555
- const textEncoded = external_node_buffer_namespaceObject.Buffer.from(text).toString("base64");
15556
- const cipher = external_node_crypto_default().createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
15557
- const ciphertext = cipher.update(textEncoded, "utf8", "base64");
15558
- return ciphertext + cipher.final("base64");
15559
- }
15560
- async base64ToHex(encodedData) {
15561
- const decodedData = external_node_buffer_namespaceObject.Buffer.from(encodedData, "base64");
15562
- return decodedData.toString("hex");
15563
- }
15564
- async encryptPayload(payload, platform) {
15565
- const hexPayload = await this.base64ToHex(payload);
15566
- const obj = {
15567
- signSvn: "56",
15568
- signType: "x2",
15569
- appID: platform,
15570
- signVersion: "1",
15571
- payload: hexPayload
15550
+ class CryptoConfig {
15551
+ static{
15552
+ this.MAX_32BIT = 0xFFFFFFFF;
15553
+ }
15554
+ static{
15555
+ this.MAX_SIGNED_32BIT = 0x7FFFFFFF;
15556
+ }
15557
+ static{
15558
+ this.BASE58_ALPHABET = "NOPQRStuvwxWXYZabcyz012DEFTKLMdefghijkl4563GHIJBC7mnop89+/AUVqrsOPQefghijkABCDEFGuvwz0123456789xy";
15559
+ }
15560
+ static{
15561
+ this.STANDARD_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
15562
+ }
15563
+ static{
15564
+ this.CUSTOM_BASE64_ALPHABET = "ZmserbBoHQtNP+wOcza/LpngG8yJq42KWYj0DSfdikx3VT16IlUAFM97hECvuRX5";
15565
+ }
15566
+ static{
15567
+ this.BASE58_BASE = 58;
15568
+ }
15569
+ static{
15570
+ this.BYTE_SIZE = 256;
15571
+ }
15572
+ static{
15573
+ this.HEX_KEY = "af572b95ca65b2d9ec76bb5d2e97cb653299cc663399cc663399cce673399cce6733190c06030100000000008040209048241289c4e271381c0e0703018040a05028148ac56231180c0683c16030984c2693c964b259ac56abd5eaf5fafd7e3f9f4f279349a4d2e9743a9d4e279349a4d2e9f47a3d1e8f47239148a4d269341a8d4623110884422190c86432994ca6d3e974baddee773b1d8e47a35128148ac5623198cce6f3f97c3e1f8f47a3d168b45aad562b158ac5e2f1f87c3e9f4f279349a4d269b45aad56";
15574
+ }
15575
+ static{
15576
+ this.TIMESTAMP_BYTES_COUNT = 16;
15577
+ }
15578
+ static{
15579
+ this.TIMESTAMP_XOR_KEY = 41;
15580
+ }
15581
+ static{
15582
+ this.STARTUP_TIME_OFFSET_MIN = 1000;
15583
+ }
15584
+ static{
15585
+ this.STARTUP_TIME_OFFSET_MAX = 4000;
15586
+ }
15587
+ static{
15588
+ this.EXPECTED_HEX_LENGTH = 32;
15589
+ }
15590
+ static{
15591
+ this.OUTPUT_BYTE_COUNT = 8;
15592
+ }
15593
+ static{
15594
+ this.HEX_CHUNK_SIZE = 2;
15595
+ }
15596
+ static{
15597
+ this.VERSION_BYTES = [
15598
+ 119,
15599
+ 104,
15600
+ 96,
15601
+ 41
15602
+ ];
15603
+ }
15604
+ static{
15605
+ this.FIXED_SEPARATOR_BYTES = [
15606
+ 16,
15607
+ 0,
15608
+ 0,
15609
+ 0,
15610
+ 15,
15611
+ 5,
15612
+ 0,
15613
+ 0,
15614
+ 47,
15615
+ 1,
15616
+ 0,
15617
+ 0
15618
+ ];
15619
+ }
15620
+ static{
15621
+ this.RANDOM_BYTE_COUNT = 4;
15622
+ }
15623
+ static{
15624
+ this.FIXED_INT_VALUE_1 = 15;
15625
+ }
15626
+ static{
15627
+ this.FIXED_INT_VALUE_2 = 1291;
15628
+ }
15629
+ static{
15630
+ this.ENV_STATIC_BYTES = [
15631
+ 1,
15632
+ 249,
15633
+ 83,
15634
+ 102,
15635
+ 103,
15636
+ 201,
15637
+ 181,
15638
+ 131,
15639
+ 99,
15640
+ 94,
15641
+ 7,
15642
+ 68,
15643
+ 250,
15644
+ 132,
15645
+ 21
15646
+ ];
15647
+ }
15648
+ static{
15649
+ this.SIGNATURE_DATA_TEMPLATE = {
15650
+ x0: "4.2.2",
15651
+ x1: "xhs-pc-web",
15652
+ x2: "Windows",
15653
+ x3: "",
15654
+ x4: "object"
15572
15655
  };
15573
- const jsonString = JSON.stringify(obj, null, 0);
15574
- return external_node_buffer_namespaceObject.Buffer.from(jsonString).toString("base64");
15575
15656
  }
15576
- async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
15577
- const text = `x1=${await this.encryptMD5(`url=${url}`)};x2=0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|0;x3=${a1};x4=${ts};`;
15578
- return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
15657
+ static{
15658
+ this.X3_PREFIX = "mns0101_";
15659
+ }
15660
+ static{
15661
+ this.XYS_PREFIX = "XYS_";
15662
+ }
15663
+ }
15664
+ class RandomGenerator {
15665
+ generateRandomBytes(byteCount) {
15666
+ return Array.from({
15667
+ length: byteCount
15668
+ }, ()=>Math.floor(Math.random() * CryptoConfig.BYTE_SIZE));
15669
+ }
15670
+ generateRandomByteInRange(minVal, maxVal) {
15671
+ return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
15672
+ }
15673
+ generateRandomInt() {
15674
+ return Math.floor(Math.random() * (CryptoConfig.MAX_32BIT + 1));
15675
+ }
15676
+ }
15677
+ class HexProcessor {
15678
+ hexStringToBytes(hexString) {
15679
+ const byteValues = [];
15680
+ for(let i = 0; i < hexString.length; i += CryptoConfig.HEX_CHUNK_SIZE){
15681
+ const hexChunk = hexString.substr(i, CryptoConfig.HEX_CHUNK_SIZE);
15682
+ byteValues.push(parseInt(hexChunk, 16));
15683
+ }
15684
+ return byteValues;
15685
+ }
15686
+ processHexParameter(hexString, xorKey) {
15687
+ if (hexString.length !== CryptoConfig.EXPECTED_HEX_LENGTH) throw new Error(`hex parameter must be ${CryptoConfig.EXPECTED_HEX_LENGTH} characters`);
15688
+ const byteValues = this.hexStringToBytes(hexString);
15689
+ return byteValues.map((byteVal)=>byteVal ^ xorKey).slice(0, CryptoConfig.OUTPUT_BYTE_COUNT);
15690
+ }
15691
+ }
15692
+ class BitOperations {
15693
+ normalizeTo32bit(value) {
15694
+ return value & CryptoConfig.MAX_32BIT;
15695
+ }
15696
+ toSigned32bit(unsignedValue) {
15697
+ if (unsignedValue > CryptoConfig.MAX_SIGNED_32BIT) return unsignedValue - 0x100000000;
15698
+ return unsignedValue;
15699
+ }
15700
+ computeSeedValue(seed32bit) {
15701
+ const normalizedSeed = this.normalizeTo32bit(seed32bit);
15702
+ const shift15Bits = normalizedSeed >> 15;
15703
+ const shift13Bits = normalizedSeed >> 13;
15704
+ const shift12Bits = normalizedSeed >> 12;
15705
+ const shift10Bits = normalizedSeed >> 10;
15706
+ const xorMaskedResult = shift15Bits & ~shift13Bits | shift13Bits & ~shift15Bits;
15707
+ const shiftedResult = (xorMaskedResult ^ shift12Bits ^ shift10Bits) << 31 & CryptoConfig.MAX_32BIT;
15708
+ return this.toSigned32bit(shiftedResult);
15709
+ }
15710
+ xorTransformArray(sourceIntegers) {
15711
+ const resultBytes = new Uint8Array(sourceIntegers.length);
15712
+ const hexKeyBytes = external_node_buffer_namespaceObject.Buffer.from(CryptoConfig.HEX_KEY, 'hex');
15713
+ for(let index = 0; index < sourceIntegers.length; index++)resultBytes[index] = (sourceIntegers[index] ^ hexKeyBytes[index]) & 0xFF;
15714
+ return resultBytes;
15715
+ }
15716
+ }
15717
+ class Base58Encoder {
15718
+ encodeToB58(inputBytes) {
15719
+ const bytesArray = Array.isArray(inputBytes) ? inputBytes : Array.from(inputBytes);
15720
+ const numberAccumulator = this.bytesToNumber(bytesArray);
15721
+ const leadingZerosCount = this.countLeadingZeros(bytesArray);
15722
+ const encodedCharacters = this.numberToBase58Chars(numberAccumulator);
15723
+ encodedCharacters.push(...Array(leadingZerosCount).fill(CryptoConfig.BASE58_ALPHABET[0]));
15724
+ return encodedCharacters.reverse().join('');
15725
+ }
15726
+ bytesToNumber(inputBytes) {
15727
+ const bytesArray = Array.isArray(inputBytes) ? inputBytes : Array.from(inputBytes);
15728
+ let result = 0n;
15729
+ const BYTE_SIZE = 256n;
15730
+ for (const byteValue of bytesArray)result = result * BYTE_SIZE + BigInt(byteValue);
15731
+ return result;
15732
+ }
15733
+ countLeadingZeros(inputBytes) {
15734
+ let count = 0;
15735
+ for (const byteValue of inputBytes)if (0 === byteValue) count++;
15736
+ else break;
15737
+ return count;
15738
+ }
15739
+ numberToBase58Chars(number) {
15740
+ const characters = [];
15741
+ const base = BigInt(CryptoConfig.BASE58_BASE);
15742
+ while(number > 0n){
15743
+ const remainder = number % base;
15744
+ characters.push(CryptoConfig.BASE58_ALPHABET[Number(remainder)]);
15745
+ number /= base;
15746
+ }
15747
+ return characters;
15748
+ }
15749
+ }
15750
+ class Base64Encoder {
15751
+ encodeToB64(dataToEncode) {
15752
+ const dataBytes = external_node_buffer_namespaceObject.Buffer.from(dataToEncode, 'utf-8');
15753
+ const standardEncodedString = dataBytes.toString('base64');
15754
+ let result = '';
15755
+ for (const char of standardEncodedString){
15756
+ const index = CryptoConfig.STANDARD_BASE64_ALPHABET.indexOf(char);
15757
+ if (-1 !== index) result += CryptoConfig.CUSTOM_BASE64_ALPHABET[index];
15758
+ else result += char;
15759
+ }
15760
+ return result;
15579
15761
  }
15580
- dumps(...rest) {
15581
- const [data, replacer = null, space = 0] = rest;
15582
- return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
15762
+ }
15763
+ class RequestSignatureValidator {
15764
+ static validateMethod(method) {
15765
+ if ('string' != typeof method) throw new TypeError(`method must be string, got ${typeof method}`);
15766
+ const upperMethod = method.trim().toUpperCase();
15767
+ if ('GET' !== upperMethod && 'POST' !== upperMethod) throw new Error(`method must be 'GET' or 'POST', got '${upperMethod}'`);
15768
+ return upperMethod;
15769
+ }
15770
+ static validateUri(uri) {
15771
+ if ('string' != typeof uri) throw new TypeError(`uri must be string, got ${typeof uri}`);
15772
+ if (!uri.trim()) throw new Error('uri cannot be empty');
15773
+ return uri.trim();
15774
+ }
15775
+ static validateA1Value(a1Value) {
15776
+ if ('string' != typeof a1Value) throw new TypeError(`a1_value must be string, got ${typeof a1Value}`);
15777
+ if (!a1Value.trim()) throw new Error('a1_value cannot be empty');
15778
+ return a1Value.trim();
15779
+ }
15780
+ static validateXsecAppid(xsecAppid) {
15781
+ if ('string' != typeof xsecAppid) throw new TypeError(`xsec_appid must be string, got ${typeof xsecAppid}`);
15782
+ if (!xsecAppid.trim()) throw new Error('xsec_appid cannot be empty');
15783
+ return xsecAppid.trim();
15784
+ }
15785
+ static validatePayload(payload) {
15786
+ if (null !== payload && 'object' != typeof payload) throw new TypeError(`payload must be object or null, got ${typeof payload}`);
15787
+ if (null != payload) {
15788
+ for(const key in payload)if ('string' != typeof key) throw new TypeError(`payload keys must be string, got ${typeof key} for key '${key}'`);
15789
+ }
15790
+ return payload;
15583
15791
  }
15792
+ }
15793
+ class CryptoProcessor {
15584
15794
  constructor(){
15585
- this.words = [
15586
- 929260340,
15587
- 1633971297,
15588
- 895580464,
15589
- 925905270
15795
+ this.bitOps = new BitOperations();
15796
+ this.b58encoder = new Base58Encoder();
15797
+ this.b64encoder = new Base64Encoder();
15798
+ this.hexProcessor = new HexProcessor();
15799
+ this.randomGen = new RandomGenerator();
15800
+ }
15801
+ encodeTimestamp(ts, randomizeFirst = true) {
15802
+ const key = Array(8).fill(CryptoConfig.TIMESTAMP_XOR_KEY);
15803
+ const arr = this.intToLeBytes(ts, 8);
15804
+ const encoded = arr.map((a, i)=>a ^ key[i]);
15805
+ if (randomizeFirst) encoded[0] = this.randomGen.generateRandomByteInRange(0, 255);
15806
+ return encoded;
15807
+ }
15808
+ intToLeBytes(val, length = 4) {
15809
+ const arr = [];
15810
+ for(let i = 0; i < length; i++){
15811
+ arr.push(0xFF & val);
15812
+ val >>>= 8;
15813
+ }
15814
+ return arr;
15815
+ }
15816
+ strToLenPrefixedBytes(s) {
15817
+ const buf = external_node_buffer_namespaceObject.Buffer.from(s, 'utf-8');
15818
+ return [
15819
+ buf.length,
15820
+ ...Array.from(buf)
15821
+ ];
15822
+ }
15823
+ buildEnvironmentBytes() {
15824
+ return [
15825
+ CryptoConfig.ENV_STATIC_BYTES[0],
15826
+ this.randomGen.generateRandomByteInRange(10, 254),
15827
+ ...CryptoConfig.ENV_STATIC_BYTES.slice(1)
15590
15828
  ];
15591
- this.keyBytes = external_node_buffer_namespaceObject.Buffer.concat(this.words.map((word)=>new Uint8Array(external_node_buffer_namespaceObject.Buffer.from([
15592
- word >> 24 & 0xff,
15593
- word >> 16 & 0xff,
15594
- word >> 8 & 0xff,
15595
- 0xff & word
15596
- ]))));
15597
- this.iv = external_node_buffer_namespaceObject.Buffer.from("4uzjr7mbsibcaldp", "utf8");
15829
+ }
15830
+ buildPayloadArray(hexParameter, a1Value, appIdentifier = "xhs-pc-web", stringParam = "") {
15831
+ const randNum = this.randomGen.generateRandomInt();
15832
+ const ts = Date.now();
15833
+ const startupTs = ts - (CryptoConfig.STARTUP_TIME_OFFSET_MIN + this.randomGen.generateRandomByteInRange(0, CryptoConfig.STARTUP_TIME_OFFSET_MAX - CryptoConfig.STARTUP_TIME_OFFSET_MIN));
15834
+ const arr = [];
15835
+ arr.push(...CryptoConfig.VERSION_BYTES);
15836
+ const randBytes = this.intToLeBytes(randNum, 4);
15837
+ arr.push(...randBytes);
15838
+ const xorKey = randBytes[0];
15839
+ arr.push(...this.encodeTimestamp(ts, true));
15840
+ arr.push(...this.intToLeBytes(startupTs, 8));
15841
+ arr.push(...this.intToLeBytes(CryptoConfig.FIXED_INT_VALUE_1));
15842
+ arr.push(...this.intToLeBytes(CryptoConfig.FIXED_INT_VALUE_2));
15843
+ const stringParamLength = external_node_buffer_namespaceObject.Buffer.from(stringParam, 'utf-8').length;
15844
+ arr.push(...this.intToLeBytes(stringParamLength));
15845
+ const md5Bytes = external_node_buffer_namespaceObject.Buffer.from(hexParameter, 'hex');
15846
+ const xorMd5Bytes = Array.from(md5Bytes).map((b)=>b ^ xorKey);
15847
+ arr.push(...xorMd5Bytes.slice(0, 8));
15848
+ arr.push(...this.strToLenPrefixedBytes(a1Value));
15849
+ arr.push(...this.strToLenPrefixedBytes(appIdentifier));
15850
+ arr.push(CryptoConfig.ENV_STATIC_BYTES[0], this.randomGen.generateRandomByteInRange(0, 255), ...CryptoConfig.ENV_STATIC_BYTES.slice(1));
15851
+ return arr;
15598
15852
  }
15599
15853
  }
15600
- const searchXiaohongshuTopicList_xsEncrypt = new XsEncrypt();
15854
+ class Xhshow {
15855
+ constructor(){
15856
+ this.cryptoProcessor = new CryptoProcessor();
15857
+ }
15858
+ buildContentString(method, uri, payload) {
15859
+ payload = payload || {};
15860
+ if ("POST" === method.toUpperCase()) return uri + JSON.stringify(payload);
15861
+ if (!payload || 0 === Object.keys(payload).length) return uri;
15862
+ {
15863
+ const params = Object.entries(payload).map(([key, value])=>{
15864
+ let valueStr = '';
15865
+ if (Array.isArray(value)) valueStr = value.map((v)=>String(v)).join(',');
15866
+ else if (null != value) valueStr = String(value);
15867
+ return `${key}=${valueStr}`;
15868
+ });
15869
+ return `${uri}?${params.join('&')}`;
15870
+ }
15871
+ }
15872
+ generateDValue(content) {
15873
+ return external_node_crypto_default().createHash('md5').update(content, 'utf-8').digest('hex');
15874
+ }
15875
+ buildSignature(dValue, a1Value, xsecAppid = "xhs-pc-web", stringParam = "") {
15876
+ const payloadArray = this.cryptoProcessor.buildPayloadArray(dValue, a1Value, xsecAppid, stringParam);
15877
+ const xorResult = this.cryptoProcessor.bitOps.xorTransformArray(payloadArray);
15878
+ return this.cryptoProcessor.b58encoder.encodeToB58(xorResult);
15879
+ }
15880
+ signXs(method, uri, a1Value, xsecAppid = "xhs-pc-web", payload) {
15881
+ const validatedMethod = RequestSignatureValidator.validateMethod(method);
15882
+ const validatedUri = RequestSignatureValidator.validateUri(uri);
15883
+ const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
15884
+ const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
15885
+ const validatedPayload = RequestSignatureValidator.validatePayload(payload);
15886
+ const signatureData = {
15887
+ ...CryptoConfig.SIGNATURE_DATA_TEMPLATE
15888
+ };
15889
+ const contentString = this.buildContentString(validatedMethod, validatedUri, validatedPayload);
15890
+ const dValue = this.generateDValue(contentString);
15891
+ signatureData.x3 = CryptoConfig.X3_PREFIX + this.buildSignature(dValue, validatedA1Value, validatedXsecAppid, contentString);
15892
+ return CryptoConfig.XYS_PREFIX + this.cryptoProcessor.b64encoder.encodeToB64(JSON.stringify(signatureData));
15893
+ }
15894
+ signXsGet(uri, a1Value, xsecAppid = "xhs-pc-web", params) {
15895
+ const validatedUri = RequestSignatureValidator.validateUri(uri);
15896
+ const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
15897
+ const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
15898
+ const validatedParams = RequestSignatureValidator.validatePayload(params);
15899
+ return this.signXs("GET", validatedUri, validatedA1Value, validatedXsecAppid, validatedParams);
15900
+ }
15901
+ signXsPost(uri, a1Value, xsecAppid = "xhs-pc-web", payload) {
15902
+ const validatedUri = RequestSignatureValidator.validateUri(uri);
15903
+ const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
15904
+ const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
15905
+ const validatedPayload = RequestSignatureValidator.validatePayload(payload);
15906
+ return this.signXs("POST", validatedUri, validatedA1Value, validatedXsecAppid, validatedPayload);
15907
+ }
15908
+ }
15909
+ const searchXiaohongshuTopicList_xsEncrypt = new Xhshow();
15601
15910
  const searchXiaohongshuTopicList = async (_task, params)=>{
15602
15911
  const http = new Http({
15603
15912
  headers: {
@@ -15625,9 +15934,8 @@ var __webpack_exports__ = {};
15625
15934
  page: 1
15626
15935
  }
15627
15936
  };
15628
- const topicDataStr = searchXiaohongshuTopicList_xsEncrypt.dumps(topicData);
15629
- const fatchTopic = `/web_api/sns/v1/search/topic${topicDataStr}`;
15630
- const xs = await searchXiaohongshuTopicList_xsEncrypt.encryptXs(fatchTopic, a1Cookie, xt);
15937
+ const fatchTopic = "/web_api/sns/v1/search/topic";
15938
+ const xs = searchXiaohongshuTopicList_xsEncrypt.signXsPost(fatchTopic, a1Cookie, "xhs-pc-web", topicData);
15631
15939
  const result = await http.api({
15632
15940
  method: "post",
15633
15941
  url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
@@ -16459,10 +16767,10 @@ var __webpack_exports__ = {};
16459
16767
  origin: "https://creator.xiaohongshu.com"
16460
16768
  }
16461
16769
  });
16462
- const xsEncrypt = new XsEncrypt();
16770
+ const xsEncrypt = new Xhshow();
16463
16771
  const xt = Date.now().toString();
16464
16772
  const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
16465
- const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
16773
+ const xs = xsEncrypt.signXsGet(sevenDataUrl, a1Cookie, "xhs-pc-web", null);
16466
16774
  const [overAllData, sevenData] = await Promise.all([
16467
16775
  http.api({
16468
16776
  method: "get",
@@ -16823,7 +17131,7 @@ var __webpack_exports__ = {};
16823
17131
  async function handleXiaohongshuData(params) {
16824
17132
  try {
16825
17133
  const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
16826
- const xsEncrypt = new XsEncrypt();
17134
+ const xsEncrypt = new Xhshow();
16827
17135
  const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
16828
17136
  if (!a1Cookie) return {
16829
17137
  code: 200,
@@ -16844,8 +17152,12 @@ var __webpack_exports__ = {};
16844
17152
  });
16845
17153
  async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
16846
17154
  const xt = Date.now().toString();
16847
- const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
16848
- const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
17155
+ const serveUrl = "/web_api/sns/v5/creator/note/user/posted";
17156
+ const serveParams = {
17157
+ tab: onlySuccess ? 1 : 0,
17158
+ page: pageNum - 1
17159
+ };
17160
+ const xs = xsEncrypt.signXsGet(serveUrl, a1Cookie, "xhs-pc-web", serveParams);
16849
17161
  return await http.api({
16850
17162
  method: "get",
16851
17163
  baseURL: "https://edith.xiaohongshu.com",
@@ -16853,7 +17165,8 @@ var __webpack_exports__ = {};
16853
17165
  headers: {
16854
17166
  "x-s": xs,
16855
17167
  "x-t": xt
16856
- }
17168
+ },
17169
+ params: serveParams
16857
17170
  });
16858
17171
  }
16859
17172
  const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
@@ -18475,7 +18788,7 @@ var __webpack_exports__ = {};
18475
18788
  902: "登录已过期,请重新登录!",
18476
18789
  906: "账号存在风险,请重新登录"
18477
18790
  };
18478
- const mock_xsEncrypt = new XsEncrypt();
18791
+ const mock_xsEncrypt = new Xhshow();
18479
18792
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
18480
18793
  const tmpCachePath = task.getTmpPath();
18481
18794
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
@@ -18484,13 +18797,14 @@ var __webpack_exports__ = {};
18484
18797
  message: "账号数据异常,请重新绑定账号后重试。",
18485
18798
  data: ""
18486
18799
  };
18800
+ const headers = {
18801
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
18802
+ origin: "https://creator.xiaohongshu.com",
18803
+ referer: "https://creator.xiaohongshu.com/",
18804
+ "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"
18805
+ };
18487
18806
  const http = new Http({
18488
- headers: {
18489
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
18490
- origin: "https://creator.xiaohongshu.com",
18491
- referer: "https://creator.xiaohongshu.com/",
18492
- "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"
18493
- }
18807
+ headers
18494
18808
  });
18495
18809
  http.addResponseInterceptor((response)=>{
18496
18810
  const responseData = response.data;
@@ -18503,9 +18817,16 @@ var __webpack_exports__ = {};
18503
18817
  };
18504
18818
  }
18505
18819
  });
18506
- const fetchCoverUrl = `/api/media/v1/upload/creator/permit?biz_name=spectrum&scene=image&file_count=${params.banners.length}&version=1&source=web`;
18820
+ const fetchCoverUrl = "/api/media/v1/upload/creator/permit";
18821
+ const fetchCoverParams = {
18822
+ biz_name: "spectrum",
18823
+ scene: "image",
18824
+ file_count: params.banners.length,
18825
+ version: 1,
18826
+ source: "web"
18827
+ };
18507
18828
  const xt = Date.now().toString();
18508
- const xs = await mock_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt);
18829
+ const xs = mock_xsEncrypt.signXsGet(fetchCoverUrl, a1Cookie, "xhs-pc-web", fetchCoverParams);
18509
18830
  const coverIdInfo = await http.api({
18510
18831
  method: "get",
18511
18832
  baseURL: "https://creator.xiaohongshu.com",
@@ -18514,7 +18835,8 @@ var __webpack_exports__ = {};
18514
18835
  headers: {
18515
18836
  "x-s": xs,
18516
18837
  "x-t": xt
18517
- }
18838
+ },
18839
+ params: fetchCoverParams
18518
18840
  });
18519
18841
  let uploadInfos = [];
18520
18842
  coverIdInfo.data.uploadTempPermits.forEach((item)=>{
@@ -18588,9 +18910,8 @@ var __webpack_exports__ = {};
18588
18910
  const topicData = {
18589
18911
  topic_names: topic["name"]
18590
18912
  };
18591
- const topicDataStr = mock_xsEncrypt.dumps(topicData);
18592
18913
  const publishXt = Date.now().toString();
18593
- const publishXs = await mock_xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
18914
+ const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/capa/postgw/topic/batch_customized", a1Cookie, "xhs-pc-web", topicData);
18594
18915
  let createTopic = await http.api({
18595
18916
  method: "POST",
18596
18917
  url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
@@ -18689,9 +19010,8 @@ var __webpack_exports__ = {};
18689
19010
  } : {}
18690
19011
  };
18691
19012
  publishData.common.business_binds = JSON.stringify(business_binds);
18692
- const publishDataStr = mock_xsEncrypt.dumps(publishData);
18693
19013
  const publishXt = Date.now().toString();
18694
- const publishXs = await mock_xsEncrypt.encryptXs(`/web_api/sns/v2/note${publishDataStr}`, a1Cookie, publishXt);
19014
+ const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/v2/note", a1Cookie, "xhs-pc-web", publishData);
18695
19015
  const xscommon = GenXSCommon(a1Cookie, publishXt, publishXs);
18696
19016
  const publishResult = await http.api({
18697
19017
  method: "post",
@@ -18707,7 +19027,7 @@ var __webpack_exports__ = {};
18707
19027
  return success(publishResult.data?.id);
18708
19028
  };
18709
19029
  const rpa_GenXSCommon = __webpack_require__("./src/utils/XhsXsCommonEnc.js");
18710
- const rpa_xsEncrypt = new XsEncrypt();
19030
+ const rpa_xsEncrypt = new Xhshow();
18711
19031
  const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
18712
19032
  const commonCookies = {
18713
19033
  path: "/",
@@ -18738,7 +19058,8 @@ var __webpack_exports__ = {};
18738
19058
  const url = request.url();
18739
19059
  if (interceptUrls.some((pattern)=>url.includes(pattern))) {
18740
19060
  const urlObj = new URL(url);
18741
- const fetchCoverUrl = urlObj.pathname + urlObj.search;
19061
+ urlObj.pathname, urlObj.search;
19062
+ const fetchCoverParams = Object.fromEntries(new URLSearchParams(urlObj.search));
18742
19063
  const xt = Date.now().toString();
18743
19064
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
18744
19065
  if (!a1Cookie) {
@@ -18756,9 +19077,8 @@ var __webpack_exports__ = {};
18756
19077
  const isNoteRequest = urlObj.pathname.includes(interceptUrls[5]);
18757
19078
  const xs = await (isNoteRequest ? (async ()=>{
18758
19079
  const publishData = JSON.parse(request.postData() || "");
18759
- const publishDataStr = rpa_xsEncrypt.dumps(publishData);
18760
- return rpa_xsEncrypt.encryptXs(interceptUrls[5] + publishDataStr, a1Cookie, xt);
18761
- })() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
19080
+ return rpa_xsEncrypt.signXsPost(interceptUrls[5], a1Cookie, "xhs-pc-web", publishData);
19081
+ })() : rpa_xsEncrypt.signXsGet(urlObj.pathname, a1Cookie, "xhs-pc-web", fetchCoverParams));
18762
19082
  const xscommon = rpa_GenXSCommon(a1Cookie, xt, xs);
18763
19083
  const newHeaders = {
18764
19084
  ...request.headers(),
@@ -18925,7 +19245,7 @@ var __webpack_exports__ = {};
18925
19245
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
18926
19246
  };
18927
19247
  var package_namespaceObject = {
18928
- i8: "1.2.22"
19248
+ i8: "1.2.23"
18929
19249
  };
18930
19250
  class Action {
18931
19251
  constructor(task){