mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 22:50:05 +08:00
Fix MTU conflict with mieru plugin (#529)
* Fix MTU conflict with mieru plugin * Add protect path to mieru plugin
This commit is contained in:
parent
0edc97aa2e
commit
f66437c18d
@ -90,6 +90,7 @@ object Key {
|
|||||||
const val SERVER_ENCRYPTION = "serverEncryption"
|
const val SERVER_ENCRYPTION = "serverEncryption"
|
||||||
const val SERVER_ALPN = "serverALPN"
|
const val SERVER_ALPN = "serverALPN"
|
||||||
const val SERVER_CERTIFICATES = "serverCertificates"
|
const val SERVER_CERTIFICATES = "serverCertificates"
|
||||||
|
const val SERVER_MTU = "serverMTU"
|
||||||
|
|
||||||
const val SERVER_CONFIG = "serverConfig"
|
const val SERVER_CONFIG = "serverConfig"
|
||||||
const val SERVER_CUSTOM = "serverCustom"
|
const val SERVER_CUSTOM = "serverCustom"
|
||||||
|
|||||||
@ -147,6 +147,7 @@ abstract class BoxInstance(
|
|||||||
|
|
||||||
val envMap = mutableMapOf<String, String>()
|
val envMap = mutableMapOf<String, String>()
|
||||||
envMap["MIERU_CONFIG_JSON_FILE"] = configFile.absolutePath
|
envMap["MIERU_CONFIG_JSON_FILE"] = configFile.absolutePath
|
||||||
|
envMap["MIERU_PROTECT_PATH"] = "protect_path"
|
||||||
|
|
||||||
val commands = mutableListOf(
|
val commands = mutableListOf(
|
||||||
initPlugin("mieru-plugin").path, "run",
|
initPlugin("mieru-plugin").path, "run",
|
||||||
|
|||||||
@ -189,6 +189,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
|
|||||||
var serverEncryption by profileCacheStore.string(Key.SERVER_ENCRYPTION)
|
var serverEncryption by profileCacheStore.string(Key.SERVER_ENCRYPTION)
|
||||||
var serverALPN by profileCacheStore.string(Key.SERVER_ALPN)
|
var serverALPN by profileCacheStore.string(Key.SERVER_ALPN)
|
||||||
var serverCertificates by profileCacheStore.string(Key.SERVER_CERTIFICATES)
|
var serverCertificates by profileCacheStore.string(Key.SERVER_CERTIFICATES)
|
||||||
|
var serverMTU by profileCacheStore.stringToInt(Key.SERVER_MTU)
|
||||||
var serverHeaders by profileCacheStore.string(Key.SERVER_HEADERS)
|
var serverHeaders by profileCacheStore.string(Key.SERVER_HEADERS)
|
||||||
var serverAllowInsecure by profileCacheStore.boolean(Key.SERVER_ALLOW_INSECURE)
|
var serverAllowInsecure by profileCacheStore.boolean(Key.SERVER_ALLOW_INSECURE)
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@ fun MieruBean.buildMieruConfig(port: Int): String {
|
|||||||
put("password", password)
|
put("password", password)
|
||||||
})
|
})
|
||||||
put("servers", serverInfo)
|
put("servers", serverInfo)
|
||||||
|
put("mtu", mtu)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}.toStringPretty()
|
}.toStringPretty()
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class MieruSettingsActivity : ProfileSettingsActivity<MieruBean>() {
|
|||||||
DataStore.serverProtocol = protocol
|
DataStore.serverProtocol = protocol
|
||||||
DataStore.serverUsername = username
|
DataStore.serverUsername = username
|
||||||
DataStore.serverPassword = password
|
DataStore.serverPassword = password
|
||||||
DataStore.mtu = mtu
|
DataStore.serverMTU = mtu
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun MieruBean.serialize() {
|
override fun MieruBean.serialize() {
|
||||||
@ -51,7 +51,7 @@ class MieruSettingsActivity : ProfileSettingsActivity<MieruBean>() {
|
|||||||
protocol = DataStore.serverProtocol
|
protocol = DataStore.serverProtocol
|
||||||
username = DataStore.serverUsername
|
username = DataStore.serverUsername
|
||||||
password = DataStore.serverPassword
|
password = DataStore.serverPassword
|
||||||
mtu = DataStore.mtu
|
mtu = DataStore.serverMTU
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun PreferenceFragmentCompat.createPreferences(
|
override fun PreferenceFragmentCompat.createPreferences(
|
||||||
@ -66,7 +66,7 @@ class MieruSettingsActivity : ProfileSettingsActivity<MieruBean>() {
|
|||||||
summaryProvider = PasswordSummaryProvider
|
summaryProvider = PasswordSummaryProvider
|
||||||
}
|
}
|
||||||
val protocol = findPreference<SimpleMenuPreference>(Key.SERVER_PROTOCOL)!!
|
val protocol = findPreference<SimpleMenuPreference>(Key.SERVER_PROTOCOL)!!
|
||||||
val mtu = findPreference<EditTextPreference>(Key.MTU)!!
|
val mtu = findPreference<EditTextPreference>(Key.SERVER_MTU)!!
|
||||||
mtu.isVisible = protocol.value.equals("UDP")
|
mtu.isVisible = protocol.value.equals("UDP")
|
||||||
protocol.setOnPreferenceChangeListener { _, newValue ->
|
protocol.setOnPreferenceChangeListener { _, newValue ->
|
||||||
mtu.isVisible = newValue.equals("UDP")
|
mtu.isVisible = newValue.equals("UDP")
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
app:title="@string/password" />
|
app:title="@string/password" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
app:icon="@drawable/baseline_public_24"
|
app:icon="@drawable/baseline_public_24"
|
||||||
app:key="mtu"
|
app:key="serverMTU"
|
||||||
app:title="@string/mtu"
|
app:title="@string/mtu"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user