Skip to content

Commit

Permalink
feat: 仓库详情种添加最新发布版本&首页添加TvBox的仓库
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Dec 25, 2024
1 parent fc4ea48 commit ad96729
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class MainScreenService : IMainScreenService {
detailUrl = "",
coverImageUrl = "https://github.githubassets.com/assets/github-octocat-13c86b8b336d.png",
),
MediaCard(
id = "muedsa/TvBox",
title = "muedsa/TvBox",
subTitle = "TvBox仓库",
detailUrl = "muedsa/TvBox",
coverImageUrl = GithubHelper.createRepoGraphImageUrl("muedsa/TvBox"),
),
MediaCard(
id = "muedsa/github-plugin-downloader",
title = "muedsa/github-plugin-downloader",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ class MediaDetailService(
val resp = "https://api.github.com/repos/${owner}/${repo}/releases/latest"
.toRequestBuild()
.get(okHttpClient = okHttpClient)
val playSourceList = if (resp.isSuccessful) {
var description = repository.description ?: ""
val playSourceList: List<MediaPlaySource>
if (resp.isSuccessful) {
val release = LenientJson.decodeFromString<Release>(resp.stringBody())
listOf(
playSourceList = listOf(
MediaPlaySource(
id = "github",
name = "github",
name = "发布版本:${release.name}",
episodeList = buildList {
release.assets
.filter { it.name.endsWith(".tbp") && it.contentType == "application/octet-stream" }
.filter {
(it.name.endsWith(".tbp") && it.contentType == "application/octet-stream")
|| (mediaId == "muedsa/TvBox" && it.contentType == "application/vnd.android.package-archive")
}
.forEach {
add(
MediaEpisode(
Expand Down Expand Up @@ -93,13 +98,16 @@ class MediaDetailService(
}
)
)
} else emptyList()
description = "${description}\n\n最新版本:${release.name}"
} else {
playSourceList = emptyList()
}
val repoImageUrl = GithubHelper.createRepoGraphImageUrl(repository.fullName)
return MediaDetail(
id = repository.fullName,
title = repository.fullName,
subTitle = repository.owner.login,
description = repository.description,
description = description,
detailUrl = repository.fullName,
backgroundImageUrl = repoImageUrl,
playSourceList = playSourceList,
Expand Down

0 comments on commit ad96729

Please sign in to comment.