pull/1319/head
gedoor 3 years ago
parent e8f47966c9
commit 0125ee23c0
  1. 6
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  2. 3
      app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt
  3. 2
      app/src/main/java/io/legado/app/data/entities/rule/RowUi.kt
  4. 1
      app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt
  5. 34
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  6. 2
      app/src/main/res/values-es-rES/strings.xml
  7. 2
      app/src/main/res/values-ja-rJP/strings.xml
  8. 2
      app/src/main/res/values-pt-rBR/strings.xml
  9. 2
      app/src/main/res/values-zh-rHK/strings.xml
  10. 2
      app/src/main/res/values-zh-rTW/strings.xml
  11. 2
      app/src/main/res/values-zh/strings.xml
  12. 2
      app/src/main/res/values/strings.xml

@ -26,11 +26,11 @@ data class BookSource(
var customOrder: Int = 0, // 手动排序编号 var customOrder: Int = 0, // 手动排序编号
var enabled: Boolean = true, // 是否启用 var enabled: Boolean = true, // 是否启用
var enabledExplore: Boolean = true, // 启用发现 var enabledExplore: Boolean = true, // 启用发现
override var concurrentRate: String? = null, //并发率 override var concurrentRate: String? = null, // 并发率
override var header: String? = null, // 请求头 override var header: String? = null, // 请求头
override var loginUrl: String? = null, // 登录地址 override var loginUrl: String? = null, // 登录地址
override var loginUi: List<RowUi>? = null, //登录UI override var loginUi: List<RowUi>? = null, // 登录UI
var loginCheckJs: String? = null, //登录检测js var loginCheckJs: String? = null, // 登录检测js
var bookSourceComment: String? = null, // 注释 var bookSourceComment: String? = null, // 注释
var lastUpdateTime: Long = 0, // 最后更新时间,用于排序 var lastUpdateTime: Long = 0, // 最后更新时间,用于排序
var respondTime: Long = 180000L, // 响应时间,用于排序 var respondTime: Long = 180000L, // 响应时间,用于排序

@ -10,5 +10,6 @@ data class ContentRule(
var webJs: String? = null, var webJs: String? = null,
var sourceRegex: String? = null, var sourceRegex: String? = null,
var replaceRegex: String? = null, //替换规则 var replaceRegex: String? = null, //替换规则
var imageStyle: String? = null, //默认大小居中,FULL最大宽度 var imageStyle: String? = null, //默认大小居中,FULL最大宽度
var actions: String? = null //操作
) : Parcelable ) : Parcelable

@ -6,6 +6,6 @@ import kotlinx.parcelize.Parcelize
@Parcelize @Parcelize
data class RowUi( data class RowUi(
var name: String, var name: String,
var type: String, var type: String?,
var action: String? var action: String?
) : Parcelable ) : Parcelable

