dsh-plugin-console-oh 0.0.0-stage → 0.6.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/README.md +80 -2
- package/cordis.patch.yml +16 -0
- package/lib/client.js +451 -0
- package/lib/index.js +1358 -0
- package/lib/server.mjs +681 -0
- package/lib/tunnel.mjs +238 -0
- package/lib/vendor/README.md +11 -0
- package/lib/vendor/dijkstrajs/LICENSE.md +19 -0
- package/lib/vendor/dijkstrajs/index.js +165 -0
- package/lib/vendor/dijkstrajs/package.json +5 -0
- package/lib/vendor/qrcode/LICENSE +10 -0
- package/lib/vendor/qrcode/core/alignment-pattern.js +83 -0
- package/lib/vendor/qrcode/core/alphanumeric-data.js +59 -0
- package/lib/vendor/qrcode/core/bit-buffer.js +37 -0
- package/lib/vendor/qrcode/core/bit-matrix.js +65 -0
- package/lib/vendor/qrcode/core/byte-data.js +30 -0
- package/lib/vendor/qrcode/core/error-correction-code.js +135 -0
- package/lib/vendor/qrcode/core/error-correction-level.js +50 -0
- package/lib/vendor/qrcode/core/finder-pattern.js +22 -0
- package/lib/vendor/qrcode/core/format-info.js +29 -0
- package/lib/vendor/qrcode/core/galois-field.js +69 -0
- package/lib/vendor/qrcode/core/kanji-data.js +54 -0
- package/lib/vendor/qrcode/core/mask-pattern.js +234 -0
- package/lib/vendor/qrcode/core/mode.js +167 -0
- package/lib/vendor/qrcode/core/numeric-data.js +43 -0
- package/lib/vendor/qrcode/core/polynomial.js +62 -0
- package/lib/vendor/qrcode/core/qrcode.js +495 -0
- package/lib/vendor/qrcode/core/reed-solomon-encoder.js +56 -0
- package/lib/vendor/qrcode/core/regex.js +31 -0
- package/lib/vendor/qrcode/core/segments.js +330 -0
- package/lib/vendor/qrcode/core/utils.js +63 -0
- package/lib/vendor/qrcode/core/version-check.js +9 -0
- package/lib/vendor/qrcode/core/version.js +163 -0
- package/lib/vendor/qrcode/index.js +20 -0
- package/lib/vendor/qrcode/package.json +5 -0
- package/lib/vendor/qrcode/renderer/svg-tag.js +81 -0
- package/lib/vendor/qrcode/renderer/utils.js +99 -0
- package/package.json +64 -4
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
function hex2rgba (hex) {
|
|
2
|
+
if (typeof hex === 'number') {
|
|
3
|
+
hex = hex.toString()
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
if (typeof hex !== 'string') {
|
|
7
|
+
throw new Error('Color should be defined as hex string')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let hexCode = hex.slice().replace('#', '').split('')
|
|
11
|
+
if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
|
|
12
|
+
throw new Error('Invalid hex color: ' + hex)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Convert from short to long form (fff -> ffffff)
|
|
16
|
+
if (hexCode.length === 3 || hexCode.length === 4) {
|
|
17
|
+
hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {
|
|
18
|
+
return [c, c]
|
|
19
|
+
}))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Add default alpha value
|
|
23
|
+
if (hexCode.length === 6) hexCode.push('F', 'F')
|
|
24
|
+
|
|
25
|
+
const hexValue = parseInt(hexCode.join(''), 16)
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
r: (hexValue >> 24) & 255,
|
|
29
|
+
g: (hexValue >> 16) & 255,
|
|
30
|
+
b: (hexValue >> 8) & 255,
|
|
31
|
+
a: hexValue & 255,
|
|
32
|
+
hex: '#' + hexCode.slice(0, 6).join('')
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.getOptions = function getOptions (options) {
|
|
37
|
+
if (!options) options = {}
|
|
38
|
+
if (!options.color) options.color = {}
|
|
39
|
+
|
|
40
|
+
const margin = typeof options.margin === 'undefined' ||
|
|
41
|
+
options.margin === null ||
|
|
42
|
+
options.margin < 0
|
|
43
|
+
? 4
|
|
44
|
+
: options.margin
|
|
45
|
+
|
|
46
|
+
const width = options.width && options.width >= 21 ? options.width : undefined
|
|
47
|
+
const scale = options.scale || 4
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
width: width,
|
|
51
|
+
scale: width ? 4 : scale,
|
|
52
|
+
margin: margin,
|
|
53
|
+
color: {
|
|
54
|
+
dark: hex2rgba(options.color.dark || '#000000ff'),
|
|
55
|
+
light: hex2rgba(options.color.light || '#ffffffff')
|
|
56
|
+
},
|
|
57
|
+
type: options.type,
|
|
58
|
+
rendererOpts: options.rendererOpts || {}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
exports.getScale = function getScale (qrSize, opts) {
|
|
63
|
+
return opts.width && opts.width >= qrSize + opts.margin * 2
|
|
64
|
+
? opts.width / (qrSize + opts.margin * 2)
|
|
65
|
+
: opts.scale
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
exports.getImageWidth = function getImageWidth (qrSize, opts) {
|
|
69
|
+
const scale = exports.getScale(qrSize, opts)
|
|
70
|
+
return Math.floor((qrSize + opts.margin * 2) * scale)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
|
|
74
|
+
const size = qr.modules.size
|
|
75
|
+
const data = qr.modules.data
|
|
76
|
+
const scale = exports.getScale(size, opts)
|
|
77
|
+
const symbolSize = Math.floor((size + opts.margin * 2) * scale)
|
|
78
|
+
const scaledMargin = opts.margin * scale
|
|
79
|
+
const palette = [opts.color.light, opts.color.dark]
|
|
80
|
+
|
|
81
|
+
for (let i = 0; i < symbolSize; i++) {
|
|
82
|
+
for (let j = 0; j < symbolSize; j++) {
|
|
83
|
+
let posDst = (i * symbolSize + j) * 4
|
|
84
|
+
let pxColor = opts.color.light
|
|
85
|
+
|
|
86
|
+
if (i >= scaledMargin && j >= scaledMargin &&
|
|
87
|
+
i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
|
|
88
|
+
const iSrc = Math.floor((i - scaledMargin) / scale)
|
|
89
|
+
const jSrc = Math.floor((j - scaledMargin) / scale)
|
|
90
|
+
pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
imgData[posDst++] = pxColor.r
|
|
94
|
+
imgData[posDst++] = pxColor.g
|
|
95
|
+
imgData[posDst++] = pxColor.b
|
|
96
|
+
imgData[posDst] = pxColor.a
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-console-oh",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "DSH 控制台 · 电脑侧插件:局域网服务 + 6 位配对码 + 信任直连 + cloudflared 公网隧道,配套鸿蒙 App(HarmonyOS NEXT)远程使用桌面端 DSH。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"deepseek",
|
|
9
|
+
"deepseek-harness",
|
|
10
|
+
"harmonyos",
|
|
11
|
+
"remote-console",
|
|
12
|
+
"plugin"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.6"
|
|
18
|
+
},
|
|
19
|
+
"main": "lib/index.js",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./lib/index.js",
|
|
22
|
+
"./client": "./lib/client.js",
|
|
23
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"dsh": {
|
|
27
|
+
"bundle": {
|
|
28
|
+
"patch": "./cordis.patch.yml"
|
|
29
|
+
},
|
|
30
|
+
"client": {
|
|
31
|
+
"platform": "web",
|
|
32
|
+
"inject": [
|
|
33
|
+
"@deepseek-ai/dsh-client-locale",
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-settings"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@deepseek-ai/cordis": ">=4.0.1",
|
|
40
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.5",
|
|
41
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.5",
|
|
42
|
+
"react": "^18.2.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"@deepseek-ai/cordis": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"@deepseek-ai/dsh-client-locale": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-settings": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"react": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"lib/**",
|
|
60
|
+
"cordis.patch.yml",
|
|
61
|
+
"README.md"
|
|
62
|
+
],
|
|
63
|
+
"scripts": {
|
|
64
|
+
"test": "node test/selftest.mjs"
|
|
65
|
+
}
|
|
66
|
+
}
|