This commit is contained in:
Syer10
2026-06-17 13:39:53 -04:00
parent 3cf4cf6cf8
commit 4b61d375ed
7 changed files with 24 additions and 7 deletions

View File

@@ -190,7 +190,7 @@ class MangaMutation {
Manga.updateMangaAndChapters(
mangaId = id,
updateManga = fetchManga,
updateChapters = fetchChapters
updateChapters = fetchChapters,
)
val (manga, chapters) =

View File

@@ -160,8 +160,9 @@ object Manga {
mangaInfoMutex.get(mangaId) { Mutex() }.withLock {
var mangaEntry =
transaction { MangaTable.selectAll().where { MangaTable.id eq mangaId }.first() }
val source = getCatalogueSourceOrNull(mangaEntry[MangaTable.sourceReference])
?: throw NullPointerException("Missing source ${mangaEntry[MangaTable.sourceReference]}")
val source =
getCatalogueSourceOrNull(mangaEntry[MangaTable.sourceReference])
?: throw NullPointerException("Missing source ${mangaEntry[MangaTable.sourceReference]}")
val mangaUpdate =
fetchMangaAndChapters(
mangaEntry,
@@ -172,9 +173,10 @@ object Manga {
if (updateManga) {
updateMangaDatabase(mangaEntry, source, mangaUpdate.manga)
mangaEntry = transaction {
MangaTable.selectAll().where { MangaTable.id eq mangaId }.first()
}
mangaEntry =
transaction {
MangaTable.selectAll().where { MangaTable.id eq mangaId }.first()
}
}
if (updateChapters) {
Chapter.updateChapterListDatabase(mangaEntry, mangaUpdate.chapters, source)

View File

@@ -121,6 +121,14 @@ fun NetworkExtensionStore.toExtensionInfos(store: ExtensionStore): List<Extensio
name = source.name,
lang = source.language,
homeUrl = source.homeUrl,
message = source.message,
contentRating =
when (source.contentRating) {
NetworkExtensionStore.ContentRating.SAFE -> ContentRating.SAFE
NetworkExtensionStore.ContentRating.SUGGESTIVE -> ContentRating.SUGGESTIVE
NetworkExtensionStore.ContentRating.EROTICA -> ContentRating.EROTICA
NetworkExtensionStore.ContentRating.PORNOGRAPHIC -> ContentRating.PORNOGRAPHIC
},
)
},
)

View File

@@ -58,6 +58,8 @@ fun NetworkLegacyExtension.toExtensionInfo(
name = name,
lang = lang,
homeUrl = "",
message = null,
contentRating = if (nsfw == 1) ContentRating.PORNOGRAPHIC else ContentRating.SAFE,
),
)
} else {
@@ -67,6 +69,8 @@ fun NetworkLegacyExtension.toExtensionInfo(
name = source.name,
lang = source.lang,
homeUrl = source.baseUrl,
message = null,
contentRating = if (nsfw == 1) ContentRating.PORNOGRAPHIC else ContentRating.SAFE,
)
}
},

View File

@@ -313,7 +313,7 @@ class Updater : IUpdater {
logger.info { "Updating ${job.manga}" }
Manga.updateMangaAndChapters(
job.manga.id,
updateManga = serverConfig.updateMangas.value || !job.manga.initialized
updateManga = serverConfig.updateMangas.value || !job.manga.initialized,
)
job.copy(status = JobStatus.COMPLETE)
} catch (e: Exception) {

View File

@@ -26,6 +26,8 @@ data class ExtensionSource(
val name: String,
val lang: String,
val homeUrl: String,
val message: String?,
val contentRating: ContentRating,
)
enum class ContentRating {

View File

@@ -66,6 +66,7 @@ fun createChapters(
this[ChapterTable.sourceOrder] = it
this[ChapterTable.isRead] = read
this[ChapterTable.manga] = mangaId
this[ChapterTable.memo] = "{}"
}
}
}