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