File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -2150,7 +2150,7 @@ Inbound.TrojanSettings.Fallback = class extends XrayCommonClass {
21502150Inbound . ShadowsocksSettings = class extends Inbound . Settings {
21512151 constructor ( protocol ,
21522152 method = SSMethods . BLAKE3_AES_256_GCM ,
2153- password = RandomUtil . randomShadowsocksPassword ( ) ,
2153+ password = '' ,
21542154 network = 'tcp,udp' ,
21552155 shadowsockses = [ new Inbound . ShadowsocksSettings . Shadowsocks ( ) ] ,
21562156 ivCheck = false ,
@@ -2188,7 +2188,7 @@ Inbound.ShadowsocksSettings = class extends Inbound.Settings {
21882188Inbound . ShadowsocksSettings . Shadowsocks = class extends XrayCommonClass {
21892189 constructor (
21902190 method = '' ,
2191- password = RandomUtil . randomShadowsocksPassword ( ) ,
2191+ password = '' ,
21922192 email = RandomUtil . randomLowerAndNum ( 8 ) ,
21932193 limitIp = 0 ,
21942194 totalGB = 0 ,
Original file line number Diff line number Diff line change @@ -138,8 +138,14 @@ class RandomUtil {
138138 }
139139 }
140140
141- static randomShadowsocksPassword ( ) {
142- const array = new Uint8Array ( 32 ) ;
141+ static randomShadowsocksPassword ( method = SSMethods . BLAKE3_AES_256_GCM ) {
142+ let length = 32 ;
143+
144+ if ( [ SSMethods . BLAKE3_AES_128_GCM ] . includes ( method ) ) {
145+ length = 16 ;
146+ }
147+
148+ const array = new Uint8Array ( length ) ;
143149
144150 window . crypto . getRandomValues ( array ) ;
145151
Original file line number Diff line number Diff line change 2222 < span > {{ i18n "reset" }}</ span >
2323 </ template >
2424 {{ i18n "password" }}
25- < a-icon v-if ="inbound.protocol === Protocols.SHADOWSOCKS "@click ="client.password = RandomUtil.randomShadowsocksPassword() " type ="sync "> </ a-icon >
25+ < a-icon v-if ="inbound.protocol === Protocols.SHADOWSOCKS " @click ="client.password = RandomUtil.randomShadowsocksPassword(inbound.settings.method ) " type ="sync "> </ a-icon >
2626 < a-icon v-if ="inbound.protocol === Protocols.TROJAN " @click ="client.password = RandomUtil.randomSeq(10) "type ="sync "> </ a-icon >
2727 </ a-tooltip >
2828 </ template >
Original file line number Diff line number Diff line change 3131 < a-tooltip >
3232 < template slot ="title ">
3333 < span > {{ i18n "reset" }}</ span >
34- </ template > Password < a-icon @click ="inbound.settings.password = RandomUtil.randomShadowsocksPassword() " type ="sync "> </ a-icon >
34+ </ template > Password < a-icon @click ="inbound.settings.password = RandomUtil.randomShadowsocksPassword(inbound.settings.method ) " type ="sync "> </ a-icon >
3535 </ a-tooltip >
3636 </ template >
3737 < a-input v-model.trim ="inbound.settings.password "> </ a-input >
You can’t perform that action at this time.
0 commit comments