From 1dbc70596c8a35c667f4a6fc2140707ab333787c Mon Sep 17 00:00:00 2001 From: Teddysun Date: Sun, 17 Oct 2021 12:32:00 +0900 Subject: [PATCH] Add serviceName for grpc mode https://github.com/teddysun/xray-plugin-android/pull/4 Signed-off-by: Teddysun --- .../com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt | 4 ++++ app/src/main/res/xml/config.xml | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt index 499ddbb..8722e8e 100644 --- a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt +++ b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt @@ -42,6 +42,7 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange private val mode by lazy { findPreference("mode")!! } private val host by lazy { findPreference("host")!! } private val path by lazy { findPreference("path")!! } + private val serviceName by lazy { findPreference("serviceName")!! } private val mux by lazy { findPreference("mux")!! } private val certRaw by lazy { findPreference("certRaw")!! } private val loglevel by lazy { findPreference("loglevel")!! } @@ -65,6 +66,7 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange putWithDefault("host", host.text, "cloudfront.com") putWithDefault("path", path.text, "/") putWithDefault("mux", mux.text, "1") + putWithDefault("serviceName", serviceName.text, "") putWithDefault("certRaw", certRaw.text?.replace("\n", ""), "") putWithDefault("loglevel", loglevel.value, "warning") } @@ -81,6 +83,7 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange path.text = options["path"] ?: "/" mux.text = options["mux"] ?: "1" certRaw.text = options["certRaw"] + serviceName.text = options["serviceName"] loglevel.value = options["loglevel"] ?: "warning" } @@ -106,6 +109,7 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange val (mode, tls) = readMode(newValue as String) path.isEnabled = mode == null mux.isEnabled = mode == null + serviceName.isEnabled = mode == "grpc" certRaw.isEnabled = mode != null || tls return true } diff --git a/app/src/main/res/xml/config.xml b/app/src/main/res/xml/config.xml index 8fa2f23..cf3b80f 100644 --- a/app/src/main/res/xml/config.xml +++ b/app/src/main/res/xml/config.xml @@ -17,6 +17,11 @@ app:persistent="false" app:title="Path" app:useSimpleSummaryProvider="true"/> +