@ -6,6 +6,7 @@ import kotlinx.parcelize.Parcelize
@Parcelize @Parcelize
data class SearchRule( data class SearchRule(
var checkKeyWord: String? = null, // 校验关键字
override var bookList: String? = null, override var bookList: String? = null,
override var name: String? = null, override var name: String? = null,
override var author: String? = null, override var author: String? = null,

@ -212,6 +212,7 @@ class BookSourceEditActivity :
searchEntities.clear() searchEntities.clear()
searchEntities.apply { searchEntities.apply {
add(EditEntity("searchUrl", source?.searchUrl, R.string.r_search_url)) add(EditEntity("searchUrl", source?.searchUrl, R.string.r_search_url))
add(EditEntity("checkKeyWord", sr?.checkKeyWord, R.string.check_key_word))
add(EditEntity("bookList", sr?.bookList, R.string.r_book_list)) add(EditEntity("bookList", sr?.bookList, R.string.r_book_list))
add(EditEntity("name", sr?.name, R.string.r_book_name)) add(EditEntity("name", sr?.name, R.string.r_book_name))
add(EditEntity("author", sr?.author, R.string.r_author)) add(EditEntity("author", sr?.author, R.string.r_author))
@ -222,6 +223,21 @@ class BookSourceEditActivity :
add(EditEntity("coverUrl", sr?.coverUrl, R.string.rule_cover_url)) add(EditEntity("coverUrl", sr?.coverUrl, R.string.rule_cover_url))
add(EditEntity("bookUrl", sr?.bookUrl, R.string.r_book_url)) add(EditEntity("bookUrl", sr?.bookUrl, R.string.r_book_url))
} }
//发现
val er = source?.getExploreRule()
findEntities.clear()
findEntities.apply {
add(EditEntity("exploreUrl", source?.exploreUrl, R.string.r_find_url))
add(EditEntity("bookList", er?.bookList, R.string.r_book_list))
add(EditEntity("name", er?.name, R.string.r_book_name))
add(EditEntity("author", er?.author, R.string.r_author))
add(EditEntity("kind", er?.kind, R.string.rule_book_kind))
add(EditEntity("wordCount", er?.wordCount, R.string.rule_word_count))
add(EditEntity("lastChapter", er?.lastChapter, R.string.rule_last_chapter))
add(EditEntity("intro", er?.intro, R.string.rule_book_intro))
add(EditEntity("coverUrl", er?.coverUrl, R.string.rule_cover_url))
add(EditEntity("bookUrl", er?.bookUrl, R.string.r_book_url))
}
//详情页 //详情页
val ir = source?.getBookInfoRule() val ir = source?.getBookInfoRule()
infoEntities.clear() infoEntities.clear()
@ -258,21 +274,7 @@ class BookSourceEditActivity :
add(EditEntity("sourceRegex", cr?.sourceRegex, R.string.rule_source_regex)) add(EditEntity("sourceRegex", cr?.sourceRegex, R.string.rule_source_regex))
add(EditEntity("replaceRegex", cr?.replaceRegex, R.string.rule_replace_regex)) add(EditEntity("replaceRegex", cr?.replaceRegex, R.string.rule_replace_regex))
add(EditEntity("imageStyle", cr?.imageStyle, R.string.rule_image_style)) add(EditEntity("imageStyle", cr?.imageStyle, R.string.rule_image_style))
} add(EditEntity("actions", cr?.actions, R.string.rule_actions))
//发现
val er = source?.getExploreRule()
findEntities.clear()
findEntities.apply {
add(EditEntity("exploreUrl", source?.exploreUrl, R.string.r_find_url))
add(EditEntity("bookList", er?.bookList, R.string.r_book_list))
add(EditEntity("name", er?.name, R.string.r_book_name))
add(EditEntity("author", er?.author, R.string.r_author))
add(EditEntity("kind", er?.kind, R.string.rule_book_kind))
add(EditEntity("wordCount", er?.wordCount, R.string.rule_word_count))
add(EditEntity("lastChapter", er?.lastChapter, R.string.rule_last_chapter))
add(EditEntity("intro", er?.intro, R.string.rule_book_intro))
add(EditEntity("coverUrl", er?.coverUrl, R.string.rule_cover_url))
add(EditEntity("bookUrl", er?.bookUrl, R.string.r_book_url))
} }
binding.tabLayout.selectTab(binding.tabLayout.getTabAt(0)) binding.tabLayout.selectTab(binding.tabLayout.getTabAt(0))
setEditEntities(0) setEditEntities(0)
@ -305,6 +307,7 @@ class BookSourceEditActivity :
searchEntities.forEach { searchEntities.forEach {
when (it.key) { when (it.key) {
"searchUrl" -> source.searchUrl = it.value "searchUrl" -> source.searchUrl = it.value
"checkKeyWord" -> searchRule.checkKeyWord = it.value
"bookList" -> searchRule.bookList = it.value "bookList" -> searchRule.bookList = it.value
"name" -> searchRule.name = it.value "name" -> searchRule.name = it.value
"author" -> searchRule.author = it.value "author" -> searchRule.author = it.value
@ -365,6 +368,7 @@ class BookSourceEditActivity :
"sourceRegex" -> contentRule.sourceRegex = it.value "sourceRegex" -> contentRule.sourceRegex = it.value
"replaceRegex" -> contentRule.replaceRegex = it.value "replaceRegex" -> contentRule.replaceRegex = it.value
"imageStyle" -> contentRule.imageStyle = it.value "imageStyle" -> contentRule.imageStyle = it.value
"actions" -> contentRule.actions = it.value
} }
} }
source.ruleSearch = searchRule source.ruleSearch = searchRule

@ -874,4 +874,6 @@
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
<string name="check_key_word">校验关键字</string>
<string name="rule_actions">操作(actions)</string>
</resources> </resources>

@ -874,4 +874,6 @@
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
<string name="check_key_word">校验关键字</string>
<string name="rule_actions">操作(actions)</string>
</resources> </resources>

@ -874,5 +874,7 @@
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
<string name="check_key_word">校验关键字</string>
<string name="rule_actions">操作(actions)</string>
</resources> </resources>

@ -871,5 +871,7 @@
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
<string name="check_key_word">校验关键字</string>
<string name="rule_actions">操作(actions)</string>
</resources> </resources>

@ -873,5 +873,7 @@
<string name="copy_play_url">複製播放Url</string> <string name="copy_play_url">複製播放Url</string>
<string name="set_source_variable">設定源變數</string> <string name="set_source_variable">設定源變數</string>
<string name="set_book_variable">設定書籍變數</string> <string name="set_book_variable">設定書籍變數</string>
<string name="check_key_word">校验关键字</string>
<string name="rule_actions">操作(actions)</string>
</resources> </resources>

@ -873,5 +873,7 @@
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
<string name="check_key_word">校验关键字</string>
<string name="rule_actions">操作(actions)</string>
</resources> </resources>

@ -874,5 +874,7 @@
<string name="copy_play_url">拷贝播放Url</string> <string name="copy_play_url">拷贝播放Url</string>
<string name="set_source_variable">设置源变量</string> <string name="set_source_variable">设置源变量</string>
<string name="set_book_variable">设置书籍变量</string> <string name="set_book_variable">设置书籍变量</string>
<string name="check_key_word">校验关键字</string>
<string name="rule_actions">操作(actions)</string>
</resources> </resources>

Loading…
Cancel
Save