mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-29 22:24:31 +02:00
feat: Improve routing paths
This commit is contained in:
parent
80c8083610
commit
df999c00c4
@ -18,32 +18,34 @@ fun Application.configureRouting() {
|
|||||||
routing {
|
routing {
|
||||||
route("/v${configuration.apiVersion}") {
|
route("/v${configuration.apiVersion}") {
|
||||||
route("/patches") {
|
route("/patches") {
|
||||||
get {
|
route("latest") {
|
||||||
val patches = backend.getRelease(configuration.organization, configuration.patchesRepository)
|
get {
|
||||||
val integrations = configuration.integrationsRepositoryNames.map {
|
val patches = backend.getRelease(configuration.organization, configuration.patchesRepository)
|
||||||
async { backend.getRelease(configuration.organization, it) }
|
val integrations = configuration.integrationsRepositoryNames.map {
|
||||||
}.awaitAll()
|
async { backend.getRelease(configuration.organization, it) }
|
||||||
|
}.awaitAll()
|
||||||
|
|
||||||
val assets = (patches.assets + integrations.flatMap { it.assets }).filter {
|
val assets = (patches.assets + integrations.flatMap { it.assets }).filter {
|
||||||
it.downloadUrl.endsWith(".apk") || it.downloadUrl.endsWith(".jar")
|
it.downloadUrl.endsWith(".apk") || it.downloadUrl.endsWith(".jar")
|
||||||
}.map { APIAsset(it.downloadUrl) }.toSet()
|
}.map { APIAsset(it.downloadUrl) }.toSet()
|
||||||
|
|
||||||
val release = APIRelease(
|
val release = APIRelease(
|
||||||
patches.tag,
|
patches.tag,
|
||||||
patches.createdAt,
|
patches.createdAt,
|
||||||
patches.releaseNote,
|
patches.releaseNote,
|
||||||
assets
|
assets
|
||||||
)
|
)
|
||||||
|
|
||||||
call.respond(release)
|
call.respond(release)
|
||||||
}
|
}
|
||||||
|
|
||||||
get("/version") {
|
get("/version") {
|
||||||
val patches = backend.getRelease(configuration.organization, configuration.patchesRepository)
|
val patches = backend.getRelease(configuration.organization, configuration.patchesRepository)
|
||||||
|
|
||||||
val release = APIReleaseVersion(patches.tag)
|
val release = APIReleaseVersion(patches.tag)
|
||||||
|
|
||||||
call.respond(release)
|
call.respond(release)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user