Merge branch 'gedoor:master' into master

This commit is contained in:
Xwite
2022-05-30 06:36:58 +08:00
committed by GitHub
19 changed files with 33 additions and 10 deletions
@@ -143,6 +143,10 @@ data class BookSource(
fun getContentRule() = ruleContent ?: ContentRule()
fun isReGetTocUrlOnRefresh(): Boolean {
return ruleBookInfo?.reGetTocUrlOnRefresh.isTrue()
}
fun getDisPlayNameGroup(): String {
return if (bookSourceGroup.isNullOrBlank()) {
bookSourceName
@@ -17,5 +17,6 @@ data class BookInfoRule(
var tocUrl: String? = null,
var wordCount: String? = null,
var canReName: String? = null,
var downloadUrls: String? = null
var downloadUrls: String? = null,
var reGetTocUrlOnRefresh: String? = null
) : Parcelable
@@ -217,7 +217,9 @@ class BookSourceEditActivity :
add(EditEntity("header", source?.header, R.string.source_http_header))
add(
EditEntity(
"concurrentRate", source?.concurrentRate, R.string.source_concurrent_rate
"concurrentRate",
source?.concurrentRate,
R.string.source_concurrent_rate
)
)
}
@@ -267,6 +269,7 @@ class BookSourceEditActivity :
add(EditEntity("tocUrl", ir?.tocUrl, R.string.rule_toc_url))
add(EditEntity("canReName", ir?.canReName, R.string.rule_can_re_name))
add(EditEntity("downloadUrls", ir?.downloadUrls, R.string.download_url_rule))
add(EditEntity("reGetTocUrl", ir?.reGetTocUrlOnRefresh, R.string.rule_re_get_toc_url))
}
//目录页
val tr = source?.getTocRule()
@@ -397,7 +400,9 @@ class BookSourceEditActivity :
"tocUrl" -> bookInfoRule.tocUrl =
viewModel.ruleComplete(it.value, bookInfoRule.init, 2)
"canReName" -> bookInfoRule.canReName = it.value
"downloadUrls" -> bookInfoRule.downloadUrls = viewModel.ruleComplete(it.value, bookInfoRule.init)
"downloadUrls" -> bookInfoRule.downloadUrls =
viewModel.ruleComplete(it.value, bookInfoRule.init)
"reGetTocUrl" -> bookInfoRule.reGetTocUrlOnRefresh = it.value
}
}
tocEntities.forEach {
@@ -27,7 +27,6 @@ import io.legado.app.ui.document.HandleFileContract
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import java.net.URLDecoder
import kotlinx.coroutines.runBlocking
class WebViewActivity : VMBaseActivity<ActivityWebViewBinding, WebViewModel>() {
@@ -72,6 +71,8 @@ class WebViewActivity : VMBaseActivity<ActivityWebViewBinding, WebViewModel>() {
viewModel.saveVerificationResult {
finish()
}
} else {
finish()
}
}
}
@@ -116,7 +116,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
onUpTocBooks.add(book.bookUrl)
postEvent(EventBus.UP_BOOKSHELF, book.bookUrl)
execute(context = upTocPool) {
if (book.tocUrl.isBlank()) {
if (book.tocUrl.isBlank() || source.isReGetTocUrlOnRefresh()) {
WebBook.getBookInfoAwait(this, source, book)
}
val toc = WebBook.getChapterListAwait(this, source, book).getOrThrow()