Cleanup MangaPlus stuff, only keep what SY uses
This commit is contained in:
parent
c0a3406335
commit
07d13aed4e
@ -1,113 +1,21 @@
|
||||
package exh.md.dto
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Serializer
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@Serializer(forClass = MangaPlusResponse::class)
|
||||
object MangaPlusSerializer
|
||||
|
||||
@Serializable
|
||||
data class MangaPlusResponse(
|
||||
@ProtoNumber(1) val success: SuccessResult? = null,
|
||||
@ProtoNumber(2) val error: ErrorResult? = null
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ErrorResult(
|
||||
@ProtoNumber(1) val action: Action,
|
||||
@ProtoNumber(2) val englishPopup: Popup,
|
||||
@ProtoNumber(3) val spanishPopup: Popup
|
||||
)
|
||||
|
||||
enum class Action { DEFAULT, UNAUTHORIZED, MAINTAINENCE, GEOIP_BLOCKING }
|
||||
|
||||
@Serializable
|
||||
data class Popup(
|
||||
@ProtoNumber(1) val subject: String,
|
||||
@ProtoNumber(2) val body: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SuccessResult(
|
||||
@ProtoNumber(1) val isFeaturedUpdated: Boolean? = false,
|
||||
@ProtoNumber(5) val allTitlesView: AllTitlesView? = null,
|
||||
@ProtoNumber(6) val titleRankingView: TitleRankingView? = null,
|
||||
@ProtoNumber(8) val titleDetailView: TitleDetailView? = null,
|
||||
@ProtoNumber(10) val mangaViewer: MangaViewer? = null,
|
||||
@ProtoNumber(11) val webHomeView: WebHomeView? = null
|
||||
@ProtoNumber(10) val mangaViewer: MangaViewer? = null
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class TitleRankingView(@ProtoNumber(1) val titles: List<Title> = emptyList())
|
||||
|
||||
@Serializable
|
||||
data class AllTitlesView(@ProtoNumber(1) val titles: List<Title> = emptyList())
|
||||
|
||||
@Serializable
|
||||
data class WebHomeView(@ProtoNumber(2) val groups: List<UpdatedTitleGroup> = emptyList())
|
||||
|
||||
@Serializable
|
||||
data class TitleDetailView(
|
||||
@ProtoNumber(1) val title: Title,
|
||||
@ProtoNumber(2) val titleImageUrl: String,
|
||||
@ProtoNumber(3) val overview: String,
|
||||
@ProtoNumber(4) val backgroundImageUrl: String,
|
||||
@ProtoNumber(5) val nextTimeStamp: Int = 0,
|
||||
@ProtoNumber(6) val updateTiming: UpdateTiming? = UpdateTiming.DAY,
|
||||
@ProtoNumber(7) val viewingPeriodDescription: String = "",
|
||||
@ProtoNumber(9) val firstChapterList: List<Chapter> = emptyList(),
|
||||
@ProtoNumber(10) val lastChapterList: List<Chapter> = emptyList(),
|
||||
@ProtoNumber(14) val isSimulReleased: Boolean = true,
|
||||
@ProtoNumber(17) val chaptersDescending: Boolean = true
|
||||
)
|
||||
|
||||
enum class UpdateTiming { NOT_REGULARLY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY, DAY }
|
||||
|
||||
@Serializable
|
||||
data class MangaViewer(@ProtoNumber(1) val pages: List<MangaPlusPage> = emptyList())
|
||||
|
||||
@Serializable
|
||||
data class Title(
|
||||
@ProtoNumber(1) val titleId: Int,
|
||||
@ProtoNumber(2) val name: String,
|
||||
@ProtoNumber(3) val author: String,
|
||||
@ProtoNumber(4) val portraitImageUrl: String,
|
||||
@ProtoNumber(5) val landscapeImageUrl: String,
|
||||
@ProtoNumber(6) val viewCount: Int,
|
||||
@ProtoNumber(7) val language: Language? = Language.ENGLISH
|
||||
)
|
||||
|
||||
@Serializable
|
||||
enum class Language(val id: Int) {
|
||||
@ProtoNumber(0)
|
||||
ENGLISH(0),
|
||||
|
||||
@ProtoNumber(1)
|
||||
SPANISH(1)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class UpdatedTitleGroup(
|
||||
@ProtoNumber(1) val groupName: String,
|
||||
@ProtoNumber(2) val titles: List<UpdatedTitle> = emptyList()
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class UpdatedTitle(
|
||||
@ProtoNumber(1) val title: Title? = null
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Chapter(
|
||||
@ProtoNumber(1) val titleId: Int,
|
||||
@ProtoNumber(2) val chapterId: Int,
|
||||
@ProtoNumber(3) val name: String,
|
||||
@ProtoNumber(4) val subTitle: String? = null,
|
||||
@ProtoNumber(6) val startTimeStamp: Int,
|
||||
@ProtoNumber(7) val endTimeStamp: Int
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class MangaPlusPage(@ProtoNumber(1) val page: MangaPage? = null)
|
||||
|
||||
|
@ -3,7 +3,8 @@ package exh.md.handlers
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.await
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import exh.md.dto.MangaPlusSerializer
|
||||
import exh.md.dto.MangaPlusResponse
|
||||
import kotlinx.serialization.decodeFromByteArray
|
||||
import kotlinx.serialization.protobuf.ProtoBuf
|
||||
import okhttp3.Headers
|
||||
import okhttp3.Interceptor
|
||||
@ -39,7 +40,7 @@ class MangaPlusHandler(currentClient: OkHttpClient) {
|
||||
}
|
||||
|
||||
private fun pageListParse(response: Response): List<Page> {
|
||||
val result = ProtoBuf.decodeFromByteArray(MangaPlusSerializer, response.body!!.bytes())
|
||||
val result = ProtoBuf.decodeFromByteArray<MangaPlusResponse>(response.body!!.bytes())
|
||||
|
||||
if (result.success == null) {
|
||||
throw Exception("error getting images")
|
||||
|
Loading…
x
Reference in New Issue
Block a user