mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-29 22:24:31 +02:00
feat: Move /latest routes to parent
There is only ever current releases, so a latest route doesn't make sense.
This commit is contained in:
parent
e113daa089
commit
4e8e83db1a
@ -16,8 +16,7 @@ import org.koin.ktor.ext.get as koinGet
|
|||||||
internal fun Route.managerRoute() = route("manager") {
|
internal fun Route.managerRoute() = route("manager") {
|
||||||
val managerService = koinGet<ManagerService>()
|
val managerService = koinGet<ManagerService>()
|
||||||
|
|
||||||
route("latest") {
|
installManagerRouteDocumentation()
|
||||||
installLatestManagerRouteDocumentation()
|
|
||||||
|
|
||||||
rateLimit(RateLimitName("weak")) {
|
rateLimit(RateLimitName("weak")) {
|
||||||
get {
|
get {
|
||||||
@ -25,22 +24,21 @@ internal fun Route.managerRoute() = route("manager") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
route("version") {
|
route("version") {
|
||||||
installLatestManagerVersionRouteDocumentation()
|
installManagerVersionRouteDocumentation()
|
||||||
|
|
||||||
get {
|
get {
|
||||||
call.respond(managerService.latestVersion())
|
call.respond(managerService.latestVersion())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Route.installLatestManagerRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installManagerRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Manager")
|
tags = setOf("Manager")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
description("Get the latest manager release")
|
description("Get the current manager release")
|
||||||
summary("Get latest manager release")
|
summary("Get current manager release")
|
||||||
response {
|
response {
|
||||||
description("The latest manager release")
|
description("The latest manager release")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
@ -50,14 +48,14 @@ private fun Route.installLatestManagerRouteDocumentation() = installNotarizedRou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Route.installLatestManagerVersionRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installManagerVersionRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Manager")
|
tags = setOf("Manager")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
description("Get the latest manager release version")
|
description("Get the current manager release version")
|
||||||
summary("Get latest manager release version")
|
summary("Get current manager release version")
|
||||||
response {
|
response {
|
||||||
description("The latest manager release version")
|
description("The current manager release version")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
responseCode(HttpStatusCode.OK)
|
responseCode(HttpStatusCode.OK)
|
||||||
responseType<APIReleaseVersion>()
|
responseType<APIReleaseVersion>()
|
||||||
|
@ -19,8 +19,7 @@ import org.koin.ktor.ext.get as koinGet
|
|||||||
internal fun Route.patchesRoute() = route("patches") {
|
internal fun Route.patchesRoute() = route("patches") {
|
||||||
val patchesService = koinGet<PatchesService>()
|
val patchesService = koinGet<PatchesService>()
|
||||||
|
|
||||||
route("latest") {
|
installPatchesRouteDocumentation()
|
||||||
installLatestPatchesRouteDocumentation()
|
|
||||||
|
|
||||||
rateLimit(RateLimitName("weak")) {
|
rateLimit(RateLimitName("weak")) {
|
||||||
get {
|
get {
|
||||||
@ -28,7 +27,7 @@ internal fun Route.patchesRoute() = route("patches") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
route("version") {
|
route("version") {
|
||||||
installLatestPatchesVersionRouteDocumentation()
|
installPatchesVersionRouteDocumentation()
|
||||||
|
|
||||||
get {
|
get {
|
||||||
call.respond(patchesService.latestVersion())
|
call.respond(patchesService.latestVersion())
|
||||||
@ -38,14 +37,13 @@ internal fun Route.patchesRoute() = route("patches") {
|
|||||||
|
|
||||||
rateLimit(RateLimitName("strong")) {
|
rateLimit(RateLimitName("strong")) {
|
||||||
route("list") {
|
route("list") {
|
||||||
installLatestPatchesListRouteDocumentation()
|
installPatchesListRouteDocumentation()
|
||||||
|
|
||||||
get {
|
get {
|
||||||
call.respondBytes(ContentType.Application.Json) { patchesService.list() }
|
call.respondBytes(ContentType.Application.Json) { patchesService.list() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rateLimit(RateLimitName("strong")) {
|
rateLimit(RateLimitName("strong")) {
|
||||||
route("keys") {
|
route("keys") {
|
||||||
@ -60,14 +58,14 @@ internal fun Route.patchesRoute() = route("patches") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Route.installLatestPatchesRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installPatchesRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Patches")
|
tags = setOf("Patches")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
description("Get the latest patches release")
|
description("Get the current patches release")
|
||||||
summary("Get latest patches release")
|
summary("Get current patches release")
|
||||||
response {
|
response {
|
||||||
description("The latest patches release")
|
description("The current patches release")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
responseCode(HttpStatusCode.OK)
|
responseCode(HttpStatusCode.OK)
|
||||||
responseType<APIRelease<APIPatchesAsset>>()
|
responseType<APIRelease<APIPatchesAsset>>()
|
||||||
@ -75,14 +73,14 @@ private fun Route.installLatestPatchesRouteDocumentation() = installNotarizedRou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Route.installLatestPatchesVersionRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installPatchesVersionRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Patches")
|
tags = setOf("Patches")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
description("Get the latest patches release version")
|
description("Get the current patches release version")
|
||||||
summary("Get latest patches release version")
|
summary("Get current patches release version")
|
||||||
response {
|
response {
|
||||||
description("The latest patches release version")
|
description("The current patches release version")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
responseCode(HttpStatusCode.OK)
|
responseCode(HttpStatusCode.OK)
|
||||||
responseType<APIReleaseVersion>()
|
responseType<APIReleaseVersion>()
|
||||||
@ -90,12 +88,12 @@ private fun Route.installLatestPatchesVersionRouteDocumentation() = installNotar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Route.installLatestPatchesListRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installPatchesListRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Patches")
|
tags = setOf("Patches")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
description("Get the list of patches from the latest patches release")
|
description("Get the list of patches from the current patches release")
|
||||||
summary("Get list of patches from latest patches release")
|
summary("Get list of patches from current patches release")
|
||||||
response {
|
response {
|
||||||
description("The list of patches")
|
description("The list of patches")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user