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