[feat] Comic Reader

This commit is contained in:
acite
2025-09-01 20:41:28 +08:00
parent ea574895ab
commit daa66a9ecc
12 changed files with 703 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
package com.acitelight.aether.service
import com.acitelight.aether.model.ChallengeResponse
import com.acitelight.aether.model.Comic
import com.acitelight.aether.model.ComicResponse
import com.acitelight.aether.model.VideoResponse
import okhttp3.ResponseBody
import retrofit2.http.Body
@@ -9,7 +9,6 @@ import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import retrofit2.http.Streaming
interface ApiInterface {
@GET("api/video")
@@ -28,18 +27,10 @@ interface ApiInterface {
@Query("token") token: String
): VideoResponse
@GET("api/video/{klass}/{id}/nv")
@Streaming
suspend fun getNailVideo(
@Path("klass") klass: String,
@Path("id") id: String,
@Query("token") token: String
): ResponseBody
@GET("api/image/collections")
suspend fun getComicCollections(): List<String>
@GET("api/image/meta")
suspend fun queryComicInfo(@Query("collection") collection: String): Comic
@GET("api/image")
suspend fun getComics(@Query("token") token: String): List<String>
@GET("api/image/{id}")
suspend fun queryComicInfo(@Path("id") id: String, @Query("token") token: String): ComicResponse
@GET("api/user/{user}")

View File

@@ -1,10 +1,8 @@
package com.acitelight.aether.service
import com.acitelight.aether.model.Comic
import com.acitelight.aether.model.ComicResponse
import com.acitelight.aether.model.Video
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.io.IOException
object MediaManager
@@ -52,13 +50,23 @@ object MediaManager
suspend fun listComics() : List<String>
{
// TODO: try
return ApiClient.api!!.getComicCollections()
try{
val j = ApiClient.api!!.getComics(token)
return j
}catch (e: Exception)
{
return listOf()
}
}
suspend fun queryComicInfo(c: String) : Comic
suspend fun queryComicInfo(id: String) : Comic?
{
// TODO: try
return ApiClient.api!!.queryComicInfo(c)
try{
val j = ApiClient.api!!.queryComicInfo(id, token)
return Comic(id = id, comic = j, token = token)
}catch (e: Exception)
{
return null
}
}
}