|
|
|
@ -5,11 +5,7 @@ import io.legado.app.constant.BookType |
|
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
|
import io.legado.app.data.entities.rule.* |
|
|
|
|
import io.legado.app.help.storage.Restore.jsonPath |
|
|
|
|
import io.legado.app.utils.GSON |
|
|
|
|
import io.legado.app.utils.fromJsonObject |
|
|
|
|
import io.legado.app.utils.readInt |
|
|
|
|
import io.legado.app.utils.readString |
|
|
|
|
import io.legado.app.utils.readBool |
|
|
|
|
import io.legado.app.utils.* |
|
|
|
|
import java.util.regex.Pattern |
|
|
|
|
|
|
|
|
|
object OldRule { |
|
|
|
@ -129,7 +125,10 @@ object OldRule { |
|
|
|
|
newRule = newRule.replace("|", "||") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (newRule.contains("&") && !newRule.contains("&&")) { |
|
|
|
|
if (newRule.contains("&") |
|
|
|
|
&& !newRule.contains("&&") |
|
|
|
|
&& !newRule.contains("http") |
|
|
|
|
) { |
|
|
|
|
newRule = newRule.replace("&", "&&") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -145,10 +144,9 @@ object OldRule { |
|
|
|
|
return toNewUrl(oldUrls) |
|
|
|
|
|
|
|
|
|
val urls = oldUrls.split("(&&|\n)+".toRegex()) |
|
|
|
|
val newUrls = urls.map { |
|
|
|
|
toNewUrl(it)?.replace("\n\\s*".toRegex(),"") |
|
|
|
|
return urls.map { |
|
|
|
|
toNewUrl(it)?.replace("\n\\s*".toRegex(), "") |
|
|
|
|
}.joinToString("\n") |
|
|
|
|
return newUrls |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun toNewUrl(oldUrl: String?): String? { |
|
|
|
|