n20-common-lib 2.9.81 → 2.9.82
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/package.json
CHANGED
|
@@ -17,14 +17,15 @@ async function disposeSign(config, p1, p2, p3) {
|
|
|
17
17
|
try {
|
|
18
18
|
// 如果是信安CA且在银河麒麟系统上,则使用国密签名
|
|
19
19
|
// 使用更可靠的系统和环境检测方法
|
|
20
|
-
if (
|
|
20
|
+
if (
|
|
21
|
+
config.type === 'inetSign' &&
|
|
21
22
|
// 检查操作系统
|
|
22
|
-
navigator.platform.toLowerCase().includes('linux') ||
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
23
|
+
(navigator.platform.toLowerCase().includes('linux') ||
|
|
24
|
+
navigator.userAgent.toLowerCase().includes('linux') ||
|
|
25
|
+
// 检查是否为银河麒麟特有的环境变量或特征
|
|
26
|
+
typeof window.KylinOS !== 'undefined' ||
|
|
27
|
+
document.documentElement.dataset.osType === 'kylin')
|
|
28
|
+
) {
|
|
28
29
|
// 确保CaMap中存在SkfSign配置
|
|
29
30
|
if (!CaMap['SkfSign']) {
|
|
30
31
|
console.warn('未找到SkfSign配置,将继续使用原始配置')
|
|
@@ -33,7 +34,8 @@ async function disposeSign(config, p1, p2, p3) {
|
|
|
33
34
|
config = CaMap['SkfSign']
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
const path =
|
|
37
|
+
const path =
|
|
38
|
+
typeof config.path === 'function' ? config.path(p3) : config.path
|
|
37
39
|
const module = await importG(config.type, () =>
|
|
38
40
|
import(/*webpackChunkName: "[request]"*/ `${path}`)
|
|
39
41
|
)
|
|
@@ -42,7 +44,7 @@ async function disposeSign(config, p1, p2, p3) {
|
|
|
42
44
|
await new Promise((resolve, reject) => {
|
|
43
45
|
module.availableSign((available) => {
|
|
44
46
|
available ? resolve() : reject(new Error('签名不可用'))
|
|
45
|
-
},
|
|
47
|
+
}, systemIdentification())
|
|
46
48
|
})
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -53,6 +55,19 @@ async function disposeSign(config, p1, p2, p3) {
|
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
function systemIdentification() {
|
|
59
|
+
const userAgent = navigator.userAgent || navigator.vendor || window.opera
|
|
60
|
+
let url = window.NetSignName || '/portal/NetSignCNG-v2.1.152.2.exe'
|
|
61
|
+
if (/windows/i.test(userAgent)) {
|
|
62
|
+
url = window.NetSignName
|
|
63
|
+
} else if (/linux/i.test(userAgent)) {
|
|
64
|
+
url = /Kylin/i.test(userAgent)
|
|
65
|
+
? window.KylinSignName || '/portal/NetSignCNG-v2.1.152.2.rpm' // 麒麟系统
|
|
66
|
+
: window.linuxSignName || '/portal/NetSignCNG-v2.1.152.2.deb' // 普通Linux
|
|
67
|
+
}
|
|
68
|
+
return url
|
|
69
|
+
}
|
|
70
|
+
|
|
56
71
|
/**
|
|
57
72
|
* 获取签名
|
|
58
73
|
* @param {*} p1 - 签名参数1
|