mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
Some checks failed
Test Build / prepare (push) Has been cancelled
Test Build / build (app, release) (push) Has been cancelled
Test Build / build (app, releaseA) (push) Has been cancelled
Test Build / prerelease (push) Has been cancelled
Test Build / lanzou (push) Has been cancelled
Test Build / test_Branch (push) Has been cancelled
Test Build / telegram (push) Has been cancelled
update fork / build (push) Has been cancelled
Some checks failed
Test Build / prepare (push) Has been cancelled
Test Build / build (app, release) (push) Has been cancelled
Test Build / build (app, releaseA) (push) Has been cancelled
Test Build / prerelease (push) Has been cancelled
Test Build / lanzou (push) Has been cancelled
Test Build / test_Branch (push) Has been cancelled
Test Build / telegram (push) Has been cancelled
update fork / build (push) Has been cancelled
This commit is contained in:
@@ -9,8 +9,8 @@ import io.legado.app.constant.AppLog
|
||||
import io.legado.app.data.entities.rule.RowUi
|
||||
import io.legado.app.help.CacheManager
|
||||
import io.legado.app.help.JsExtensions
|
||||
import io.legado.app.help.crypto.SymmetricCryptoAndroid
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.help.crypto.SymmetricCryptoAndroid
|
||||
import io.legado.app.help.http.CookieStore
|
||||
import io.legado.app.help.source.getShareScope
|
||||
import io.legado.app.utils.GSON
|
||||
@@ -242,9 +242,13 @@ interface BaseSource : JsExtensions {
|
||||
bindings["cookie"] = CookieStore
|
||||
bindings["cache"] = CacheManager
|
||||
}
|
||||
val scope = RhinoScriptEngine.getRuntimeScope(bindings)
|
||||
getShareScope()?.let {
|
||||
scope.prototype = it
|
||||
val sharedScope = getShareScope()
|
||||
val scope = if (sharedScope == null) {
|
||||
RhinoScriptEngine.getRuntimeScope(bindings)
|
||||
} else {
|
||||
bindings.apply {
|
||||
prototype = sharedScope
|
||||
}
|
||||
}
|
||||
return RhinoScriptEngine.eval(jsStr, scope)
|
||||
}
|
||||
|
||||
@@ -351,9 +351,13 @@ class AnalyzeUrl(
|
||||
bindings["source"] = source
|
||||
bindings["result"] = result
|
||||
}
|
||||
val scope = RhinoScriptEngine.getRuntimeScope(bindings)
|
||||
source?.getShareScope(coroutineContext)?.let {
|
||||
scope.prototype = it
|
||||
val sharedScope = source?.getShareScope(coroutineContext)
|
||||
val scope = if (sharedScope == null) {
|
||||
RhinoScriptEngine.getRuntimeScope(bindings)
|
||||
} else {
|
||||
bindings.apply {
|
||||
prototype = sharedScope
|
||||
}
|
||||
}
|
||||
return RhinoScriptEngine.eval(jsStr, scope, coroutineContext)
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ object BookInfo {
|
||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||
} ?: Debug.log(bookSource.bookSourceUrl, "└")
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}")
|
||||
DebugLog.e("获取分类出错", e)
|
||||
}
|
||||
@@ -100,6 +101,7 @@ object BookInfo {
|
||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}")
|
||||
DebugLog.e("获取字数出错", e)
|
||||
}
|
||||
@@ -111,6 +113,7 @@ object BookInfo {
|
||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}")
|
||||
DebugLog.e("获取最新章节出错", e)
|
||||
}
|
||||
@@ -122,6 +125,7 @@ object BookInfo {
|
||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}")
|
||||
DebugLog.e("获取简介出错", e)
|
||||
}
|
||||
@@ -136,11 +140,12 @@ object BookInfo {
|
||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}")
|
||||
DebugLog.e("获取封面出错", e)
|
||||
}
|
||||
coroutineContext.ensureActive()
|
||||
if (!book.isWebFile) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "┌获取目录链接")
|
||||
book.tocUrl = analyzeRule.getString(infoRule.tocUrl, isUrl = true)
|
||||
if (book.tocUrl.isEmpty()) book.tocUrl = baseUrl
|
||||
@@ -149,7 +154,6 @@ object BookInfo {
|
||||
}
|
||||
Debug.log(bookSource.bookSourceUrl, "└${book.tocUrl}")
|
||||
} else {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "┌获取文件下载链接")
|
||||
book.downloadUrls = analyzeRule.getStringList(infoRule.downloadUrls, isUrl = true)
|
||||
if (book.downloadUrls.isNullOrEmpty()) {
|
||||
|
||||
@@ -224,6 +224,7 @@ object BookList {
|
||||
searchBook.kind = analyzeRule.getStringList(ruleKind)?.joinToString(",")
|
||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.kind ?: ""}", log)
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}", log)
|
||||
}
|
||||
coroutineContext.ensureActive()
|
||||
@@ -231,7 +232,8 @@ object BookList {
|
||||
try {
|
||||
searchBook.wordCount = wordCountFormat(analyzeRule.getString(ruleWordCount))
|
||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.wordCount}", log)
|
||||
} catch (e: java.lang.Exception) {
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}", log)
|
||||
}
|
||||
coroutineContext.ensureActive()
|
||||
@@ -239,7 +241,8 @@ object BookList {
|
||||
try {
|
||||
searchBook.latestChapterTitle = analyzeRule.getString(ruleLastChapter)
|
||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.latestChapterTitle}", log)
|
||||
} catch (e: java.lang.Exception) {
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}", log)
|
||||
}
|
||||
coroutineContext.ensureActive()
|
||||
@@ -247,7 +250,8 @@ object BookList {
|
||||
try {
|
||||
searchBook.intro = HtmlFormatter.format(analyzeRule.getString(ruleIntro))
|
||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}", log)
|
||||
} catch (e: java.lang.Exception) {
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}", log)
|
||||
}
|
||||
coroutineContext.ensureActive()
|
||||
@@ -259,7 +263,8 @@ object BookList {
|
||||
}
|
||||
}
|
||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.coverUrl ?: ""}", log)
|
||||
} catch (e: java.lang.Exception) {
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "└${e.localizedMessage}", log)
|
||||
}
|
||||
coroutineContext.ensureActive()
|
||||
|
||||
@@ -199,6 +199,7 @@ class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookS
|
||||
openOrCloseHelp(true)
|
||||
initExploreKinds()
|
||||
}
|
||||
|
||||
R.id.menu_help -> showHelp("debugHelp")
|
||||
}
|
||||
return super.onCompatOptionsItemSelected(item)
|
||||
|
||||
Reference in New Issue
Block a user