Fix the release build
This commit is contained in:
@@ -29,12 +29,11 @@ import android.os.PersistableBundle
|
||||
import android.support.v4.content.pm.ShortcutInfoCompat
|
||||
import android.support.v4.content.pm.ShortcutManagerCompat
|
||||
import android.support.v4.graphics.drawable.IconCompat
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import com.github.shadowsocks.App.Companion.app
|
||||
import com.github.shadowsocks.aidl.IShadowsocksService
|
||||
import com.github.shadowsocks.bg.BaseService
|
||||
|
||||
class QuickToggleShortcut : AppCompatActivity(), ShadowsocksConnection.Interface {
|
||||
class QuickToggleShortcut : Activity(), ShadowsocksConnection.Interface {
|
||||
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
|
||||
super.onCreate(savedInstanceState, persistentState)
|
||||
if (intent.action == Intent.ACTION_CREATE_SHORTCUT) {
|
||||
|
||||
@@ -46,6 +46,23 @@ object LocalDnsService {
|
||||
super.startNativeProcesses()
|
||||
val profile = data.profile!!
|
||||
|
||||
fun makeDns(name: String, address: String, edns: Boolean = true): JSONObject {
|
||||
val dns = JSONObject()
|
||||
.put("Name", name)
|
||||
.put("Address", (when (address.parseNumericAddress()) {
|
||||
is Inet6Address -> "[$address]"
|
||||
else -> address
|
||||
}) + ":53")
|
||||
.put("Timeout", 6)
|
||||
.put("EDNSClientSubnet", JSONObject().put("Policy", "disable"))
|
||||
if (edns) dns
|
||||
.put("Protocol", "tcp")
|
||||
.put("Socks5Address", "127.0.0.1:" + DataStore.portProxy)
|
||||
else dns.put("Protocol", "udp")
|
||||
|
||||
return dns
|
||||
}
|
||||
|
||||
fun buildOvertureConfig(file: String): String {
|
||||
val config = JSONObject()
|
||||
.put("BindAddress", "127.0.0.1:" + DataStore.portLocalDns)
|
||||
@@ -54,23 +71,8 @@ object LocalDnsService {
|
||||
.put("HostsFile", "hosts")
|
||||
.put("MinimumTTL", 3600)
|
||||
.put("CacheSize", 4096)
|
||||
fun makeDns(name: String, address: String, edns: Boolean = true) = {
|
||||
val dns = JSONObject()
|
||||
.put("Name", name)
|
||||
.put("Address", (when (address.parseNumericAddress()) {
|
||||
is Inet6Address -> "[$address]"
|
||||
else -> address
|
||||
}) + ":53")
|
||||
.put("Timeout", 6)
|
||||
.put("EDNSClientSubnet", JSONObject().put("Policy", "disable"))
|
||||
if (edns) dns
|
||||
.put("Protocol", "tcp")
|
||||
.put("Socks5Address", "127.0.0.1:" + DataStore.portProxy)
|
||||
else dns.put("Protocol", "udp")
|
||||
dns
|
||||
}
|
||||
val remoteDns = JSONArray(profile.remoteDns.split(",")
|
||||
.mapIndexed { i, dns -> makeDns("UserDef-" + i, dns.trim())() })
|
||||
.mapIndexed { i, dns -> makeDns("UserDef-" + i, dns.trim()) })
|
||||
val localDns = JSONArray(arrayOf(
|
||||
makeDns("Primary-1", "119.29.29.29", false),
|
||||
makeDns("Primary-2", "114.114.114.114", false)
|
||||
|
||||
Reference in New Issue
Block a user