diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index 78739d9ca..761bd9830 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.kt @@ -16,7 +16,7 @@ val appDb by lazy { } @Database( - version = 38, + version = 39, exportSchema = true, entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class, ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class, diff --git a/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt b/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt index 376bc5197..6ecd85054 100644 --- a/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt +++ b/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt @@ -34,7 +34,8 @@ object DatabaseMigrations { migration_34_35, migration_35_36, migration_36_37, - migration_37_38 + migration_37_38, + migration_38_39 ) } @@ -294,7 +295,7 @@ object DatabaseMigrations { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL("ALTER TABLE `rssSources` ADD `loginUrl` TEXT") database.execSQL("ALTER TABLE `rssSources` ADD `loginUi` TEXT") - database.execSQL("ALTER TABLE `rssSources` ADD`loginCheckJs` TEXT") + database.execSQL("ALTER TABLE `rssSources` ADD `loginCheckJs` TEXT") } } @@ -303,4 +304,10 @@ object DatabaseMigrations { database.execSQL("ALTER TABLE `book_sources` ADD `respondTime` INTEGER NOT NULL DEFAULT 180000") } } + + private val migration_38_39 = object : Migration(38, 39) { + override fun migrate(database: SupportSQLiteDatabase) { + database.execSQL("ALTER TABLE `rssSources` ADD `concurrentRate` TEXT") + } + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/BaseSource.kt b/app/src/main/java/io/legado/app/data/entities/BaseSource.kt index 4e2ae0a9a..4f403b613 100644 --- a/app/src/main/java/io/legado/app/data/entities/BaseSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BaseSource.kt @@ -17,8 +17,9 @@ import javax.script.SimpleBindings @Suppress("unused") interface BaseSource : JsExtensions { - var loginUrl: String? - var header: String? + var concurrentRate: String? // 并发率 + var loginUrl: String? // 登录地址 + var header: String? // 请求头 fun getStoreUrl(): String diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index 0543b9587..c72b0dc4f 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -23,12 +23,12 @@ data class BookSource( var bookSourceUrl: String = "", // 地址,包括 http/https var bookSourceType: Int = BookType.default, // 类型,0 文本,1 音频, 3 图片 var bookUrlPattern: String? = null, // 详情页url正则 - var concurrentRate: String? = null, //并发率 var customOrder: Int = 0, // 手动排序编号 var enabled: Boolean = true, // 是否启用 var enabledExplore: Boolean = true, // 启用发现 + override var concurrentRate: String? = null, //并发率 override var header: String? = null, // 请求头 - override var loginUrl: String? = null, // 登录地址 + override var loginUrl: String? = null, // 登录地址 var loginUi: List? = null, //登录UI var loginCheckJs: String? = null, //登录检测js var bookSourceComment: String? = null, // 注释 diff --git a/app/src/main/java/io/legado/app/data/entities/RssSource.kt b/app/src/main/java/io/legado/app/data/entities/RssSource.kt index 424064f11..2127067cb 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssSource.kt @@ -20,9 +20,10 @@ data class RssSource( var sourceGroup: String? = null, var sourceComment: String? = null, var enabled: Boolean = true, + override var concurrentRate: String? = null, //并发率 override var header: String? = null, // 请求头 - override var loginUrl: String? = null, // 登录地址 - var loginUi: List? = null, //登录UI + override var loginUrl: String? = null, // 登录地址 + var loginUi: List? = null, //登录UI var loginCheckJs: String? = null, //登录检测js var sortUrl: String? = null, var singleUrl: Boolean = false, diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index b55fab5b8..bb2c0cf82 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -270,6 +270,7 @@ class AnalyzeUrl( if (type != null) { return StrResponse(url, StringUtils.byteToHexString(getByteArray())) } + setCookie(source?.getStoreUrl()) if (useWebView) { val params = AjaxWebView.AjaxParams(url)