Compare commits

...

7 Commits

Author SHA1 Message Date
2dust
d016ab06d4 Merge pull request #973 from yuhan6665/new-storage-fix
New storage fix
2021-03-29 08:06:43 +08:00
yuhan6665
4d9aced5a4 Gson display to not escape HTML character like "=" 2021-03-28 11:34:41 -04:00
yuhan6665
62b928e6a0 Support Trojan flow and email 2021-03-28 11:34:34 -04:00
2dust
0ce60eae73 Update MainRecyclerAdapter.kt 2021-03-28 11:34:12 -04:00
2dust
5930a6a9eb Update V2rayConfig.kt 2021-03-28 11:34:01 -04:00
2dust
a360310be2 fix header type none 2021-03-28 11:33:51 -04:00
2dust
820e6cdf36 fix migration inbound port parsed as 0 2021-03-28 11:31:18 -04:00
4 changed files with 27 additions and 17 deletions

View File

@@ -99,6 +99,8 @@ data class V2rayConfig(
var password: String = "",
var port: Int = DEFAULT_PORT,
var level: Int = DEFAULT_LEVEL,
val email: String? = null,
val flow: String? = null,
var users: List<SocksUsersBean>? = null) {
@@ -172,8 +174,9 @@ data class V2rayConfig(
var sni = ""
network = transport
when (network) {
"tcp" -> if (headerType == HTTP) {
"tcp" -> {
val tcpSetting = TcpSettingsBean()
if (headerType == HTTP) {
tcpSetting.header.type = HTTP
if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(path)) {
val requestObj = TcpSettingsBean.HeaderBean.RequestBean()
@@ -182,6 +185,10 @@ data class V2rayConfig(
tcpSetting.header.request = requestObj
sni = requestObj.headers.Host.getOrNull(0) ?: sni
}
} else {
tcpSetting.header.type = "none"
sni = host ?: ""
}
tcpSettings = tcpSetting
}
"kcp" -> {
@@ -387,6 +394,7 @@ data class V2rayConfig(
fun toPrettyPrinting(): String {
return GsonBuilder()
.setPrettyPrinting()
.disableHtmlEscaping()
.registerTypeAdapter( // custom serialiser is needed here since JSON by default parse number as Double, core will fail to start
object : TypeToken<Double>() {}.type,
JsonSerializer { src: Double?, _: Type?, _: JsonSerializationContext? -> JsonPrimitive(src?.toInt()) }

View File

@@ -48,7 +48,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
if (holder is MainViewHolder) {
val guid = mActivity.mainViewModel.serverList.getOrNull(position) ?: return
val config = MmkvManager.decodeServerConfig(guid) ?: return
val outbound = config.getProxyOutbound() ?: return
val outbound = config.getProxyOutbound()
val aff = MmkvManager.decodeServerAffiliationInfo(guid)
holder.name.text = config.remarks
@@ -76,7 +76,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
} else {
holder.type.text = config.configType.name.toLowerCase()
}
holder.statistics.text = "${outbound.getServerAddress()} : ${outbound.getServerPort()}"
holder.statistics.text = "${outbound?.getServerAddress()} : ${outbound?.getServerPort()}"
holder.layout_share.setOnClickListener {
AlertDialog.Builder(mActivity).setItems(shareOptions.toTypedArray()) { _, i ->

View File

@@ -65,7 +65,7 @@ object AngConfigManager {
AppConfig.PREF_V2RAY_ROUTING_AGENT,
AppConfig.PREF_V2RAY_ROUTING_BLOCKED,
AppConfig.PREF_V2RAY_ROUTING_DIRECT,).forEach { key ->
settingsStorage?.encode(key, sharedPreferences.getString(key, ""))
settingsStorage?.encode(key, sharedPreferences.getString(key, null))
}
listOf(AppConfig.PREF_SPEED_ENABLED,
AppConfig.PREF_SNIFFING_ENABLED,

View File

@@ -5,6 +5,7 @@
<item>aes-128-gcm</item>
<item>auto</item>
<item>none</item>
<item>zero</item>
</string-array>
<string-array name="ss_securitys" translatable="false">
<item>aes-256-cfb</item>
@@ -98,6 +99,7 @@
<item>xtls-rprx-direct</item>
<item>xtls-rprx-direct-udp443</item>
<item>xtls-rprx-splice</item>
<item>xtls-rprx-splice-udp443</item>
</string-array>