mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
540676ac90
commit
a4c616ca24
@ -14,6 +14,7 @@
|
|||||||
**2022/01/11**
|
**2022/01/11**
|
||||||
|
|
||||||
* 紧急修复在线tts朗读bug
|
* 紧急修复在线tts朗读bug
|
||||||
|
* 紧急修复登录问题
|
||||||
|
|
||||||
**2022/01/10**
|
**2022/01/10**
|
||||||
|
|
||||||
|
@ -155,20 +155,15 @@ object NetworkUtils {
|
|||||||
* http://www.content.example.com => example.com
|
* http://www.content.example.com => example.com
|
||||||
*/
|
*/
|
||||||
fun getSubDomain(url: String): String {
|
fun getSubDomain(url: String): String {
|
||||||
val baseUrl = getBaseUrl(url) ?: return ""
|
val baseUrl = getBaseUrl(url) ?: return url
|
||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
val mURL = URL(baseUrl)
|
val mURL = URL(baseUrl)
|
||||||
val schema: String = mURL.protocol
|
|
||||||
val host: String = mURL.host
|
val host: String = mURL.host
|
||||||
//判断是否为ip
|
//判断是否为ip
|
||||||
if (isIPAddress(host)) return baseUrl
|
if (isIPAddress(host)) return baseUrl
|
||||||
//PublicSuffixDatabase处理域名
|
//PublicSuffixDatabase处理域名
|
||||||
PublicSuffixDatabase.get().getEffectiveTldPlusOne(host) ?: baseUrl
|
PublicSuffixDatabase.get().getEffectiveTldPlusOne(host) ?: baseUrl
|
||||||
}.getOrDefault(
|
}.getOrDefault(url)
|
||||||
if (baseUrl.indexOf(".") == baseUrl.lastIndexOf(".")) {
|
|
||||||
baseUrl.substring(baseUrl.lastIndexOf("/") + 1)
|
|
||||||
} else baseUrl.substring(baseUrl.indexOf(".") + 1)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user