Add support for gRPC protocol

Fixed a initialize plugin option problem

Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
Teddysun 2021-05-28 07:59:41 +09:00
parent 51322afe0c
commit f933348310
No known key found for this signature in database
GPG key ID: 09BD4C080AD6C46D

View file

@ -72,9 +72,9 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange
fun onInitializePluginOptions(options: PluginOptions) { fun onInitializePluginOptions(options: PluginOptions) {
mode.value = when { mode.value = when {
options["mode"] ?: "websocket" == "quic" -> "quic-tls" options["mode"] ?: "websocket" == "quic" -> "quic-tls"
options["mode"] == "websocket-tls" -> "websocket-tls" options["mode"] == null && "tls" in options -> "websocket-tls"
options["mode"] == "grpc" -> "grpc" options["mode"] == "grpc" && "tls" !in options -> "grpc"
options["mode"] == "grpc-tls" -> "grpc-tls" options["mode"] == "grpc" && "tls" in options -> "grpc-tls"
else -> "websocket-http" else -> "websocket-http"
}.also { onPreferenceChange(null, it) } }.also { onPreferenceChange(null, it) }
host.text = options["host"] ?: "cloudfront.com" host.text = options["host"] ?: "cloudfront.com"