pull/32/head
kunfei 5 years ago
parent cfbc72cbd3
commit 3b62ce358f
  1. 6
      app/src/main/java/io/legado/app/help/storage/OldRule.kt
  2. 1
      app/src/main/java/io/legado/app/help/storage/Restore.kt

@ -45,4 +45,10 @@ object OldRule {
}
return url
}
fun uaToHeader(ua: String?): String? {
if (ua.isNullOrEmpty()) return null
val map = mapOf(Pair("user_agent", ua))
return GSON.toJson(map)
}
}

@ -109,6 +109,7 @@ object Restore {
source.loginUrl = jsonItem.readString("loginUrl")
source.bookUrlPattern = jsonItem.readString("ruleBookUrlPattern")
source.customOrder = jsonItem.readInt("serialNumber") ?: 0
source.header = OldRule.uaToHeader(jsonItem.readString("httpUserAgent"))
val searchRule = SearchRule(
searchUrl = OldRule.toNewUrl(jsonItem.readString("ruleSearchUrl")),
bookList = jsonItem.readString("ruleSearchList"),

Loading…
Cancel
Save