fix: This is ignored when the URL scheme is "http"

This commit is contained in:
metacubex 2022-12-10 17:59:29 +08:00
parent 2ab1571e3a
commit e8b9603bdd
2 changed files with 50 additions and 47 deletions

View File

@ -129,7 +129,7 @@ class ProfileManager(private val context: Context) : IProfileManager,
override suspend fun update(uuid: UUID) {
scheduleUpdate(uuid, true)
ImportedDao().queryByUUID(uuid)?.let {
if (it.type == Profile.Type.Url) {
if (it.type == Profile.Type.Url && it.source.startsWith("https://",true)) {
updateFlow(it)
}
}

View File

@ -21,6 +21,7 @@ import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import okhttp3.OkHttpClient
import okhttp3.Request
import java.net.URL
import java.util.*
import java.util.concurrent.TimeUnit
@ -72,6 +73,7 @@ object ProfileProcessor {
var total: Long = 0
var expire: Long = 0
if (snapshot?.type == Profile.Type.Url) {
if (snapshot.source.startsWith("https://", true)) {
val client = OkHttpClient()
val request = Request.Builder()
.url(snapshot.source)
@ -96,12 +98,14 @@ object ProfileProcessor {
info[0].contains("expire") -> {
if (info[1].isNotEmpty()) {
expire = (info[1].toDouble() * 1000).toLong()
expire =
(info[1].toDouble() * 1000).toLong()
}
}
}
}
}
}
}
val new = Imported(
snapshot.uuid,
@ -127,7 +131,6 @@ object ProfileProcessor {
.deleteRecursively()
context.sendProfileChanged(snapshot.uuid)
}
} else if (snapshot?.type == Profile.Type.File) {
val new = Imported(
snapshot.uuid,