@@ -4,6 +4,7 @@ import SettingCard from '@renderer/components/base/base-setting-card'
4
4
import SettingItem from '@renderer/components/base/base-setting-item'
5
5
import { useAppConfig } from '@renderer/hooks/use-app-config'
6
6
import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-config'
7
+ import { platform } from '@renderer/utils/init'
7
8
import { patchMihomoConfig , restartCore } from '@renderer/utils/ipc'
8
9
import React , { useState } from 'react'
9
10
@@ -24,10 +25,18 @@ const Mihomo: React.FC = () => {
24
25
'find-process-mode' : mode = 'strict' ,
25
26
'allow-lan' : lan ,
26
27
'unified-delay' : delay ,
27
- 'mixed-port' : mixedPort = 7890
28
+ 'mixed-port' : mixedPort = 7890 ,
29
+ 'socks-port' : socksPort = 7891 ,
30
+ port : httpPort = 7892 ,
31
+ 'redir-port' : redirPort = 0 ,
32
+ 'tproxy-port' : tproxyPort = 0
28
33
} = controledMihomoConfig || { }
29
34
30
35
const [ mixedPortInput , setMixedPortInput ] = useState ( mixedPort )
36
+ const [ socksPortInput , setSocksPortInput ] = useState ( socksPort )
37
+ const [ httpPortInput , setHttpPortInput ] = useState ( httpPort )
38
+ const [ redirPortInput , setRedirPortInput ] = useState ( redirPort )
39
+ const [ tproxyPortInput , setTproxyPortInput ] = useState ( tproxyPort )
31
40
const [ externalControllerInput , setExternalControllerInput ] = useState ( externalController )
32
41
const [ secretInput , setSecretInput ] = useState ( secret )
33
42
@@ -86,6 +95,122 @@ const Mihomo: React.FC = () => {
86
95
/>
87
96
</ div >
88
97
</ SettingItem >
98
+ < SettingItem title = "Socks端口" divider >
99
+ < div className = "flex" >
100
+ { socksPortInput !== socksPort && (
101
+ < Button
102
+ size = "sm"
103
+ color = "primary"
104
+ className = "mr-2"
105
+ onPress = { ( ) => {
106
+ onChangeNeedRestart ( { 'socks-port' : socksPortInput } )
107
+ } }
108
+ >
109
+ 确认
110
+ </ Button >
111
+ ) }
112
+
113
+ < Input
114
+ size = "sm"
115
+ type = "number"
116
+ className = "w-[100px]"
117
+ value = { socksPortInput . toString ( ) }
118
+ max = { 65535 }
119
+ min = { 0 }
120
+ onValueChange = { ( v ) => {
121
+ setSocksPortInput ( parseInt ( v ) )
122
+ } }
123
+ />
124
+ </ div >
125
+ </ SettingItem >
126
+ < SettingItem title = "Http端口" divider >
127
+ < div className = "flex" >
128
+ { httpPortInput !== httpPort && (
129
+ < Button
130
+ size = "sm"
131
+ color = "primary"
132
+ className = "mr-2"
133
+ onPress = { ( ) => {
134
+ onChangeNeedRestart ( { port : httpPortInput } )
135
+ } }
136
+ >
137
+ 确认
138
+ </ Button >
139
+ ) }
140
+
141
+ < Input
142
+ size = "sm"
143
+ type = "number"
144
+ className = "w-[100px]"
145
+ value = { httpPortInput . toString ( ) }
146
+ max = { 65535 }
147
+ min = { 0 }
148
+ onValueChange = { ( v ) => {
149
+ setHttpPortInput ( parseInt ( v ) )
150
+ } }
151
+ />
152
+ </ div >
153
+ </ SettingItem >
154
+ { platform !== 'win32' && (
155
+ < SettingItem title = "Redir端口" divider >
156
+ < div className = "flex" >
157
+ { redirPortInput !== redirPort && (
158
+ < Button
159
+ size = "sm"
160
+ color = "primary"
161
+ className = "mr-2"
162
+ onPress = { ( ) => {
163
+ onChangeNeedRestart ( { 'redir-port' : redirPortInput } )
164
+ } }
165
+ >
166
+ 确认
167
+ </ Button >
168
+ ) }
169
+
170
+ < Input
171
+ size = "sm"
172
+ type = "number"
173
+ className = "w-[100px]"
174
+ value = { redirPortInput . toString ( ) }
175
+ max = { 65535 }
176
+ min = { 0 }
177
+ onValueChange = { ( v ) => {
178
+ setRedirPortInput ( parseInt ( v ) )
179
+ } }
180
+ />
181
+ </ div >
182
+ </ SettingItem >
183
+ ) }
184
+ { platform === 'linux' && (
185
+ < SettingItem title = "TProxy端口" divider >
186
+ < div className = "flex" >
187
+ { tproxyPortInput !== tproxyPort && (
188
+ < Button
189
+ size = "sm"
190
+ color = "primary"
191
+ className = "mr-2"
192
+ onPress = { ( ) => {
193
+ onChangeNeedRestart ( { 'tproxy-port' : tproxyPortInput } )
194
+ } }
195
+ >
196
+ 确认
197
+ </ Button >
198
+ ) }
199
+
200
+ < Input
201
+ size = "sm"
202
+ type = "number"
203
+ className = "w-[100px]"
204
+ value = { tproxyPortInput . toString ( ) }
205
+ max = { 65535 }
206
+ min = { 0 }
207
+ onValueChange = { ( v ) => {
208
+ setTproxyPortInput ( parseInt ( v ) )
209
+ } }
210
+ />
211
+ </ div >
212
+ </ SettingItem >
213
+ ) }
89
214
< SettingItem title = "外部控制" divider >
90
215
< div className = "flex" >
91
216
{ externalControllerInput !== externalController && (
@@ -127,6 +252,7 @@ const Mihomo: React.FC = () => {
127
252
128
253
< Input
129
254
size = "sm"
255
+ type = "password"
130
256
value = { secretInput }
131
257
onValueChange = { ( v ) => {
132
258
setSecretInput ( v )
0 commit comments