Skip to content

Commit 5284c62

Browse files
netuserclaude
andcommitted
Release 2.1.25: fix protocol blocking PR issues and bump version
- Fix protocol toggle revert logic with explicit oldForm snapshot - Use Switch size="sm" instead of className="scale-90" - Move protocol field validation to DTO binding tags (oneof=0 1) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d918367 commit 5284c62

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

.github/workflows/docker-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Push Images Based on Version
22

33
# 在这里定义统一版本号
44
env:
5-
VERSION: "2.1.24"
5+
VERSION: "2.1.25"
66

77
on:
88
push:

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ services:
2525
retries: 10
2626

2727
node-binary-init:
28-
image: 0xnetuser/node-binary:2.1.24
28+
image: 0xnetuser/node-binary:2.1.25
2929
container_name: node-binary-init
3030
volumes:
3131
- node_binary:/data/node
3232
restart: "no"
3333

3434
backend:
35-
image: 0xnetuser/go-backend:2.1.24
35+
image: 0xnetuser/go-backend:2.1.25
3636
container_name: go-backend
3737
restart: unless-stopped
3838
environment:
@@ -65,7 +65,7 @@ services:
6565
start_period: 10s
6666

6767
frontend:
68-
image: 0xnetuser/nextjs-frontend:2.1.24
68+
image: 0xnetuser/nextjs-frontend:2.1.25
6969
container_name: nextjs-frontend
7070
restart: unless-stopped
7171
ports:

go-backend/dto/node.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type NodeUpdateDto struct {
2323

2424
type NodeSetProtocolDto struct {
2525
ID int64 `json:"id" binding:"required"`
26-
Http int `json:"http"`
27-
Tls int `json:"tls"`
28-
Socks int `json:"socks"`
26+
Http int `json:"http" binding:"oneof=0 1"`
27+
Tls int `json:"tls" binding:"oneof=0 1"`
28+
Socks int `json:"socks" binding:"oneof=0 1"`
2929
}

go-backend/service/node.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,6 @@ func UpdateNode(d dto.NodeUpdateDto) dto.R {
208208
}
209209

210210
func SetNodeProtocol(d dto.NodeSetProtocolDto) dto.R {
211-
// Validate values
212-
if (d.Http != 0 && d.Http != 1) || (d.Tls != 0 && d.Tls != 1) || (d.Socks != 0 && d.Socks != 1) {
213-
return dto.Err("协议屏蔽值必须为 0 或 1")
214-
}
215-
216211
var node model.Node
217212
if err := DB.First(&node, d.ID).Error; err != nil {
218213
return dto.Err("节点不存在")

nextjs-frontend/app/(auth)/node/page.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export default function NodePage() {
158158

159159
const handleProtocolToggle = async (field: 'http' | 'tls' | 'socks', value: boolean) => {
160160
if (!editingNode) return;
161+
const oldForm = { ...protocolForm };
161162
const newForm = { ...protocolForm, [field]: value ? 1 : 0 };
162163
setProtocolForm(newForm);
163164
setProtocolSaving(true);
@@ -170,11 +171,11 @@ export default function NodePage() {
170171
));
171172
} else {
172173
toast.error(res.msg || t('node.protocolUpdateFailed'));
173-
setProtocolForm(protocolForm); // revert
174+
setProtocolForm(oldForm);
174175
}
175176
} catch {
176177
toast.error(t('node.protocolUpdateFailed'));
177-
setProtocolForm(protocolForm); // revert
178+
setProtocolForm(oldForm);
178179
} finally {
179180
setProtocolSaving(false);
180181
}
@@ -591,7 +592,7 @@ export default function NodePage() {
591592
<div className="flex items-center gap-6">
592593
<label className="flex items-center gap-2 text-sm">
593594
<Switch
594-
className="scale-90"
595+
size="sm"
595596
checked={protocolForm.http === 1}
596597
onCheckedChange={(v) => handleProtocolToggle('http', v)}
597598
disabled={protocolSaving}
@@ -600,7 +601,7 @@ export default function NodePage() {
600601
</label>
601602
<label className="flex items-center gap-2 text-sm">
602603
<Switch
603-
className="scale-90"
604+
size="sm"
604605
checked={protocolForm.tls === 1}
605606
onCheckedChange={(v) => handleProtocolToggle('tls', v)}
606607
disabled={protocolSaving}
@@ -609,7 +610,7 @@ export default function NodePage() {
609610
</label>
610611
<label className="flex items-center gap-2 text-sm">
611612
<Switch
612-
className="scale-90"
613+
size="sm"
613614
checked={protocolForm.socks === 1}
614615
onCheckedChange={(v) => handleProtocolToggle('socks', v)}
615616
disabled={protocolSaving}

nextjs-frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-frontend",
3-
"version": "2.1.24",
3+
"version": "2.1.25",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

0 commit comments

Comments
 (0)