mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-15 00:34:12 -05:00
TextExtensionCompatibility fix
This commit is contained in:
@@ -27,6 +27,7 @@ import suwayomi.tachidesk.manga.impl.Source.getSourceList
|
|||||||
import suwayomi.tachidesk.manga.impl.extension.Extension.installExtension
|
import suwayomi.tachidesk.manga.impl.extension.Extension.installExtension
|
||||||
import suwayomi.tachidesk.manga.impl.extension.Extension.uninstallExtension
|
import suwayomi.tachidesk.manga.impl.extension.Extension.uninstallExtension
|
||||||
import suwayomi.tachidesk.manga.impl.extension.Extension.updateExtension
|
import suwayomi.tachidesk.manga.impl.extension.Extension.updateExtension
|
||||||
|
import suwayomi.tachidesk.manga.impl.extension.ExtensionStoreService
|
||||||
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList.getExtensionList
|
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList.getExtensionList
|
||||||
import suwayomi.tachidesk.manga.impl.util.source.GetSource.getSourceOrNull
|
import suwayomi.tachidesk.manga.impl.util.source.GetSource.getSourceOrNull
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.ExtensionDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.ExtensionDataClass
|
||||||
@@ -50,6 +51,8 @@ class TestExtensionCompatibility {
|
|||||||
private val chaptersToFetch = mutableListOf<Triple<HttpSource, SManga, SChapter>>()
|
private val chaptersToFetch = mutableListOf<Triple<HttpSource, SManga, SChapter>>()
|
||||||
private val chaptersPageListFailedToFetch = mutableListOf<Triple<HttpSource, Pair<SManga, SChapter>, Exception>>()
|
private val chaptersPageListFailedToFetch = mutableListOf<Triple<HttpSource, Pair<SManga, SChapter>, Exception>>()
|
||||||
|
|
||||||
|
val repos = listOf<String>()
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
fun setup() {
|
fun setup() {
|
||||||
val dataRoot = File(BASE_PATH).absolutePath
|
val dataRoot = File(BASE_PATH).absolutePath
|
||||||
@@ -57,6 +60,13 @@ class TestExtensionCompatibility {
|
|||||||
Looper.clearMainLooperForTest()
|
Looper.clearMainLooperForTest()
|
||||||
SettingsRegistry.clear()
|
SettingsRegistry.clear()
|
||||||
applicationSetup()
|
applicationSetup()
|
||||||
|
repos.forEach {
|
||||||
|
val store = runBlocking {
|
||||||
|
ExtensionStoreService.fetch(it)
|
||||||
|
}
|
||||||
|
ExtensionStoreService.upsert(store)
|
||||||
|
}
|
||||||
|
ExtensionStoreService.syncDbToPrefs()
|
||||||
setLoggingEnabled(false)
|
setLoggingEnabled(false)
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
@@ -72,7 +82,9 @@ class TestExtensionCompatibility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
uninstallExtension(it.pkgName)
|
try {
|
||||||
|
uninstallExtension(it.pkgName)
|
||||||
|
} catch (_: Exception) {}
|
||||||
installExtension(it.pkgName)
|
installExtension(it.pkgName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,9 +147,9 @@ class TestExtensionCompatibility {
|
|||||||
repeat { source.getMangaUpdate(manga, emptyList(), true, true) }
|
repeat { source.getMangaUpdate(manga, emptyList(), true, true) }
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.warn {
|
logger.warn {
|
||||||
"Failed to fetch manga info and chapters from $source for ${manga.title} (${source.mangaDetailsRequest(
|
"Failed to fetch manga info and chapters from $source for ${manga.title} (${source.getMangaUrl(
|
||||||
manga,
|
manga,
|
||||||
).url}): ${e.message}"
|
)}): ${e.message}"
|
||||||
}
|
}
|
||||||
mangaFailedToFetch += Triple(source, manga, e)
|
mangaFailedToFetch += Triple(source, manga, e)
|
||||||
}
|
}
|
||||||
@@ -147,7 +159,7 @@ class TestExtensionCompatibility {
|
|||||||
File("$BASE_PATH/MangaFailedToFetch.txt").writeText(
|
File("$BASE_PATH/MangaFailedToFetch.txt").writeText(
|
||||||
mangaFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
mangaFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
||||||
"${source.name} (${source.lang}, ${source.id}):" +
|
"${source.name} (${source.lang}, ${source.id}):" +
|
||||||
" ${manga.title} (${source.mangaDetailsRequest(manga).url}):" +
|
" ${manga.title} (${source.getMangaUrl(manga)}):" +
|
||||||
" ${exception.message}"
|
" ${exception.message}"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -163,9 +175,9 @@ class TestExtensionCompatibility {
|
|||||||
repeat { source.getPageList(chapter) }
|
repeat { source.getPageList(chapter) }
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.warn {
|
logger.warn {
|
||||||
"Failed to fetch manga info from $source for ${manga.title} (${source.mangaDetailsRequest(
|
"Failed to fetch manga info from $source for ${manga.title} (${source.getMangaUrl(
|
||||||
manga,
|
manga,
|
||||||
).url}): ${e.message}"
|
)}): ${e.message}"
|
||||||
}
|
}
|
||||||
chaptersPageListFailedToFetch += Triple(source, manga to chapter, e)
|
chaptersPageListFailedToFetch += Triple(source, manga to chapter, e)
|
||||||
}
|
}
|
||||||
@@ -176,7 +188,7 @@ class TestExtensionCompatibility {
|
|||||||
File("$BASE_PATH/ChapterPageListFailedToFetch.txt").writeText(
|
File("$BASE_PATH/ChapterPageListFailedToFetch.txt").writeText(
|
||||||
chaptersPageListFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
chaptersPageListFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
||||||
"${source.name} (${source.lang}, ${source.id}):" +
|
"${source.name} (${source.lang}, ${source.id}):" +
|
||||||
" ${manga.first.title} (${source.mangaDetailsRequest(manga.first).url}):" +
|
" ${manga.first.title} (${source.getMangaUrl(manga.first)}):" +
|
||||||
" ${manga.second.name} (${manga.second.url}): ${exception.message}"
|
" ${manga.second.name} (${manga.second.url}): ${exception.message}"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user