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( Manga.updateMangaAndChapters(
mangaId = id, mangaId = id,
updateManga = fetchManga, updateManga = fetchManga,
updateChapters = fetchChapters updateChapters = fetchChapters,
) )
val (manga, chapters) = val (manga, chapters) =

View File

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

View File

@@ -121,6 +121,14 @@ fun NetworkExtensionStore.toExtensionInfos(store: ExtensionStore): List<Extensio
name = source.name, name = source.name,
lang = source.language, lang = source.language,
homeUrl = source.homeUrl, 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, name = name,
lang = lang, lang = lang,
homeUrl = "", homeUrl = "",
message = null,
contentRating = if (nsfw == 1) ContentRating.PORNOGRAPHIC else ContentRating.SAFE,
), ),
) )
} else { } else {
@@ -67,6 +69,8 @@ fun NetworkLegacyExtension.toExtensionInfo(
name = source.name, name = source.name,
lang = source.lang, lang = source.lang,
homeUrl = source.baseUrl, 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}" } logger.info { "Updating ${job.manga}" }
Manga.updateMangaAndChapters( Manga.updateMangaAndChapters(
job.manga.id, job.manga.id,
updateManga = serverConfig.updateMangas.value || !job.manga.initialized updateManga = serverConfig.updateMangas.value || !job.manga.initialized,
) )
job.copy(status = JobStatus.COMPLETE) job.copy(status = JobStatus.COMPLETE)
} catch (e: Exception) { } catch (e: Exception) {

View File

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

View File

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