dsh-think-skin 1.1.0 → 1.1.1
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 +30 -0
- package/assets/screenshots/1-cover.png +0 -0
- package/assets/screenshots/2-settings.png +0 -0
- package/assets/screenshots/3-fish.png +0 -0
- package/assets/screenshots/4-jjfox.png +0 -0
- package/assets/screenshots/5-claude.png +0 -0
- package/assets/screenshots/6-music.png +0 -0
- package/index.js +49 -9
- package/package.json +3 -1
- package/screenshots.json +8 -0
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# dsh-think-skin
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
**Give the DSH thinking row your own face and your own words.**
|
|
4
6
|
|
|
5
7
|
The row that says `深度求索中,用时 3秒 ···` next to a whale tail is the one thing you look at
|
|
@@ -9,6 +11,23 @@ more than the answer. This replaces its icon and its copy, and keeps the timer.
|
|
|
9
11
|
|
|
10
12
|
▶ **[宣传片 · B 站](https://www.bilibili.com/video/BV1Layaz2Em7)** (1 分 45 秒,三套皮肤 + 安装全过程)
|
|
11
13
|
|
|
14
|
+
## Screenshots / 截图
|
|
15
|
+
|
|
16
|
+
**设置页** —— 套组卡片、字形(字符转圈)、文字渐变、音乐,都在这一页里。
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
**音乐池** —— 每个套组一个,每张图还能单独配;导入的音频会随套组 zip 一起走。
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
**三套皮肤的那一行** —— 图和句分开抽,同一任务跑两次不重样。
|
|
25
|
+
|
|
26
|
+
| 蓝色大肥鱼 | 酒狐 | ClaudeCode |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
|  |  |  |
|
|
29
|
+
|
|
30
|
+
|
|
12
31
|
---
|
|
13
32
|
|
|
14
33
|
## What it does
|
|
@@ -128,6 +147,17 @@ binary is recorded in [assets/ClaudeCode/FINDINGS.md](assets/ClaudeCode/FINDINGS
|
|
|
128
147
|
|
|
129
148
|
---
|
|
130
149
|
|
|
150
|
+
## Security / 安全
|
|
151
|
+
|
|
152
|
+
插件在 DSH 的 web server 上挂了 8 条路由(读写套组、上传图片与音乐、导出导入)。
|
|
153
|
+
每条都先过 DSH 自己的访问检查 `ctx.connection.requestRejection` ——
|
|
154
|
+
它要求请求来自**已认证的活跃 Peer**,跨站的网页过不去。
|
|
155
|
+
老版本 DSH 里没有这个服务时,退回同源的 `Sec-Fetch-Site` / `Origin` 判断。
|
|
156
|
+
|
|
157
|
+
导入套组那条 `POST /import` 会去下载用户给的 URL:只允许 http/https,
|
|
158
|
+
拒绝回环、内网、链路本地、CGNAT、`*.local`,跟随重定向后复查一次,
|
|
159
|
+
30 秒超时,192 MB 上限。
|
|
160
|
+
|
|
131
161
|
## Credits
|
|
132
162
|
|
|
133
163
|
- **Mechanism reference:** [`huanlinoto/dsh-plugin-prts-neuron`](https://github.com/huanlinoto/dsh-plugin-prts-neuron).
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -80,6 +80,38 @@ function originAllowed(get) {
|
|
|
80
80
|
return true
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* DSH 自己的访问检查:`ctx.connection.requestRejection` 走 Host/Origin 围栏,
|
|
85
|
+
* 并要求请求来自**已认证的活跃 Peer**。返回状态码表示拒绝,undefined 表示放行。
|
|
86
|
+
*
|
|
87
|
+
* 老版本 DSH 没有这个服务时退回上面的同源检查——不会比现在更宽。
|
|
88
|
+
*/
|
|
89
|
+
function requestRejection(context, request, get) {
|
|
90
|
+
let connection = null
|
|
91
|
+
try {
|
|
92
|
+
connection = context.connection
|
|
93
|
+
} catch {
|
|
94
|
+
connection = null
|
|
95
|
+
}
|
|
96
|
+
if (connection === undefined || connection === null) {
|
|
97
|
+
try {
|
|
98
|
+
if (typeof context.get === 'function') connection = context.get('connection')
|
|
99
|
+
} catch {
|
|
100
|
+
connection = null
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (connection !== undefined && connection !== null
|
|
104
|
+
&& typeof connection.requestRejection === 'function') {
|
|
105
|
+
try {
|
|
106
|
+
const status = connection.requestRejection(request)
|
|
107
|
+
return status === undefined || status === null ? undefined : status
|
|
108
|
+
} catch {
|
|
109
|
+
return 403
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return originAllowed(get) ? undefined : 403
|
|
113
|
+
}
|
|
114
|
+
|
|
83
115
|
/** 本机回环、内网、云元数据地址——导入下载器一律不碰。 */
|
|
84
116
|
function isPrivateHost(hostname) {
|
|
85
117
|
const host = String(hostname).toLowerCase().replace(/^\[|\]$/g, '')
|
|
@@ -404,9 +436,10 @@ export function apply(ctx) {
|
|
|
404
436
|
kind: 'prefix',
|
|
405
437
|
path: ROUTE,
|
|
406
438
|
async resource(request) {
|
|
407
|
-
|
|
439
|
+
const blocked = requestRejection(ctx, request, (name) => request.headers.get(name))
|
|
440
|
+
if (blocked !== undefined) {
|
|
408
441
|
return new Response('forbidden', {
|
|
409
|
-
status:
|
|
442
|
+
status: blocked,
|
|
410
443
|
headers: { 'content-type': 'text/plain; charset=utf-8' },
|
|
411
444
|
})
|
|
412
445
|
}
|
|
@@ -460,7 +493,8 @@ export function apply(ctx) {
|
|
|
460
493
|
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' })
|
|
461
494
|
res.end(message)
|
|
462
495
|
}
|
|
463
|
-
|
|
496
|
+
const blocked = requestRejection(ctx, req, (name) => req.headers[name])
|
|
497
|
+
if (blocked !== undefined) return fail(blocked, 'forbidden')
|
|
464
498
|
if (req.method !== 'POST') return fail(405, 'method not allowed')
|
|
465
499
|
try {
|
|
466
500
|
const patch = JSON.parse((await readBody(req, MAX_BODY)).toString('utf8'))
|
|
@@ -566,7 +600,8 @@ export function apply(ctx) {
|
|
|
566
600
|
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' })
|
|
567
601
|
res.end(message)
|
|
568
602
|
}
|
|
569
|
-
|
|
603
|
+
const blocked = requestRejection(ctx, req, (name) => req.headers[name])
|
|
604
|
+
if (blocked !== undefined) return fail(blocked, 'forbidden')
|
|
570
605
|
if (req.method !== 'POST') return fail(405, 'method not allowed')
|
|
571
606
|
try {
|
|
572
607
|
const body = JSON.parse((await readBody(req, MAX_BODY)).toString('utf8'))
|
|
@@ -630,7 +665,8 @@ export function apply(ctx) {
|
|
|
630
665
|
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' })
|
|
631
666
|
res.end(message)
|
|
632
667
|
}
|
|
633
|
-
|
|
668
|
+
const blocked = requestRejection(ctx, req, (name) => req.headers[name])
|
|
669
|
+
if (blocked !== undefined) return fail(blocked, 'forbidden')
|
|
634
670
|
if (req.method !== 'POST') return fail(405, 'method not allowed')
|
|
635
671
|
try {
|
|
636
672
|
const url = new URL(req.url, 'http://local')
|
|
@@ -730,7 +766,8 @@ export function apply(ctx) {
|
|
|
730
766
|
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' })
|
|
731
767
|
res.end(message)
|
|
732
768
|
}
|
|
733
|
-
|
|
769
|
+
const blocked = requestRejection(ctx, req, (name) => req.headers[name])
|
|
770
|
+
if (blocked !== undefined) return fail(blocked, 'forbidden')
|
|
734
771
|
if (req.method !== 'POST') return fail(405, 'method not allowed')
|
|
735
772
|
try {
|
|
736
773
|
const url = new URL(req.url, 'http://local')
|
|
@@ -805,7 +842,8 @@ export function apply(ctx) {
|
|
|
805
842
|
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' })
|
|
806
843
|
res.end(message)
|
|
807
844
|
}
|
|
808
|
-
|
|
845
|
+
const blocked = requestRejection(ctx, req, (name) => req.headers[name])
|
|
846
|
+
if (blocked !== undefined) return fail(blocked, 'forbidden')
|
|
809
847
|
if (req.method !== 'POST') return fail(405, 'method not allowed')
|
|
810
848
|
try {
|
|
811
849
|
const body = JSON.parse((await readBody(req, MAX_BODY)).toString('utf8'))
|
|
@@ -892,7 +930,8 @@ export function apply(ctx) {
|
|
|
892
930
|
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' })
|
|
893
931
|
res.end(message)
|
|
894
932
|
}
|
|
895
|
-
|
|
933
|
+
const blocked = requestRejection(ctx, req, (name) => req.headers[name])
|
|
934
|
+
if (blocked !== undefined) return fail(blocked, 'forbidden')
|
|
896
935
|
if (req.method !== 'POST') return fail(405, 'method not allowed')
|
|
897
936
|
try {
|
|
898
937
|
const body = JSON.parse((await readBody(req, MAX_BODY)).toString('utf8'))
|
|
@@ -1022,7 +1061,8 @@ export function apply(ctx) {
|
|
|
1022
1061
|
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' })
|
|
1023
1062
|
res.end(message)
|
|
1024
1063
|
}
|
|
1025
|
-
|
|
1064
|
+
const blocked = requestRejection(ctx, req, (name) => req.headers[name])
|
|
1065
|
+
if (blocked !== undefined) return fail(blocked, 'forbidden')
|
|
1026
1066
|
if (req.method !== 'POST') return fail(405, 'method not allowed')
|
|
1027
1067
|
let dir = null
|
|
1028
1068
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-think-skin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "把 DSH 的思考状态行换成你自己的图、自己的话:每张图带自己的文案池,逐字打出、高光扫过、渐变可调。支持套组导入导出与字符转圈。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
"tools/compile-pack.py",
|
|
43
43
|
"assets/texts",
|
|
44
44
|
"assets/music",
|
|
45
|
+
"assets/screenshots",
|
|
46
|
+
"screenshots.json",
|
|
45
47
|
"tools/export-texts.py",
|
|
46
48
|
"locale"
|
|
47
49
|
],
|