1 parent
12863dfa21
commit
877d96a50a
2 files changed
+6
-12
No files matched your search
+2
-2
@@ -31,8 +31,8 @@ android {
|
||||
applicationId "moe.tarsin.ehviewer"
|
||||
minSdkVersion 28
|
||||
targetSdkVersion 33
|
||||
versionCode 180022
|
||||
versionName "1.8.3.1"
|
||||
versionCode 180023
|
||||
versionName "1.8.3.2"
|
||||
resConfigs 'zh', 'zh-rCN', 'zh-rHK', 'zh-rTW', 'es', 'ja', 'ko', 'fr', 'de', 'th'
|
||||
}
|
||||
|
||||
|
||||
@@ -114,20 +114,14 @@ class EhDns(context: Context) : Dns {
|
||||
host: String,
|
||||
vararg ips: Pair<String, Boolean>
|
||||
) {
|
||||
map[host] = ips.mapNotNull {
|
||||
if (Settings.getDF() && it.second) null else Hosts.toInetAddress(host, it.first)
|
||||
map[host] = ips.mapNotNull { pair ->
|
||||
Hosts.toInetAddress(host, pair.first).takeUnless { Settings.getDF() && pair.second }
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(UnknownHostException::class)
|
||||
override fun lookup(hostname: String): List<InetAddress> {
|
||||
var inetAddresses = hosts[hostname]
|
||||
inetAddresses ?: run {
|
||||
if (Settings.getBuiltInHosts()) {
|
||||
inetAddresses = builtInHosts[hostname]
|
||||
}
|
||||
}
|
||||
inetAddresses ?: return Dns.SYSTEM.lookup(hostname)
|
||||
return inetAddresses!! // Should never be null here
|
||||
return hosts[hostname] ?: builtInHosts[hostname].takeIf { Settings.getBuiltInHosts() }
|
||||
?: Dns.SYSTEM.lookup(hostname)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user