This commit is contained in:
Horis committed 2025-04-21 16:30:25 +08:00
1 parent f27cca65f9
commit 30a0be1a46
3 files changed
+15 -1

No files matched your search

@@ -56,7 +56,7 @@ object SharedJsScope {
url(value)
}.body
}
if (js !== null) {
if (js != null) {
aCache.put(fileName, js)
} else {
throw NoStackTraceException("下载jsLib-${value}失败")
@@ -76,4 +76,12 @@ object SharedJsScope {
return scope
}
fun remove(jsLib: String?) {
if (jsLib.isNullOrBlank()) {
return
}
val key = MD5Utils.md5Encode(jsLib)
scopeMap.remove(key)
}
}
@@ -14,6 +14,7 @@ import io.legado.app.help.http.newCallStrResponse
import io.legado.app.help.http.okHttpClient
import io.legado.app.help.source.clearExploreKindsCache
import io.legado.app.help.storage.ImportOldData
import io.legado.app.model.SharedJsScope
import io.legado.app.utils.GSON
import io.legado.app.utils.fromJsonArray
import io.legado.app.utils.fromJsonObject
@@ -57,6 +58,9 @@ class BookSourceEditViewModel(application: Application) : BaseViewModel(applicat
if (oldSource.exploreUrl != source.exploreUrl) {
oldSource.clearExploreKindsCache()
}
if (oldSource.jsLib != source.jsLib) {
SharedJsScope.remove(oldSource.jsLib)
}
}
bookSource?.let {
appDb.bookSourceDao.delete(it)