Merge pull request #1869 from Xwite/master

fix(书源导入):no path $.sourceUrls find
pull/1894/head
kunfei 3 years ago committed by GitHub
commit b404a1831e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt

@ -90,13 +90,14 @@ class ImportBookSourceViewModel(app: Application) : BaseViewModel(app) {
val mText = text.trim()
when {
mText.isJsonObject() -> {
kotlin.runCatching {
val json = JsonPath.parse(mText)
val urls = json.read<List<String>>("$.sourceUrls")
if (!urls.isNullOrEmpty()) {
urls.forEach {
json.read<List<String>>("$.sourceUrls")
}.onSuccess {
it.forEach {
importSourceUrl(it)
}
} else {
}.onFailure {
BookSource.fromJson(mText).getOrThrow().let {
allSources.add(it)
}

Loading…
Cancel
Save