mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2025-01-24 22:41:19 +01:00
popular manga api done
This commit is contained in:
parent
f20c51c558
commit
c9c96e7d60
@ -15,7 +15,8 @@ class Main {
|
|||||||
val app = Javalin.create().start(4567)
|
val app = Javalin.create().start(4567)
|
||||||
|
|
||||||
app.before() { ctx ->
|
app.before() { ctx ->
|
||||||
ctx.header("Access-Control-Allow-Origin", "*") // allow the client which is running on another port
|
// allow the client which is running on another port
|
||||||
|
ctx.header("Access-Control-Allow-Origin", "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get("/api/v1/extension/list") { ctx ->
|
app.get("/api/v1/extension/list") { ctx ->
|
||||||
@ -36,7 +37,7 @@ class Main {
|
|||||||
|
|
||||||
app.get("/api/v1/source/:source_id/popular") { ctx ->
|
app.get("/api/v1/source/:source_id/popular") { ctx ->
|
||||||
val sourceId = ctx.pathParam("source_id")
|
val sourceId = ctx.pathParam("source_id")
|
||||||
// ctx.json(getPopularManga(sourceId))
|
ctx.json(getPopularManga(sourceId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,25 @@ package ir.armor.tachidesk.util
|
|||||||
|
|
||||||
import ir.armor.tachidesk.database.dataclass.MangaDataClass
|
import ir.armor.tachidesk.database.dataclass.MangaDataClass
|
||||||
import ir.armor.tachidesk.database.entity.SourceEntity
|
import ir.armor.tachidesk.database.entity.SourceEntity
|
||||||
|
import ir.armor.tachidesk.database.table.MangaStatus
|
||||||
|
|
||||||
//fun getPopularManga(sourceId: String): List<MangaDataClass> {
|
fun getPopularManga(sourceId: String): List<MangaDataClass> {
|
||||||
// SourceEntity.findById(sourceId.toLong())
|
val manguasPage = getHttpSource(sourceId.toLong()).fetchPopularManga(1).toBlocking().first()
|
||||||
//}
|
return manguasPage.mangas.map {
|
||||||
|
MangaDataClass(
|
||||||
|
sourceId.toLong(),
|
||||||
|
|
||||||
|
it.url,
|
||||||
|
it.title,
|
||||||
|
it.thumbnail_url,
|
||||||
|
|
||||||
|
it.initialized,
|
||||||
|
|
||||||
|
it.artist,
|
||||||
|
it.author,
|
||||||
|
it.description,
|
||||||
|
it.genre,
|
||||||
|
MangaStatus.values().first { that -> it.status == that.status }.name,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user