Skip to content

Commit 794ab41

Browse files
2dustAnGgIt886
authored andcommitted
Bug fix
1 parent 74f0585 commit 794ab41

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

app/src/main/kotlin/com/neko/v2ray/service/V2RayServiceManager.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object V2RayServiceManager {
5151
set(value) {
5252
field = value
5353
Seq.setContext(value?.get()?.getService()?.applicationContext)
54-
Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()))//, Utils.getDeviceIdForXUDPBaseKey())
54+
Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()), Utils.getDeviceIdForXUDPBaseKey())
5555
}
5656
var currentConfig: ServerConfig? = null
5757

app/src/main/kotlin/com/neko/v2ray/service/V2RayTestService.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class V2RayTestService : Service() {
2424
override fun onCreate() {
2525
super.onCreate()
2626
Seq.setContext(this)
27-
Libv2ray.initV2Env(Utils.userAssetPath(this)) //Utils.getDeviceIdForXUDPBaseKey())
27+
Libv2ray.initV2Env(Utils.userAssetPath(this), Utils.getDeviceIdForXUDPBaseKey())
2828
}
2929

3030
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {

app/src/main/kotlin/com/neko/v2ray/service/V2RayVpnService.kt

+4
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,16 @@ class V2RayVpnService : VpnService(), ServiceControl {
138138
}
139139
}
140140

141+
// if (settingsStorage?.decodeBool(AppConfig.PREF_LOCAL_DNS_ENABLED) == true) {
142+
// builder.addDnsServer(PRIVATE_VLAN4_ROUTER)
143+
// } else {
141144
Utils.getVpnDnsServers()
142145
.forEach {
143146
if (Utils.isPureIpAddress(it)) {
144147
builder.addDnsServer(it)
145148
}
146149
}
150+
// }
147151

148152
builder.setSession(V2RayServiceManager.currentConfig?.remarks.orEmpty())
149153

app/src/main/kotlin/com/neko/v2ray/ui/RoutingEditActivity.kt

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ package com.neko.v2ray.ui
22

33
import android.os.Bundle
44
import android.text.TextUtils
5-
import android.util.Log
65
import android.view.Menu
76
import android.view.MenuItem
87
import androidx.appcompat.app.AlertDialog
98
import androidx.lifecycle.lifecycleScope
109
import com.google.android.material.appbar.MaterialToolbar
1110
import com.google.android.material.appbar.CollapsingToolbarLayout
12-
import com.google.gson.Gson
1311
import com.neko.v2ray.R
1412
import com.neko.v2ray.databinding.ActivityRoutingEditBinding
1513
import com.neko.v2ray.dto.RulesetItem
@@ -114,9 +112,9 @@ class RoutingEditActivity : BaseActivity() {
114112
val rulesetItem = SettingsManager.getRoutingRuleset(position) ?: RulesetItem()
115113

116114
rulesetItem.remarks = binding.etRemarks.text.toString()
117-
binding.etDomain.text.toString().let { rulesetItem.domain = if (it.isEmpty()) null else it.split(',') }
118-
binding.etIp.text.toString().let { rulesetItem.ip = if (it.isEmpty()) null else it.split(',') }
119-
binding.etProtocol.text.toString().let { rulesetItem.protocol = if (it.isEmpty()) null else it.split(',') }
115+
binding.etDomain.text.toString().let { rulesetItem.domain = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } }
116+
binding.etIp.text.toString().let { rulesetItem.ip = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } }
117+
binding.etProtocol.text.toString().let { rulesetItem.protocol = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } }
120118
binding.etPort.text.toString().let { rulesetItem.port = it.ifEmpty { null } }
121119
binding.etNetwork.text.toString().let { rulesetItem.network = it.ifEmpty { null } }
122120
rulesetItem.outboundTag = outbound_tag[binding.spOutboundTag.selectedItemPosition]

0 commit comments

Comments
 (0)