Compare commits

...

10 Commits

Author SHA1 Message Date
semantic-release-bot
ef5f0b5ddd chore(release): 1.2.0 [skip ci]
# [1.2.0](https://github.com/ReVanced/revanced-api/compare/v1.1.0...v1.2.0) (2024-09-06)

### Bug Fixes

* Add back deprecated routes for backwards compatibility ([9f0eb5b](9f0eb5bfe9))
* Make sure, expected paths in configuration exist ([32bedb7](32bedb7fad))
* Return correct GPG keys url ([#187](https://github.com/ReVanced/revanced-api/issues/187)) ([74e5389](74e53891a1))

### Features

* Move /latest routes to parent ([4e8e83d](4e8e83db1a))
* Respond to all ping request methods ([df116bd](df116bd221))
2024-09-06 23:23:38 +00:00
oSumAtrIX
c0dc763f99 chore: Merge branch dev to main (#188)
This pull request will Merge branch `dev` to `main`.
2024-09-07 03:21:40 +04:00
semantic-release-bot
11327af879 chore(release): 1.2.0-dev.4 [skip ci]
# [1.2.0-dev.4](https://github.com/ReVanced/revanced-api/compare/v1.2.0-dev.3...v1.2.0-dev.4) (2024-09-06)

### Bug Fixes

* Add back deprecated routes for backwards compatibility ([9f0eb5b](9f0eb5bfe9))
* Make sure, expected paths in configuration exist ([32bedb7](32bedb7fad))
2024-09-06 08:27:20 +00:00
oSumAtrIX
9f0eb5bfe9 fix: Add back deprecated routes for backwards compatibility 2024-09-06 12:25:10 +04:00
oSumAtrIX
d2575d5191 docs: Add missing documentation and setup steps 2024-09-06 11:59:33 +04:00
oSumAtrIX
32bedb7fad fix: Make sure, expected paths in configuration exist 2024-09-06 11:40:10 +04:00
semantic-release-bot
d605efd54a chore(release): 1.2.0-dev.3 [skip ci]
# [1.2.0-dev.3](https://github.com/ReVanced/revanced-api/compare/v1.2.0-dev.2...v1.2.0-dev.3) (2024-09-04)

### Bug Fixes

* Return correct GPG keys url ([#187](https://github.com/ReVanced/revanced-api/issues/187)) ([74e5389](74e53891a1))
2024-09-04 15:20:13 +00:00
Ushie
74e53891a1 fix: Return correct GPG keys url (#187)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2024-09-04 17:18:21 +02:00
semantic-release-bot
27b18c62f5 chore(release): 1.2.0-dev.2 [skip ci]
# [1.2.0-dev.2](https://github.com/ReVanced/revanced-api/compare/v1.2.0-dev.1...v1.2.0-dev.2) (2024-08-24)

### Features

* Respond to all ping request methods ([df116bd](df116bd221))
2024-08-24 20:34:53 +00:00
oSumAtrIX
df116bd221 feat: Respond to all ping request methods 2024-08-24 22:32:37 +02:00
9 changed files with 100 additions and 21 deletions

View File

@@ -1,3 +1,40 @@
# [1.2.0](https://github.com/ReVanced/revanced-api/compare/v1.1.0...v1.2.0) (2024-09-06)
### Bug Fixes
* Add back deprecated routes for backwards compatibility ([9f0eb5b](https://github.com/ReVanced/revanced-api/commit/9f0eb5bfe9d0436e76462b9c094f8b1158e04a44))
* Make sure, expected paths in configuration exist ([32bedb7](https://github.com/ReVanced/revanced-api/commit/32bedb7fad3eef8116625964e5e1f0a2543ea2a4))
* Return correct GPG keys url ([#187](https://github.com/ReVanced/revanced-api/issues/187)) ([74e5389](https://github.com/ReVanced/revanced-api/commit/74e53891a17bd3f76f358477e4228550e6f70149))
### Features
* Move /latest routes to parent ([4e8e83d](https://github.com/ReVanced/revanced-api/commit/4e8e83db1a20c76a81967af4e7e3a8634649790a))
* Respond to all ping request methods ([df116bd](https://github.com/ReVanced/revanced-api/commit/df116bd22134c8222c72b28e9387bc9871d3473e))
# [1.2.0-dev.4](https://github.com/ReVanced/revanced-api/compare/v1.2.0-dev.3...v1.2.0-dev.4) (2024-09-06)
### Bug Fixes
* Add back deprecated routes for backwards compatibility ([9f0eb5b](https://github.com/ReVanced/revanced-api/commit/9f0eb5bfe9d0436e76462b9c094f8b1158e04a44))
* Make sure, expected paths in configuration exist ([32bedb7](https://github.com/ReVanced/revanced-api/commit/32bedb7fad3eef8116625964e5e1f0a2543ea2a4))
# [1.2.0-dev.3](https://github.com/ReVanced/revanced-api/compare/v1.2.0-dev.2...v1.2.0-dev.3) (2024-09-04)
### Bug Fixes
* Return correct GPG keys url ([#187](https://github.com/ReVanced/revanced-api/issues/187)) ([74e5389](https://github.com/ReVanced/revanced-api/commit/74e53891a17bd3f76f358477e4228550e6f70149))
# [1.2.0-dev.2](https://github.com/ReVanced/revanced-api/compare/v1.2.0-dev.1...v1.2.0-dev.2) (2024-08-24)
### Features
* Respond to all ping request methods ([df116bd](https://github.com/ReVanced/revanced-api/commit/df116bd22134c8222c72b28e9387bc9871d3473e))
# [1.2.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.1.0...v1.2.0-dev.1) (2024-08-16) # [1.2.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.1.0...v1.2.0-dev.1) (2024-08-16)

View File

@@ -96,20 +96,30 @@ so before you can pull the image, you need to [authenticate to the Container reg
1. Create an `.env` file using [.env.example](.env.example) as a template 1. Create an `.env` file using [.env.example](.env.example) as a template
2. Create a `configuration.toml` file using [configuration.example.toml](configuration.example.toml) as a template 2. Create a `configuration.toml` file using [configuration.example.toml](configuration.example.toml) as a template
3. Create a `docker-compose.yml` file using [docker-compose.example.yml](docker-compose.example.yml) as a template 3. Create an `about.json` file using [about.example.json](about.example.json) as a template
4. Run `docker-compose up -d` to start the server 4. Create a `docker-compose.yml` file using [docker-compose.example.yml](docker-compose.example.yml) as a template
5. Run `docker-compose up -d` to start the server
### 💻 Docker CLI ### 💻 Docker CLI
1. Create an `.env` file using [.env.example](.env.example) as a template 1. Create an `.env` file using [.env.example](.env.example) as a template
2. Create a `configuration.toml` file using [configuration.example.toml](configuration.example.toml) as a template 2. Create a `configuration.toml` file using [configuration.example.toml](configuration.example.toml) as a template
3. Start the container using the following command: 3. Create an `about.json` file using [about.example.json](about.example.json) as a template
4. Start the container using the following command:
```shell ```shell
docker run -d --name revanced-api \ docker run -d --name revanced-api \
# Mount the .env file # Mount the .env file
-v $(pwd)/.env:/app/.env \ -v $(pwd)/.env:/app/.env \
# Mount the configuration.toml file # Mount the configuration.toml file
-v $(pwd)/configuration.toml:/app/configuration.toml \ -v $(pwd)/configuration.toml:/app/configuration.toml \
# Mount the patches public key
-v $(pwd)/patches-public-key.asc:/app/patches-public-key.asc \
# Mount the integrations public key
-v $(pwd)/integrations-public-key.asc:/app/integrations-public-key.asc \
# Mount the static folder
-v $(pwd)/static:/app/static \
# Mount the about.json file
-v $(pwd)/about.json:/app/about.json \
# Mount the persistence folder # Mount the persistence folder
-v $(pwd)/persistence:/app/persistence \ -v $(pwd)/persistence:/app/persistence \
# Expose the port 8888 # Expose the port 8888
@@ -132,7 +142,8 @@ A Java Runtime Environment (JRE) must be installed.
2. In the same folder, create an `.env` file using [.env.example](.env.example) as a template 2. In the same folder, create an `.env` file using [.env.example](.env.example) as a template
3. In the same folder, create a `configuration.toml` file 3. In the same folder, create a `configuration.toml` file
using [configuration.example.toml](configuration.example.toml) as a template using [configuration.example.toml](configuration.example.toml) as a template
4. Run `java -jar revanced-api.jar start` to start the server 4. In the same folder, create an `about.json` file using [about.example.json](about.example.json) as a template
5. Run `java -jar revanced-api.jar start` to start the server
### 🛠️ From source ### 🛠️ From source
@@ -141,7 +152,8 @@ A Java Development Kit (JDK) and Git must be installed.
1. Run `git clone git@github.com:ReVanced/revanced-api.git` to clone the repository 1. Run `git clone git@github.com:ReVanced/revanced-api.git` to clone the repository
2. Copy [.env.example](.env.example) to `.env` and fill in the required values 2. Copy [.env.example](.env.example) to `.env` and fill in the required values
3. Copy [configuration.example.toml](configuration.example.toml) to `configuration.toml` and fill in the required values 3. Copy [configuration.example.toml](configuration.example.toml) to `configuration.toml` and fill in the required values
4. Run `gradlew run --args=start` to start the server 4. Copy [about.example.json](about.example.json) to `about.json` and fill in the required values
5. Run `gradlew run --args=start` to start the server
## 📚 Everything else ## 📚 Everything else

View File

@@ -13,5 +13,5 @@ services:
environment: environment:
- COMMAND=start - COMMAND=start
ports: ports:
- 8888:8888 - "8888:8888"
restart: unless-stopped restart: unless-stopped

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true org.gradle.parallel = true
org.gradle.caching = true org.gradle.caching = true
kotlin.code.style = official kotlin.code.style = official
version = 1.2.0-dev.1 version = 1.2.0

View File

@@ -17,6 +17,7 @@ import kotlinx.serialization.json.JsonNamingStrategy
import kotlinx.serialization.json.decodeFromStream import kotlinx.serialization.json.decodeFromStream
import java.io.File import java.io.File
import java.nio.file.Path import java.nio.file.Path
import kotlin.io.path.createDirectories
/** /**
* The repository storing the configuration for the API. * The repository storing the configuration for the API.
@@ -60,6 +61,11 @@ internal class ConfigurationRepository(
@SerialName("about-json-file-path") @SerialName("about-json-file-path")
val about: APIAbout, val about: APIAbout,
) { ) {
init {
staticFilesPath.createDirectories()
versionedStaticFilesPath.createDirectories()
}
/** /**
* Am asset configuration whose asset is signed. * Am asset configuration whose asset is signed.
* *

View File

@@ -98,7 +98,7 @@ class GitHubBackendRepository(client: HttpClient) : BackendRepository(client) {
gpgKeys = gpgKeys =
BackendMember.GpgKeys( BackendMember.GpgKeys(
ids = gpgKeys.map { it.keyId }, ids = gpgKeys.map { it.keyId },
url = "https://api.github.com/users/${user.login}.gpg", url = "https://github.com/${user.login}.gpg",
), ),
) )
} }

View File

@@ -72,7 +72,7 @@ internal fun Route.apiRoute() {
installPingRouteDocumentation() installPingRouteDocumentation()
head { handle {
call.respond(HttpStatusCode.NoContent) call.respond(HttpStatusCode.NoContent)
} }
} }

View File

@@ -14,9 +14,18 @@ import io.ktor.server.routing.*
import org.koin.ktor.ext.get as koinGet import org.koin.ktor.ext.get as koinGet
internal fun Route.managerRoute() = route("manager") { 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>() val managerService = koinGet<ManagerService>()
installManagerRouteDocumentation() installManagerRouteDocumentation(deprecated)
rateLimit(RateLimitName("weak")) { rateLimit(RateLimitName("weak")) {
get { get {
@@ -24,7 +33,7 @@ internal fun Route.managerRoute() = route("manager") {
} }
route("version") { route("version") {
installManagerVersionRouteDocumentation() installManagerVersionRouteDocumentation(deprecated)
get { get {
call.respond(managerService.latestVersion()) call.respond(managerService.latestVersion())
@@ -33,10 +42,11 @@ internal fun Route.managerRoute() = route("manager") {
} }
} }
private fun Route.installManagerRouteDocumentation() = installNotarizedRoute { private fun Route.installManagerRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
tags = setOf("Manager") tags = setOf("Manager")
get = GetInfo.builder { get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current manager release") description("Get the current manager release")
summary("Get current manager release") summary("Get current manager release")
response { response {
@@ -48,10 +58,11 @@ private fun Route.installManagerRouteDocumentation() = installNotarizedRoute {
} }
} }
private fun Route.installManagerVersionRouteDocumentation() = installNotarizedRoute { private fun Route.installManagerVersionRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
tags = setOf("Manager") tags = setOf("Manager")
get = GetInfo.builder { get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current manager release version") description("Get the current manager release version")
summary("Get current manager release version") summary("Get current manager release version")
response { response {

View File

@@ -17,9 +17,18 @@ import kotlin.time.Duration.Companion.days
import org.koin.ktor.ext.get as koinGet import org.koin.ktor.ext.get as koinGet
internal fun Route.patchesRoute() = route("patches") { 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>() val patchesService = koinGet<PatchesService>()
installPatchesRouteDocumentation() installPatchesRouteDocumentation(deprecated)
rateLimit(RateLimitName("weak")) { rateLimit(RateLimitName("weak")) {
get { get {
@@ -27,7 +36,7 @@ internal fun Route.patchesRoute() = route("patches") {
} }
route("version") { route("version") {
installPatchesVersionRouteDocumentation() installPatchesVersionRouteDocumentation(deprecated)
get { get {
call.respond(patchesService.latestVersion()) call.respond(patchesService.latestVersion())
@@ -37,7 +46,7 @@ internal fun Route.patchesRoute() = route("patches") {
rateLimit(RateLimitName("strong")) { rateLimit(RateLimitName("strong")) {
route("list") { route("list") {
installPatchesListRouteDocumentation() installPatchesListRouteDocumentation(deprecated)
get { get {
call.respondBytes(ContentType.Application.Json) { patchesService.list() } call.respondBytes(ContentType.Application.Json) { patchesService.list() }
@@ -49,7 +58,7 @@ internal fun Route.patchesRoute() = route("patches") {
route("keys") { route("keys") {
installCache(356.days) installCache(356.days)
installPatchesPublicKeyRouteDocumentation() installPatchesPublicKeyRouteDocumentation(deprecated)
get { get {
call.respond(patchesService.publicKeys()) call.respond(patchesService.publicKeys())
@@ -58,10 +67,11 @@ internal fun Route.patchesRoute() = route("patches") {
} }
} }
private fun Route.installPatchesRouteDocumentation() = installNotarizedRoute { private fun Route.installPatchesRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
tags = setOf("Patches") tags = setOf("Patches")
get = GetInfo.builder { get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current patches release") description("Get the current patches release")
summary("Get current patches release") summary("Get current patches release")
response { response {
@@ -73,10 +83,11 @@ private fun Route.installPatchesRouteDocumentation() = installNotarizedRoute {
} }
} }
private fun Route.installPatchesVersionRouteDocumentation() = installNotarizedRoute { private fun Route.installPatchesVersionRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
tags = setOf("Patches") tags = setOf("Patches")
get = GetInfo.builder { get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the current patches release version") description("Get the current patches release version")
summary("Get current patches release version") summary("Get current patches release version")
response { response {
@@ -88,10 +99,11 @@ private fun Route.installPatchesVersionRouteDocumentation() = installNotarizedRo
} }
} }
private fun Route.installPatchesListRouteDocumentation() = installNotarizedRoute { private fun Route.installPatchesListRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
tags = setOf("Patches") tags = setOf("Patches")
get = GetInfo.builder { get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the list of patches from the current patches release") description("Get the list of patches from the current patches release")
summary("Get list of patches from current patches release") summary("Get list of patches from current patches release")
response { response {
@@ -103,10 +115,11 @@ private fun Route.installPatchesListRouteDocumentation() = installNotarizedRoute
} }
} }
private fun Route.installPatchesPublicKeyRouteDocumentation() = installNotarizedRoute { private fun Route.installPatchesPublicKeyRouteDocumentation(deprecated: Boolean) = installNotarizedRoute {
tags = setOf("Patches") tags = setOf("Patches")
get = GetInfo.builder { get = GetInfo.builder {
if (deprecated) isDeprecated()
description("Get the public keys for verifying patches and integrations assets") description("Get the public keys for verifying patches and integrations assets")
summary("Get patches and integrations public keys") summary("Get patches and integrations public keys")
response { response {