Skip to content

Commit

Permalink
feat: Remove deprecated routes and old API
Browse files Browse the repository at this point in the history
Backwards compatibility should be and is now handled by the reverse proxy.
  • Loading branch information
oSumAtrIX committed Nov 6, 2024
1 parent 0b66fc2 commit bfd817b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 137 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Some of the features ReVanced API include:
and links of the hoster of ReVanced API
- 🧩 **Patches**: Get the latest updates of ReVanced Patches, directly from ReVanced API
- 👥 **Contributors**: List all contributors involved in the project
- 🔄 **Backwards compatibility**: Proxy an old API for migration purposes and backwards compatibility

## 🚀 How to get started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ fun Application.configureDependencies(

AuthenticationService(issuer, validityInMin, jwtSecret, authSHA256DigestString)
}
singleOf(::OldApiService)
singleOf(::AnnouncementService)
singleOf(::SignatureService)
singleOf(::PatchesService)
Expand Down
4 changes: 0 additions & 4 deletions src/main/kotlin/app/revanced/api/configuration/Routing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import app.revanced.api.configuration.repository.ConfigurationRepository
import app.revanced.api.configuration.routes.*
import app.revanced.api.configuration.routes.announcementsRoute
import app.revanced.api.configuration.routes.apiRoute
import app.revanced.api.configuration.routes.oldApiRoute
import app.revanced.api.configuration.routes.patchesRoute
import io.bkbn.kompendium.core.routes.redoc
import io.bkbn.kompendium.core.routes.swagger
Expand Down Expand Up @@ -55,7 +54,4 @@ internal fun Application.configureRouting() = routing {

swagger(pageTitle = "ReVanced API", path = "/")
redoc(pageTitle = "ReVanced API", path = "/redoc")

// TODO: Remove, once migration period from v2 API is over (In 1-2 years).
oldApiRoute()
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,17 @@ import io.ktor.server.routing.*
import org.koin.ktor.ext.get as koinGet

internal fun Route.managerRoute() = route("manager") {
configure()

// TODO: Remove this deprecated route eventually.
route("latest") {
configure(deprecated = true)
}
}

private fun Route.configure(deprecated: Boolean = false) {
val managerService = koinGet<ManagerService>()

installManagerRouteDocumentation(deprecated)
installManagerRouteDocumentation()

rateLimit(RateLimitName("weak")) {
get {
call.respond(managerService.latestRelease())
}

route("version") {
installManagerVersionRouteDocumentation(deprecated)
installManagerVersionRouteDocumentation()

get {
call.respond(managerService.latestVersion())
Expand All @@ -41,11 +32,10 @@ private fun Route.configure(deprecated: Boolean = false) {
}
}

private fun Route.installManagerRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
private fun Route.installManagerRouteDocumentation() = installNotarizedRoute {
tags = setOf("Manager")

get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current manager release")
summary("Get current manager release")
response {
Expand All @@ -57,11 +47,10 @@ private fun Route.installManagerRouteDocumentation(deprecated: Boolean) = instal
}
}

private fun Route.installManagerVersionRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
private fun Route.installManagerVersionRouteDocumentation() = installNotarizedRoute {
tags = setOf("Manager")

get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current manager release version")
summary("Get current manager release version")
response {
Expand Down
19 changes: 0 additions & 19 deletions src/main/kotlin/app/revanced/api/configuration/routes/OldApi.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,17 @@ import kotlin.time.Duration.Companion.days
import org.koin.ktor.ext.get as koinGet

internal fun Route.patchesRoute() = route("patches") {
configure()

// TODO: Remove this deprecated route eventually.
route("latest") {
configure(deprecated = true)
}
}

private fun Route.configure(deprecated: Boolean = false) {
val patchesService = koinGet<PatchesService>()

installPatchesRouteDocumentation(deprecated)
installPatchesRouteDocumentation()

rateLimit(RateLimitName("weak")) {
get {
call.respond(patchesService.latestRelease())
}

route("version") {
installPatchesVersionRouteDocumentation(deprecated)
installPatchesVersionRouteDocumentation()

get {
call.respond(patchesService.latestVersion())
Expand All @@ -45,7 +36,7 @@ private fun Route.configure(deprecated: Boolean = false) {

rateLimit(RateLimitName("strong")) {
route("list") {
installPatchesListRouteDocumentation(deprecated)
installPatchesListRouteDocumentation()

get {
call.respondBytes(ContentType.Application.Json) { patchesService.list() }
Expand All @@ -57,7 +48,7 @@ private fun Route.configure(deprecated: Boolean = false) {
route("keys") {
installCache(356.days)

installPatchesPublicKeyRouteDocumentation(deprecated)
installPatchesPublicKeyRouteDocumentation()

get {
call.respond(patchesService.publicKey())
Expand All @@ -66,11 +57,10 @@ private fun Route.configure(deprecated: Boolean = false) {
}
}

private fun Route.installPatchesRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
private fun Route.installPatchesRouteDocumentation() = installNotarizedRoute {
tags = setOf("Patches")

get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current patches release")
summary("Get current patches release")
response {
Expand All @@ -82,11 +72,10 @@ private fun Route.installPatchesRouteDocumentation(deprecated: Boolean) = instal
}
}

private fun Route.installPatchesVersionRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
private fun Route.installPatchesVersionRouteDocumentation() = installNotarizedRoute {
tags = setOf("Patches")

get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current patches release version")
summary("Get current patches release version")
response {
Expand All @@ -98,11 +87,10 @@ private fun Route.installPatchesVersionRouteDocumentation(deprecated: Boolean) =
}
}

private fun Route.installPatchesListRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
private fun Route.installPatchesListRouteDocumentation() = installNotarizedRoute {
tags = setOf("Patches")

get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the list of patches from the current patches release")
summary("Get list of patches from current patches release")
response {
Expand All @@ -114,11 +102,10 @@ private fun Route.installPatchesListRouteDocumentation(deprecated: Boolean) = in
}
}

private fun Route.installPatchesPublicKeyRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
private fun Route.installPatchesPublicKeyRouteDocumentation() = installNotarizedRoute {
tags = setOf("Patches")

get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the public keys for verifying patches assets")
summary("Get patches public keys")
response {
Expand Down

This file was deleted.

0 comments on commit bfd817b

Please sign in to comment.