fast-vue-multi-pages-vite 1.3.7 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -32,9 +32,13 @@ declare class FastVueMultiSimpleRequestConfig {
32
32
  */
33
33
  nativeHttp: boolean;
34
34
  /**
35
- * 是否启用压缩
35
+ * 启用压缩
36
36
  */
37
- outCompress: boolean;
37
+ outCompress: string;
38
+ /**
39
+ * 解压缩密码
40
+ */
41
+ outCompressPassword: string;
38
42
  /**
39
43
  * json字典
40
44
  */
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import axios from "axios";
4
4
  import { clear, del, get, keys, set, update } from "idb-keyval";
5
5
  import CryptoJSMD5 from "crypto-js/md5";
6
6
  import * as uuid from "uuid";
7
- import { decompress } from "@structured-world/structured-zstd";
7
+ import { ZSTDDecoder } from "zstddec";
8
8
  import store from "store2";
9
9
  import cookies from "js-cookie";
10
10
  import copy from "copy-to-clipboard";
@@ -95,9 +95,13 @@ var FastVueMultiSimpleRequestConfig = class {
95
95
  */
96
96
  nativeHttp = false;
97
97
  /**
98
- * 是否启用压缩
98
+ * 启用压缩
99
99
  */
100
- outCompress = false;
100
+ outCompress;
101
+ /**
102
+ * 解压缩密码
103
+ */
104
+ outCompressPassword;
101
105
  /**
102
106
  * json字典
103
107
  */
@@ -942,7 +946,10 @@ let FastVueMultiHttp;
942
946
  }
943
947
  };
944
948
  let headers = FastVueMultiHttp.Simple.getFinalHeaders();
945
- if (config.outCompress) headers["out-compress"] = true;
949
+ if (config.outCompress) {
950
+ headers["out-compress"] = config.outCompress;
951
+ headers["Accept-Encoding"] = "identity";
952
+ }
946
953
  if (config.shortJsonVersion > 0) headers["short-json"] = config.shortJsonVersion;
947
954
  if ((config.nativeHttp || FastVueMultiTool.PageConfig.getConfig("nativeHttp").toString() === "true") && !justFormData && FastVueNative.isNativeApp() && !FastVueMultiHttp.Simple.hasFileParam(params) && !FastVueMultiHttp.Simple.hasArrayParam(params)) FastVueNative.execute("http", [
948
955
  url,
@@ -961,10 +968,21 @@ let FastVueMultiHttp;
961
968
  requestThen(response);
962
969
  };
963
970
  let uint8Data = new Uint8Array(response.data);
964
- if (response.headers["fastchar-compress"] === "zstd") decompress(uint8Data).then((data) => {
965
- doReturn(new TextDecoder("utf-8").decode(data));
966
- }).catch(reject);
967
- else doReturn(new TextDecoder("utf-8").decode(uint8Data));
971
+ if (response.headers["fastchar-compress"] === "obfuscate") {
972
+ const unCompressData = new Uint8Array(uint8Data.length);
973
+ const password = new TextEncoder().encode(config.outCompressPassword);
974
+ const passwordLength = password.length;
975
+ for (let i = 0; i < uint8Data.length; i++) {
976
+ const k = password[i % passwordLength] & 255;
977
+ const posFactor = i & 255;
978
+ unCompressData[i] = (uint8Data[i] ^ k ^ posFactor) & 255;
979
+ }
980
+ const decoder = new ZSTDDecoder();
981
+ decoder.init().then(() => {
982
+ const decompressedArray = decoder.decode(unCompressData);
983
+ doReturn(new TextDecoder("utf-8").decode(decompressedArray));
984
+ }).catch(reject);
985
+ } else doReturn(new TextDecoder("utf-8").decode(uint8Data));
968
986
  }).catch(function(error) {
969
987
  console.error(error);
970
988
  FastVueMultiDB.removeValue(cacheKey);
@@ -979,8 +997,8 @@ let FastVueMultiHttp;
979
997
  for (let key in config.shortJsonDictionary) {
980
998
  let info = config.shortJsonDictionary[key];
981
999
  if (!info.value) continue;
982
- newJsonString = newJsonString.replaceAll(new RegExp(`"${info.value}"`, "g"), `"${key}"`);
983
- newJsonString = newJsonString.replaceAll(new RegExp(`<${info.value}>`, "g"), key);
1000
+ newJsonString = newJsonString.replaceAll(`"${info.value}":`, `"${key}":`);
1001
+ newJsonString = newJsonString.replaceAll(`@${info.value}>`, key);
984
1002
  }
985
1003
  return newJsonString;
986
1004
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-vue-multi-pages-vite",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "author": "janesen",
5
5
  "description": "Vite-快速搭建VUE项目工具类的基本库,主要用于多个页面独立生成html",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "vconsole": "^3.15.1",
47
47
  "wavesurfer.js": "^7.9.4",
48
48
  "lz-string": "^1.5.0",
49
- "@structured-world/structured-zstd": "^0.0.49"
49
+ "zstddec": "^0.2.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^24.8.1",