@@ -19,16 +19,19 @@ public class Hysteria2Fmt : BaseFmt
1919 item . Address = url . IdnHost ;
2020 item . Port = url . Port ;
2121 item . Remarks = url . GetComponents ( UriComponents . Fragment , UriFormat . Unescaped ) ;
22- item . Id = Utils . UrlDecode ( url . UserInfo ) ;
22+ item . Password = Utils . UrlDecode ( url . UserInfo ) ;
2323
2424 var query = Utils . ParseQueryString ( url . Query ) ;
2525 ResolveUriQuery ( query , ref item ) ;
26- item . Path = GetQueryDecoded ( query , "obfs-password" ) ;
27- item . Ports = GetQueryDecoded ( query , "mport" ) ;
2826 if ( item . CertSha . IsNullOrEmpty ( ) )
2927 {
3028 item . CertSha = GetQueryDecoded ( query , "pinSHA256" ) ;
3129 }
30+ item . SetProtocolExtra ( item . GetProtocolExtra ( ) with
31+ {
32+ Ports = GetQueryDecoded ( query , "mport" ) ,
33+ SalamanderPass = GetQueryDecoded ( query , "obfs-password" ) ,
34+ } ) ;
3235
3336 return item ;
3437 }
@@ -49,15 +52,16 @@ public class Hysteria2Fmt : BaseFmt
4952 }
5053 var dicQuery = new Dictionary < string , string > ( ) ;
5154 ToUriQueryLite ( item , ref dicQuery ) ;
55+ var protocolExtraItem = item . GetProtocolExtra ( ) ;
5256
53- if ( item . Path . IsNotEmpty ( ) )
57+ if ( ! protocolExtraItem . SalamanderPass . IsNullOrEmpty ( ) )
5458 {
5559 dicQuery . Add ( "obfs" , "salamander" ) ;
56- dicQuery . Add ( "obfs-password" , Utils . UrlEncode ( item . Path ) ) ;
60+ dicQuery . Add ( "obfs-password" , Utils . UrlEncode ( protocolExtraItem . SalamanderPass ) ) ;
5761 }
58- if ( item . Ports . IsNotEmpty ( ) )
62+ if ( ! protocolExtraItem . Ports . IsNullOrEmpty ( ) )
5963 {
60- dicQuery . Add ( "mport" , Utils . UrlEncode ( item . Ports . Replace ( ':' , '-' ) ) ) ;
64+ dicQuery . Add ( "mport" , Utils . UrlEncode ( protocolExtraItem . Ports . Replace ( ':' , '-' ) ) ) ;
6165 }
6266 if ( ! item . CertSha . IsNullOrEmpty ( ) )
6367 {
@@ -70,7 +74,7 @@ public class Hysteria2Fmt : BaseFmt
7074 dicQuery . Add ( "pinSHA256" , Utils . UrlEncode ( sha ) ) ;
7175 }
7276
73- return ToUri ( EConfigType . Hysteria2 , item . Address , item . Port , item . Id , dicQuery , remark ) ;
77+ return ToUri ( EConfigType . Hysteria2 , item . Address , item . Port , item . Password , dicQuery , remark ) ;
7478 }
7579
7680 public static ProfileItem ? ResolveFull2 ( string strData , string ? subRemarks )
0 commit comments