Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust authored and AnGgIt86 committed Sep 28, 2024
1 parent 74f0585 commit 794ab41
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object V2RayServiceManager {
set(value) {
field = value
Seq.setContext(value?.get()?.getService()?.applicationContext)
Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()))//, Utils.getDeviceIdForXUDPBaseKey())
Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()), Utils.getDeviceIdForXUDPBaseKey())
}
var currentConfig: ServerConfig? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class V2RayTestService : Service() {
override fun onCreate() {
super.onCreate()
Seq.setContext(this)
Libv2ray.initV2Env(Utils.userAssetPath(this)) //Utils.getDeviceIdForXUDPBaseKey())
Libv2ray.initV2Env(Utils.userAssetPath(this), Utils.getDeviceIdForXUDPBaseKey())
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/kotlin/com/neko/v2ray/service/V2RayVpnService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ class V2RayVpnService : VpnService(), ServiceControl {
}
}

// if (settingsStorage?.decodeBool(AppConfig.PREF_LOCAL_DNS_ENABLED) == true) {
// builder.addDnsServer(PRIVATE_VLAN4_ROUTER)
// } else {
Utils.getVpnDnsServers()
.forEach {
if (Utils.isPureIpAddress(it)) {
builder.addDnsServer(it)
}
}
// }

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

Expand Down
8 changes: 3 additions & 5 deletions app/src/main/kotlin/com/neko/v2ray/ui/RoutingEditActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package com.neko.v2ray.ui

import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.lifecycleScope
import com.google.android.material.appbar.MaterialToolbar
import com.google.android.material.appbar.CollapsingToolbarLayout
import com.google.gson.Gson
import com.neko.v2ray.R
import com.neko.v2ray.databinding.ActivityRoutingEditBinding
import com.neko.v2ray.dto.RulesetItem
Expand Down Expand Up @@ -114,9 +112,9 @@ class RoutingEditActivity : BaseActivity() {
val rulesetItem = SettingsManager.getRoutingRuleset(position) ?: RulesetItem()

rulesetItem.remarks = binding.etRemarks.text.toString()
binding.etDomain.text.toString().let { rulesetItem.domain = if (it.isEmpty()) null else it.split(',') }
binding.etIp.text.toString().let { rulesetItem.ip = if (it.isEmpty()) null else it.split(',') }
binding.etProtocol.text.toString().let { rulesetItem.protocol = if (it.isEmpty()) null else it.split(',') }
binding.etDomain.text.toString().let { rulesetItem.domain = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } }
binding.etIp.text.toString().let { rulesetItem.ip = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } }
binding.etProtocol.text.toString().let { rulesetItem.protocol = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } }
binding.etPort.text.toString().let { rulesetItem.port = it.ifEmpty { null } }
binding.etNetwork.text.toString().let { rulesetItem.network = it.ifEmpty { null } }
rulesetItem.outboundTag = outbound_tag[binding.spOutboundTag.selectedItemPosition]
Expand Down

0 comments on commit 794ab41

Please sign in to comment.