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 d5c43ef7e..20d8c8ce1 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 @@ -46,6 +46,17 @@ data class BookSource( var ruleContent: ContentRule? = null // 正文页规则 ) : Parcelable, JsExtensions { + @delegate:Transient + @delegate:Ignore + @IgnoredOnParcel + val logInRule by lazy { + if (loginUrl.isJsonObject()) { + return@lazy GSON.fromJsonObject(loginUrl) + } else { + return@lazy LogInRule(url = loginUrl) + } + } + @delegate:Transient @delegate:Ignore @IgnoredOnParcel diff --git a/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt index f8046237c..7b0fb908c 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt @@ -1,7 +1,11 @@ package io.legado.app.data.entities.rule +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize data class LogInRule( - val ui: HashMap, - val logInUrl: String, - val checkJs: String -) \ No newline at end of file + val ui: HashMap? = null, + val url: String? = null, + val checkJs: String? = null +) : Parcelable \ No newline at end of file