Bug fix
This commit is contained in:
@@ -256,7 +256,7 @@ data class V2rayConfig(
|
||||
}
|
||||
} else {
|
||||
tcpSetting.header.type = "none"
|
||||
sni = host .orEmpty()
|
||||
sni = host.orEmpty()
|
||||
}
|
||||
tcpSettings = tcpSetting
|
||||
}
|
||||
@@ -272,21 +272,21 @@ data class V2rayConfig(
|
||||
}
|
||||
"ws" -> {
|
||||
val wssetting = WsSettingsBean()
|
||||
wssetting.headers.Host = host .orEmpty()
|
||||
wssetting.headers.Host = host.orEmpty()
|
||||
sni = wssetting.headers.Host
|
||||
wssetting.path = path ?: "/"
|
||||
wsSettings = wssetting
|
||||
}
|
||||
"httpupgrade" -> {
|
||||
val httpupgradeSetting = HttpupgradeSettingsBean()
|
||||
httpupgradeSetting.host = host .orEmpty()
|
||||
httpupgradeSetting.host = host.orEmpty()
|
||||
sni = httpupgradeSetting.host
|
||||
httpupgradeSetting.path = path ?: "/"
|
||||
httpupgradeSettings = httpupgradeSetting
|
||||
}
|
||||
"splithttp" -> {
|
||||
val splithttpSetting = SplithttpSettingsBean()
|
||||
splithttpSetting.host = host .orEmpty()
|
||||
splithttpSetting.host = host.orEmpty()
|
||||
sni = splithttpSetting.host
|
||||
splithttpSetting.path = path ?: "/"
|
||||
splithttpSettings = splithttpSetting
|
||||
@@ -302,18 +302,18 @@ data class V2rayConfig(
|
||||
"quic" -> {
|
||||
val quicsetting = QuicSettingBean()
|
||||
quicsetting.security = quicSecurity ?: "none"
|
||||
quicsetting.key = key .orEmpty()
|
||||
quicsetting.key = key.orEmpty()
|
||||
quicsetting.header.type = headerType ?: "none"
|
||||
quicSettings = quicsetting
|
||||
}
|
||||
"grpc" -> {
|
||||
val grpcSetting = GrpcSettingsBean()
|
||||
grpcSetting.multiMode = mode == "multi"
|
||||
grpcSetting.serviceName = serviceName .orEmpty()
|
||||
grpcSetting.authority = authority .orEmpty()
|
||||
grpcSetting.serviceName = serviceName.orEmpty()
|
||||
grpcSetting.authority = authority.orEmpty()
|
||||
grpcSetting.idle_timeout = 60
|
||||
grpcSetting.health_check_timeout = 20
|
||||
sni = authority .orEmpty()
|
||||
sni = authority.orEmpty()
|
||||
grpcSettings = grpcSetting
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ data class V2rayConfig(
|
||||
"grpc" -> {
|
||||
val grpcSetting = streamSettings?.grpcSettings ?: return null
|
||||
listOf(if (grpcSetting.multiMode == true) "multi" else "gun",
|
||||
grpcSetting.authority .orEmpty(),
|
||||
grpcSetting.authority.orEmpty(),
|
||||
grpcSetting.serviceName)
|
||||
}
|
||||
else -> null
|
||||
|
||||
@@ -54,7 +54,7 @@ val URLConnection.responseLength: Long
|
||||
}
|
||||
|
||||
val URI.idnHost: String
|
||||
get() = host?.replace("[", "")?.replace("]", "") .orEmpty()
|
||||
get() = host?.replace("[", "")?.replace("]", "").orEmpty()
|
||||
|
||||
fun String.removeWhiteSpace(): String = replace("\\s+".toRegex(), "")
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
|
||||
|
||||
holder.itemMainBinding.tvName.text = profile.remarks
|
||||
holder.itemView.setBackgroundColor(Color.TRANSPARENT)
|
||||
holder.itemMainBinding.tvTestResult.text = aff?.getTestDelayString() .orEmpty()
|
||||
holder.itemMainBinding.tvTestResult.text = aff?.getTestDelayString().orEmpty()
|
||||
if ((aff?.testDelayMillis ?: 0L) < 0L) {
|
||||
holder.itemMainBinding.tvTestResult.setTextColor(ContextCompat.getColor(mActivity, R.color.colorPingRed))
|
||||
} else {
|
||||
@@ -95,7 +95,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
|
||||
}
|
||||
}
|
||||
|
||||
val strState = "${profile?.server?.dropLast(3)}*** : ${profile?.serverPort .orEmpty()}"
|
||||
val strState = "${profile?.server?.dropLast(3)}*** : ${profile?.serverPort}"
|
||||
|
||||
holder.itemMainBinding.tvStatistics.text = strState
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ class UrlSchemeActivity : BaseActivity() {
|
||||
when (data?.host) {
|
||||
"install-config" -> {
|
||||
val uri: Uri? = intent.data
|
||||
val shareUrl = uri?.getQueryParameter("url") .orEmpty()
|
||||
val shareUrl = uri?.getQueryParameter("url").orEmpty()
|
||||
parseUri(shareUrl, uri?.fragment)
|
||||
}
|
||||
|
||||
"install-sub" -> {
|
||||
val uri: Uri? = intent.data
|
||||
val shareUrl = uri?.getQueryParameter("url") .orEmpty()
|
||||
val shareUrl = uri?.getQueryParameter("url").orEmpty()
|
||||
parseUri(shareUrl, uri?.fragment)
|
||||
}
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ object AngConfigManager {
|
||||
val removedSelectedServer =
|
||||
if (!TextUtils.isEmpty(subid) && !append) {
|
||||
MmkvManager.decodeServerConfig(
|
||||
mainStorage?.decodeString(KEY_SELECTED_SERVER) .orEmpty()
|
||||
mainStorage?.decodeString(KEY_SELECTED_SERVER).orEmpty()
|
||||
)?.let {
|
||||
if (it.subscriptionId == subid) {
|
||||
return@let it
|
||||
|
||||
@@ -97,7 +97,7 @@ object Utils {
|
||||
* base64 decode
|
||||
*/
|
||||
fun decode(text: String?): String {
|
||||
return tryDecodeBase64(text) ?: text?.trimEnd('=')?.let { tryDecodeBase64(it) } .orEmpty()
|
||||
return tryDecodeBase64(text) ?: text?.trimEnd('=')?.let { tryDecodeBase64(it) }.orEmpty()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ object ShadowsocksFmt {
|
||||
}
|
||||
if ("tls" in queryPairs) {
|
||||
config.outboundBean?.streamSettings?.populateTlsSettings(
|
||||
"tls", false, sni .orEmpty(), null, null, null, null, null
|
||||
"tls", false, sni.orEmpty(), null, null, null, null, null
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -55,19 +55,19 @@ object TrojanFmt {
|
||||
queryParam["serviceName"],
|
||||
queryParam["authority"]
|
||||
)
|
||||
fingerprint = queryParam["fp"] .orEmpty()
|
||||
fingerprint = queryParam["fp"].orEmpty()
|
||||
allowInsecure = if ((queryParam["allowInsecure"] .orEmpty()) == "1") true else allowInsecure
|
||||
config.outboundBean?.streamSettings?.populateTlsSettings(
|
||||
queryParam["security"] ?: V2rayConfig.TLS,
|
||||
allowInsecure,
|
||||
queryParam["sni"] ?: sni .orEmpty(),
|
||||
queryParam["sni"] ?: sni.orEmpty(),
|
||||
fingerprint,
|
||||
queryParam["alpn"],
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
flow = queryParam["flow"] .orEmpty()
|
||||
flow = queryParam["flow"].orEmpty()
|
||||
}
|
||||
config.outboundBean?.settings?.servers?.get(0)?.let { server ->
|
||||
server.address = uri.idnHost
|
||||
@@ -102,13 +102,13 @@ object TrojanFmt {
|
||||
Utils.removeWhiteSpace(tlsSetting.alpn.joinToString()).orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.fingerprint)) {
|
||||
dicQuery["fp"] = tlsSetting.fingerprint .orEmpty()
|
||||
dicQuery["fp"] = tlsSetting.fingerprint.orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.publicKey)) {
|
||||
dicQuery["pbk"] = tlsSetting.publicKey .orEmpty()
|
||||
dicQuery["pbk"] = tlsSetting.publicKey.orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.shortId)) {
|
||||
dicQuery["sid"] = tlsSetting.shortId .orEmpty()
|
||||
dicQuery["sid"] = tlsSetting.shortId.orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.spiderX)) {
|
||||
dicQuery["spx"] = Utils.urlEncode(tlsSetting.spiderX .orEmpty())
|
||||
|
||||
@@ -36,7 +36,7 @@ object VlessFmt {
|
||||
vnext.port = uri.port
|
||||
vnext.users[0].id = uri.userInfo
|
||||
vnext.users[0].encryption = queryParam["encryption"] ?: "none"
|
||||
vnext.users[0].flow = queryParam["flow"] .orEmpty()
|
||||
vnext.users[0].flow = queryParam["flow"].orEmpty()
|
||||
}
|
||||
|
||||
val sni = streamSetting.populateTransportSettings(
|
||||
@@ -53,14 +53,14 @@ object VlessFmt {
|
||||
)
|
||||
allowInsecure = if ((queryParam["allowInsecure"] .orEmpty()) == "1") true else allowInsecure
|
||||
streamSetting.populateTlsSettings(
|
||||
queryParam["security"] .orEmpty(),
|
||||
queryParam["security"].orEmpty(),
|
||||
allowInsecure,
|
||||
queryParam["sni"] ?: sni,
|
||||
queryParam["fp"] .orEmpty(),
|
||||
queryParam["fp"].orEmpty(),
|
||||
queryParam["alpn"],
|
||||
queryParam["pbk"] .orEmpty(),
|
||||
queryParam["sid"] .orEmpty(),
|
||||
queryParam["spx"] .orEmpty()
|
||||
queryParam["pbk"].orEmpty(),
|
||||
queryParam["sid"].orEmpty(),
|
||||
queryParam["spx"].orEmpty()
|
||||
)
|
||||
|
||||
return config
|
||||
@@ -93,13 +93,13 @@ object VlessFmt {
|
||||
Utils.removeWhiteSpace(tlsSetting.alpn.joinToString()).orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.fingerprint)) {
|
||||
dicQuery["fp"] = tlsSetting.fingerprint .orEmpty()
|
||||
dicQuery["fp"] = tlsSetting.fingerprint.orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.publicKey)) {
|
||||
dicQuery["pbk"] = tlsSetting.publicKey .orEmpty()
|
||||
dicQuery["pbk"] = tlsSetting.publicKey.orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.shortId)) {
|
||||
dicQuery["sid"] = tlsSetting.shortId .orEmpty()
|
||||
dicQuery["sid"] = tlsSetting.shortId.orEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(tlsSetting.spiderX)) {
|
||||
dicQuery["spx"] = Utils.urlEncode(tlsSetting.spiderX .orEmpty())
|
||||
|
||||
@@ -145,10 +145,10 @@ object VmessFmt {
|
||||
|
||||
allowInsecure = if ((queryParam["allowInsecure"] .orEmpty()) == "1") true else allowInsecure
|
||||
streamSetting.populateTlsSettings(
|
||||
queryParam["security"] .orEmpty(),
|
||||
queryParam["security"].orEmpty(),
|
||||
allowInsecure,
|
||||
queryParam["sni"] ?: sni,
|
||||
queryParam["fp"] .orEmpty(),
|
||||
queryParam["fp"].orEmpty(),
|
||||
queryParam["alpn"],
|
||||
null,
|
||||
null,
|
||||
|
||||
@@ -24,7 +24,7 @@ object WireguardFmt {
|
||||
(queryParam["address"]
|
||||
?: AppConfig.WIREGUARD_LOCAL_ADDRESS_V4).removeWhiteSpace()
|
||||
.split(",")
|
||||
wireguard.peers?.get(0)?.publicKey = queryParam["publickey"] .orEmpty()
|
||||
wireguard.peers?.get(0)?.publicKey = queryParam["publickey"].orEmpty()
|
||||
wireguard.peers?.get(0)?.endpoint =
|
||||
Utils.getIpv6Address(uri.idnHost) + ":${uri.port}"
|
||||
wireguard.mtu = Utils.parseInt(queryParam["mtu"] ?: AppConfig.WIREGUARD_LOCAL_MTU)
|
||||
|
||||
Reference in New Issue
Block a user