hifun-tools 1.4.8 → 1.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,7 +120,9 @@ export function filterSmartLines(tenantList, lineList, groupType, tenant) {
120
120
  if (groupType)
121
121
  filtered = filtered.filter((item) => item.lineGroup === groupType);
122
122
  const lines = filtered.map((item) => toStandardUrl(item.line));
123
- return lineList.map(toStandardUrl).filter((v) => isDomainMatch(lines, v));
123
+ return lineList
124
+ .map(toStandardUrl)
125
+ .filter((v) => isDomainMatch(lines.map(toStandardUrl), v));
124
126
  }
125
127
  /** 并发测速获取最佳 URL(限制超时和并发) */
126
128
  export async function getOptimalDecodedString(arr, options) {
@@ -147,7 +149,7 @@ export async function getOptimalDecodedString(arr, options) {
147
149
  controller.abort();
148
150
  failedUrls.push(url);
149
151
  }, 3000);
150
- fetch(`${toStandardUrl(url)}/health?t=${Date.now()}`, {
152
+ fetch(`${toStandardUrl(url)}/actuator-security/health?t=${Date.now()}`, {
151
153
  signal: controller.signal,
152
154
  })
153
155
  .then(() => {
@@ -2,6 +2,7 @@
2
2
  import md5 from "md5";
3
3
  import { Local, getParams, isMobile } from "../utils/index";
4
4
  import { HF } from "../init";
5
+ import { VERSION } from "../version";
5
6
  /**
6
7
  * 错误类型区分
7
8
  */
@@ -53,20 +54,6 @@ const globalConfig = {
53
54
  errorInterceptors: [],
54
55
  debug: false,
55
56
  };
56
- /** 导出用于设置全局配置的 API(在 app 启动处调用) */
57
- export function setHttpClientConfig(cfg) {
58
- Object.assign(globalConfig, cfg);
59
- }
60
- /** 导出注册拦截器方便使用 */
61
- export function useRequestInterceptor(fn) {
62
- globalConfig.requestInterceptors.push(fn);
63
- }
64
- export function useResponseInterceptor(fn) {
65
- globalConfig.responseInterceptors.push(fn);
66
- }
67
- export function useErrorInterceptor(fn) {
68
- globalConfig.errorInterceptors.push(fn);
69
- }
70
57
  /** 缓存(简单实现:sessionStorage,key = url+params md5;value 存储 { ts, ttl, data }) */
71
58
  function cacheKeyFor(url, params) {
72
59
  try {
@@ -105,6 +92,20 @@ function getCache(key) {
105
92
  return null;
106
93
  }
107
94
  }
95
+ /** 导出用于设置全局配置的 API(在 app 启动处调用) */
96
+ export function setHttpClientConfig(cfg) {
97
+ Object.assign(globalConfig, cfg);
98
+ }
99
+ /** 导出注册拦截器方便使用 */
100
+ export function useRequestInterceptor(fn) {
101
+ globalConfig.requestInterceptors.push(fn);
102
+ }
103
+ export function useResponseInterceptor(fn) {
104
+ globalConfig.responseInterceptors.push(fn);
105
+ }
106
+ export function useErrorInterceptor(fn) {
107
+ globalConfig.errorInterceptors.push(fn);
108
+ }
108
109
  /** 生成或获取 UDID */
109
110
  export async function generateUdid() {
110
111
  const udidFromUrl = getParams("udid");
@@ -166,12 +167,8 @@ export async function HttpServer(endpoint, params = {}, method = "GET", options
166
167
  const baseFields = {
167
168
  language: lang,
168
169
  timestamp,
169
- currentUserAppVersion: "2.0.5",
170
- channel: "",
171
- version: "1.0.0",
170
+ version: VERSION,
172
171
  os: isMobile() ? "5" : "6",
173
- platForm: isMobile() ? "h5" : "pc",
174
- deviceType: "1",
175
172
  udid,
176
173
  };
177
174
  const sign = globalConfig.signFn
@@ -0,0 +1 @@
1
+ export declare const VERSION = "1.4.9";
@@ -0,0 +1 @@
1
+ export const VERSION = "1.4.9";
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "name": "hifun-tools",
3
- "version": "1.4.8",
4
- "main": "dist/index.js",
5
- "module": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "publishConfig": {
8
- "access": "public"
9
- },
10
- "scripts": {
11
- "build": "tsc",
12
- "pub": "npm run build && npm version patch && npm publish --access public",
13
- "test": "jest",
14
- "test:watch": "jest --watch"
15
- },
16
- "files": [
17
- "dist"
18
- ],
19
- "devDependencies": {
20
- "@babel/core": "^7.28.5",
21
- "@babel/preset-typescript": "^7.28.5",
22
- "@types/jest": "^30.0.0",
23
- "jest": "^30.2.0",
24
- "jest-environment-jsdom": "^30.2.0",
25
- "jscodeshift": "^17.3.0",
26
- "prettier": "^3.6.2",
27
- "ts-jest": "^29.4.5",
28
- "typescript": "^5.6.3"
29
- },
30
- "dependencies": {
31
- "crypto-js": "^4.2.0",
32
- "md5": "^2.3.0"
33
- }
34
- }
1
+ {
2
+ "name": "hifun-tools",
3
+ "version": "1.4.10",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "scripts": {
11
+ "build": "node scripts/generate-version.js && tsc",
12
+ "pub": "npm run build && npm version patch && npm publish --access public",
13
+ "test": "jest",
14
+ "test:watch": "jest --watch"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "devDependencies": {
20
+ "@babel/core": "^7.28.5",
21
+ "@babel/preset-typescript": "^7.28.5",
22
+ "@types/jest": "^30.0.0",
23
+ "jest": "^30.2.0",
24
+ "jest-environment-jsdom": "^30.2.0",
25
+ "jscodeshift": "^17.3.0",
26
+ "prettier": "^3.6.2",
27
+ "ts-jest": "^29.4.5",
28
+ "typescript": "^5.6.3"
29
+ },
30
+ "dependencies": {
31
+ "crypto-js": "^4.2.0",
32
+ "md5": "^2.3.0"
33
+ }
34
+ }