adding bookSourceComment to database

update Appdatabase
pull/365/head
Jason Yao 4 years ago
parent f455f3fe63
commit 65e6eb22a5
  1. 5
      app/src/main/assets/web/index.html
  2. 2
      app/src/main/assets/web/index.js
  3. 10
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  4. 3
      app/src/main/java/io/legado/app/help/storage/OldRule.kt
  5. 4
      app/src/main/res/values-night/strings.xml

@ -38,6 +38,11 @@
<textarea rows="1" id="loginUrl" class="base" title="loginUrl"
placeholder="&lt;选填&gt;填写网站登录网址,仅在需要登录的书源有用"></textarea>
</div>
<div>
<div>注释:</div>
<textarea rows="1" id="bookSourceComment" class="base" title="bookSourceComment"
placeholder="&lt;选填&gt;描述书源作者和状态"></textarea>
</div>
<div>
<div>链接验证:</div>
<textarea rows="1" id="bookUrlPattern" class="base" title="bookUrlPattern"

@ -33,6 +33,7 @@ const RuleJSON = (() => {
ruleJson.weight = 0;
ruleJson.enabled = true;
ruleJson.enabledExplore = true;
ruleJson.bookSourceComment = ""
// 搜索规则
$$('.rules .ruleSearch').forEach(item => searchJson[item.title] = '');
@ -159,6 +160,7 @@ function rule2json() {
RuleJSON.ruleContent = contentJson;
RuleJSON.lastUpdateTime = RuleJSON.lastUpdateTime == '' ? 0 : parseInt(RuleJSON.lastUpdateTime);
RuleJSON.bookSourceComment = RuleJSON.bookSourceComment == '' ? "" : String(RuleJSON.bookSourceComment);
RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder);
RuleJSON.weight = RuleJSON.weight == '' ? 0 : parseInt(RuleJSON.weight);
RuleJSON.bookSourceType == RuleJSON.bookSourceType == '' ? 0 : parseInt(RuleJSON.weight);

@ -16,7 +16,7 @@ import io.legado.app.data.entities.*
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
RssSource::class, Bookmark::class, RssArticle::class, RssReadRecord::class,
RssStar::class, TxtTocRule::class, ReadRecord::class, HttpTTS::class],
version = 19,
version = 20,
exportSchema = true
)
abstract class AppDatabase : RoomDatabase() {
@ -36,7 +36,8 @@ abstract class AppDatabase : RoomDatabase() {
migration_14_15,
migration_15_17,
migration_17_18,
migration_18_19
migration_18_19,
migration_19_20
)
.allowMainThreadQueries()
.build()
@ -112,6 +113,11 @@ abstract class AppDatabase : RoomDatabase() {
database.execSQL("ALTER TABLE readRecordNew RENAME TO readRecord")
}
}
private val migration_19_20 = object : Migration(19,20) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE book_sources ADD bookSourceComment TEXT")
}
}
}
abstract fun bookDao(): BookDao

@ -28,6 +28,7 @@ object OldRule {
bookSourceName = jsonItem.readString("bookSourceName") ?: ""
bookSourceGroup = jsonItem.readString("bookSourceGroup")
loginUrl = jsonItem.readString("loginUrl")
bookSourceComment = jsonItem.readString("bookSourceComment") ?: ""
bookUrlPattern = jsonItem.readString("ruleBookUrlPattern")
customOrder = jsonItem.readInt("serialNumber") ?: 0
header = uaToHeader(jsonItem.readString("httpUserAgent"))
@ -96,6 +97,7 @@ object OldRule {
source.enabledExplore = sourceAny.enabledExplore
source.header = sourceAny.header
source.loginUrl = sourceAny.loginUrl
source.bookSourceComment = sourceAny.bookSourceComment
source.lastUpdateTime = sourceAny.lastUpdateTime
source.weight = sourceAny.weight
source.exploreUrl = sourceAny.exploreUrl
@ -144,6 +146,7 @@ object OldRule {
var enabledExplore: Boolean = true, // 启用发现
var header: String? = null, // 请求头
var loginUrl: String? = null, // 登录地址
var bookSourceComment: String? = "", //书源注释
var lastUpdateTime: Long = 0, // 最后更新时间,用于排序
var weight: Int = 0, // 智能排序的权重
var exploreUrl: String? = null, // 发现url

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="comment">comment</string>
</resources>
Loading…
Cancel
Save