@ -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"),