mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-29 22:24:31 +02:00
feat: Remove ReVanced Integrations
There is no need for them anymore in Patcher v20+
This commit is contained in:
parent
a5498aba2b
commit
f1c10928ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,7 +41,6 @@ persistence/
|
|||||||
configuration.toml
|
configuration.toml
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
patches-public-key.asc
|
patches-public-key.asc
|
||||||
integrations-public-key.asc
|
|
||||||
node_modules/
|
node_modules/
|
||||||
static/
|
static/
|
||||||
about.json
|
about.json
|
15
README.md
15
README.md
@ -68,7 +68,8 @@ API server for ReVanced.
|
|||||||
## ❓ About
|
## ❓ About
|
||||||
|
|
||||||
ReVanced API is a server that is used as the backend for ReVanced.
|
ReVanced API is a server that is used as the backend for ReVanced.
|
||||||
ReVanced API acts as the data source for [ReVanced Website](https://github.com/ReVanced/revanced-website) and powers [ReVanced Manager](https://github.com/ReVanced/revanced-manager)
|
ReVanced API acts as the data source for [ReVanced Website](https://github.com/ReVanced/revanced-website) and
|
||||||
|
powers [ReVanced Manager](https://github.com/ReVanced/revanced-manager)
|
||||||
with updates and ReVanced Patches.
|
with updates and ReVanced Patches.
|
||||||
|
|
||||||
## 💪 Features
|
## 💪 Features
|
||||||
@ -77,7 +78,7 @@ Some of the features ReVanced API include:
|
|||||||
|
|
||||||
- 📢 **Announcements**: Post and get announcements
|
- 📢 **Announcements**: Post and get announcements
|
||||||
- ℹ️ **About**: Get more information such as a description, ways to donate to,
|
- ℹ️ **About**: Get more information such as a description, ways to donate to,
|
||||||
and links of the hoster of ReVanced API
|
and links of the hoster of ReVanced API
|
||||||
- 🧩 **Patches**: Get the latest updates of ReVanced Patches, directly from ReVanced API
|
- 🧩 **Patches**: Get the latest updates of ReVanced Patches, directly from ReVanced API
|
||||||
- 👥 **Contributors**: List all contributors involved in the project
|
- 👥 **Contributors**: List all contributors involved in the project
|
||||||
- 🔄 **Backwards compatibility**: Proxy an old API for migration purposes and backwards compatibility
|
- 🔄 **Backwards compatibility**: Proxy an old API for migration purposes and backwards compatibility
|
||||||
@ -90,7 +91,8 @@ ReVanced API can be deployed as a Docker container or used standalone.
|
|||||||
|
|
||||||
To deploy ReVanced API as a Docker container, you can use Docker Compose or Docker CLI.
|
To deploy ReVanced API as a Docker container, you can use Docker Compose or Docker CLI.
|
||||||
The Docker image is published on GitHub Container registry,
|
The Docker image is published on GitHub Container registry,
|
||||||
so before you can pull the image, you need to [authenticate to the Container registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry).
|
so before you can pull the image, you need
|
||||||
|
to [authenticate to the Container registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry).
|
||||||
|
|
||||||
### 🗄️ Docker Compose
|
### 🗄️ Docker Compose
|
||||||
|
|
||||||
@ -114,8 +116,6 @@ so before you can pull the image, you need to [authenticate to the Container reg
|
|||||||
-v $(pwd)/configuration.toml:/app/configuration.toml \
|
-v $(pwd)/configuration.toml:/app/configuration.toml \
|
||||||
# Mount the patches public key
|
# Mount the patches public key
|
||||||
-v $(pwd)/patches-public-key.asc:/app/patches-public-key.asc \
|
-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
|
# Mount the static folder
|
||||||
-v $(pwd)/static:/app/static \
|
-v $(pwd)/static:/app/static \
|
||||||
# Mount the about.json file
|
# Mount the about.json file
|
||||||
@ -141,7 +141,7 @@ A Java Runtime Environment (JRE) must be installed.
|
|||||||
1. [Download](https://github.com/ReVanced/revanced-api/releases/latest) ReVanced API to a folder
|
1. [Download](https://github.com/ReVanced/revanced-api/releases/latest) ReVanced API to a folder
|
||||||
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. In the same folder, create an `about.json` file using [about.example.json](about.example.json) as a template
|
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
|
5. Run `java -jar revanced-api.jar start` to start the server
|
||||||
|
|
||||||
@ -159,7 +159,8 @@ A Java Development Kit (JDK) and Git must be installed.
|
|||||||
|
|
||||||
### 📙 Contributing
|
### 📙 Contributing
|
||||||
|
|
||||||
Thank you for considering contributing to ReVanced API. You can find the contribution guidelines [here](CONTRIBUTING.md).
|
Thank you for considering contributing to ReVanced API. You can find the contribution
|
||||||
|
guidelines [here](CONTRIBUTING.md).
|
||||||
|
|
||||||
### 🛠️ Building
|
### 🛠️ Building
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
organization = "revanced"
|
organization = "revanced"
|
||||||
patches = { repository = "revanced-patches", asset-regex = "jar$", signature-asset-regex = "asc$", public-key-file = "patches-public-key.asc", public-key-id = 0 }
|
patches = { repository = "revanced-patches", asset-regex = "jar$", signature-asset-regex = "asc$", public-key-file = "patches-public-key.asc", public-key-id = 0 }
|
||||||
integrations = { repository = "revanced-integrations", asset-regex = "apk$", signature-asset-regex = "asc$", public-key-file = "integrations-public-key.asc", public-key-id = 0 }
|
|
||||||
manager = { repository = "revanced-manager", asset-regex = "apk$" }
|
manager = { repository = "revanced-manager", asset-regex = "apk$" }
|
||||||
api-version = 1
|
api-version = 1
|
||||||
cors-allowed-hosts = [
|
cors-allowed-hosts = [
|
||||||
|
@ -7,7 +7,6 @@ services:
|
|||||||
- /data/revanced-api/.env:/app/.env
|
- /data/revanced-api/.env:/app/.env
|
||||||
- /data/revanced-api/configuration.toml:/app/configuration.toml
|
- /data/revanced-api/configuration.toml:/app/configuration.toml
|
||||||
- /data/revanced-api/patches-public-key.asc:/app/patches-public-key.asc
|
- /data/revanced-api/patches-public-key.asc:/app/patches-public-key.asc
|
||||||
- /data/revanced-api/integrations-public-key.asc:/app/integrations-public-key.asc
|
|
||||||
- /data/revanced-api/static:/app/static
|
- /data/revanced-api/static:/app/static
|
||||||
- /data/revanced-api/about.json:/app/about.json
|
- /data/revanced-api/about.json:/app/about.json
|
||||||
environment:
|
environment:
|
||||||
|
@ -22,9 +22,8 @@ import kotlin.io.path.createDirectories
|
|||||||
/**
|
/**
|
||||||
* The repository storing the configuration for the API.
|
* The repository storing the configuration for the API.
|
||||||
*
|
*
|
||||||
* @property organization The API backends organization name where the repositories for the patches and integrations are.
|
* @property organization The API backends organization name where the repositories are.
|
||||||
* @property patches The source of the patches.
|
* @property patches The source of the patches.
|
||||||
* @property integrations The source of the integrations.
|
|
||||||
* @property manager The source of the manager.
|
* @property manager The source of the manager.
|
||||||
* @property contributorsRepositoryNames The friendly name of repos mapped to the repository names to get contributors from.
|
* @property contributorsRepositoryNames The friendly name of repos mapped to the repository names to get contributors from.
|
||||||
* @property backendServiceName The name of the backend service to use for the repositories, contributors, etc.
|
* @property backendServiceName The name of the backend service to use for the repositories, contributors, etc.
|
||||||
@ -41,7 +40,6 @@ import kotlin.io.path.createDirectories
|
|||||||
internal class ConfigurationRepository(
|
internal class ConfigurationRepository(
|
||||||
val organization: String,
|
val organization: String,
|
||||||
val patches: SignedAssetConfiguration,
|
val patches: SignedAssetConfiguration,
|
||||||
val integrations: SignedAssetConfiguration,
|
|
||||||
val manager: AssetConfiguration,
|
val manager: AssetConfiguration,
|
||||||
@SerialName("contributors-repositories")
|
@SerialName("contributors-repositories")
|
||||||
val contributorsRepositoryNames: Map<String, String>,
|
val contributorsRepositoryNames: Map<String, String>,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package app.revanced.api.configuration.routes
|
package app.revanced.api.configuration.routes
|
||||||
|
|
||||||
import app.revanced.api.configuration.installNotarizedRoute
|
import app.revanced.api.configuration.installNotarizedRoute
|
||||||
import app.revanced.api.configuration.schema.ApiManagerAsset
|
|
||||||
import app.revanced.api.configuration.schema.ApiRelease
|
import app.revanced.api.configuration.schema.ApiRelease
|
||||||
import app.revanced.api.configuration.schema.ApiReleaseVersion
|
import app.revanced.api.configuration.schema.ApiReleaseVersion
|
||||||
import app.revanced.api.configuration.services.ManagerService
|
import app.revanced.api.configuration.services.ManagerService
|
||||||
@ -53,7 +52,7 @@ private fun Route.installManagerRouteDocumentation(deprecated: Boolean) = instal
|
|||||||
description("The latest manager release")
|
description("The latest manager release")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
responseCode(HttpStatusCode.OK)
|
responseCode(HttpStatusCode.OK)
|
||||||
responseType<ApiRelease<ApiManagerAsset>>()
|
responseType<ApiRelease>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@ package app.revanced.api.configuration.routes
|
|||||||
|
|
||||||
import app.revanced.api.configuration.installCache
|
import app.revanced.api.configuration.installCache
|
||||||
import app.revanced.api.configuration.installNotarizedRoute
|
import app.revanced.api.configuration.installNotarizedRoute
|
||||||
import app.revanced.api.configuration.schema.ApiAssetPublicKeys
|
import app.revanced.api.configuration.schema.ApiAssetPublicKey
|
||||||
import app.revanced.api.configuration.schema.ApiPatchesAsset
|
|
||||||
import app.revanced.api.configuration.schema.ApiRelease
|
import app.revanced.api.configuration.schema.ApiRelease
|
||||||
import app.revanced.api.configuration.schema.ApiReleaseVersion
|
import app.revanced.api.configuration.schema.ApiReleaseVersion
|
||||||
import app.revanced.api.configuration.services.PatchesService
|
import app.revanced.api.configuration.services.PatchesService
|
||||||
@ -61,7 +60,7 @@ private fun Route.configure(deprecated: Boolean = false) {
|
|||||||
installPatchesPublicKeyRouteDocumentation(deprecated)
|
installPatchesPublicKeyRouteDocumentation(deprecated)
|
||||||
|
|
||||||
get {
|
get {
|
||||||
call.respond(patchesService.publicKeys())
|
call.respond(patchesService.publicKey())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +77,7 @@ private fun Route.installPatchesRouteDocumentation(deprecated: Boolean) = instal
|
|||||||
description("The current patches release")
|
description("The current patches release")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
responseCode(HttpStatusCode.OK)
|
responseCode(HttpStatusCode.OK)
|
||||||
responseType<ApiRelease<ApiPatchesAsset>>()
|
responseType<ApiRelease>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,13 +119,13 @@ private fun Route.installPatchesPublicKeyRouteDocumentation(deprecated: Boolean)
|
|||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
if (deprecated) isDeprecated()
|
if (deprecated) isDeprecated()
|
||||||
description("Get the public keys for verifying patches and integrations assets")
|
description("Get the public keys for verifying patches assets")
|
||||||
summary("Get patches and integrations public keys")
|
summary("Get patches public keys")
|
||||||
response {
|
response {
|
||||||
description("The public keys")
|
description("The public keys")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
responseCode(HttpStatusCode.OK)
|
responseCode(HttpStatusCode.OK)
|
||||||
responseType<ApiAssetPublicKeys>()
|
responseType<ApiAssetPublicKey>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,33 +41,14 @@ class APIContributable(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class ApiRelease<T>(
|
class ApiRelease(
|
||||||
val version: String,
|
val version: String,
|
||||||
val createdAt: LocalDateTime,
|
val createdAt: LocalDateTime,
|
||||||
val description: String,
|
val description: String,
|
||||||
// Using a list instead of a set because set semantics are unnecessary here.
|
|
||||||
val assets: List<T>,
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
class ApiManagerAsset(
|
|
||||||
val downloadUrl: String,
|
val downloadUrl: String,
|
||||||
|
val signatureDownloadUrl: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
|
||||||
class ApiPatchesAsset(
|
|
||||||
val downloadUrl: String,
|
|
||||||
val signatureDownloadUrl: String,
|
|
||||||
// TODO: Remove this eventually when integrations are merged into patches.
|
|
||||||
val name: ApiAssetName,
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
enum class ApiAssetName {
|
|
||||||
PATCHES,
|
|
||||||
INTEGRATION,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class ApiReleaseVersion(
|
class ApiReleaseVersion(
|
||||||
val version: String,
|
val version: String,
|
||||||
@ -125,9 +106,8 @@ class ApiRateLimit(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class ApiAssetPublicKeys(
|
class ApiAssetPublicKey(
|
||||||
val patchesPublicKey: String,
|
val patchesPublicKey: String,
|
||||||
val integrationsPublicKey: String,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -3,27 +3,24 @@ package app.revanced.api.configuration.services
|
|||||||
import app.revanced.api.configuration.repository.BackendRepository
|
import app.revanced.api.configuration.repository.BackendRepository
|
||||||
import app.revanced.api.configuration.repository.BackendRepository.BackendOrganization.BackendRepository.BackendRelease.Companion.first
|
import app.revanced.api.configuration.repository.BackendRepository.BackendOrganization.BackendRepository.BackendRelease.Companion.first
|
||||||
import app.revanced.api.configuration.repository.ConfigurationRepository
|
import app.revanced.api.configuration.repository.ConfigurationRepository
|
||||||
import app.revanced.api.configuration.schema.*
|
import app.revanced.api.configuration.schema.ApiRelease
|
||||||
|
import app.revanced.api.configuration.schema.ApiReleaseVersion
|
||||||
|
|
||||||
internal class ManagerService(
|
internal class ManagerService(
|
||||||
private val backendRepository: BackendRepository,
|
private val backendRepository: BackendRepository,
|
||||||
private val configurationRepository: ConfigurationRepository,
|
private val configurationRepository: ConfigurationRepository,
|
||||||
) {
|
) {
|
||||||
suspend fun latestRelease(): ApiRelease<ApiManagerAsset> {
|
suspend fun latestRelease(): ApiRelease {
|
||||||
val managerRelease = backendRepository.release(
|
val managerRelease = backendRepository.release(
|
||||||
configurationRepository.organization,
|
configurationRepository.organization,
|
||||||
configurationRepository.manager.repository,
|
configurationRepository.manager.repository,
|
||||||
)
|
)
|
||||||
|
|
||||||
val managerAsset = ApiManagerAsset(
|
|
||||||
managerRelease.assets.first(configurationRepository.manager.assetRegex).downloadUrl,
|
|
||||||
)
|
|
||||||
|
|
||||||
return ApiRelease(
|
return ApiRelease(
|
||||||
managerRelease.tag,
|
managerRelease.tag,
|
||||||
managerRelease.createdAt,
|
managerRelease.createdAt,
|
||||||
managerRelease.releaseNote,
|
managerRelease.releaseNote,
|
||||||
listOf(managerAsset),
|
managerRelease.assets.first(configurationRepository.manager.assetRegex).downloadUrl,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,9 @@ package app.revanced.api.configuration.services
|
|||||||
import app.revanced.api.configuration.repository.BackendRepository
|
import app.revanced.api.configuration.repository.BackendRepository
|
||||||
import app.revanced.api.configuration.repository.BackendRepository.BackendOrganization.BackendRepository.BackendRelease.Companion.first
|
import app.revanced.api.configuration.repository.BackendRepository.BackendOrganization.BackendRepository.BackendRelease.Companion.first
|
||||||
import app.revanced.api.configuration.repository.ConfigurationRepository
|
import app.revanced.api.configuration.repository.ConfigurationRepository
|
||||||
import app.revanced.api.configuration.schema.*
|
import app.revanced.api.configuration.schema.ApiAssetPublicKey
|
||||||
|
import app.revanced.api.configuration.schema.ApiRelease
|
||||||
|
import app.revanced.api.configuration.schema.ApiReleaseVersion
|
||||||
import app.revanced.library.serializeTo
|
import app.revanced.library.serializeTo
|
||||||
import app.revanced.patcher.patch.loadPatchesFromJar
|
import app.revanced.patcher.patch.loadPatchesFromJar
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine
|
import com.github.benmanes.caffeine.cache.Caffeine
|
||||||
@ -17,40 +19,18 @@ internal class PatchesService(
|
|||||||
private val backendRepository: BackendRepository,
|
private val backendRepository: BackendRepository,
|
||||||
private val configurationRepository: ConfigurationRepository,
|
private val configurationRepository: ConfigurationRepository,
|
||||||
) {
|
) {
|
||||||
suspend fun latestRelease(): ApiRelease<ApiPatchesAsset> {
|
suspend fun latestRelease(): ApiRelease {
|
||||||
val patchesRelease = backendRepository.release(
|
val patchesRelease = backendRepository.release(
|
||||||
configurationRepository.organization,
|
configurationRepository.organization,
|
||||||
configurationRepository.patches.repository,
|
configurationRepository.patches.repository,
|
||||||
)
|
)
|
||||||
|
|
||||||
val integrationsRelease = backendRepository.release(
|
|
||||||
configurationRepository.organization,
|
|
||||||
configurationRepository.integrations.repository,
|
|
||||||
)
|
|
||||||
|
|
||||||
fun ConfigurationRepository.SignedAssetConfiguration.asset(
|
|
||||||
release: BackendRepository.BackendOrganization.BackendRepository.BackendRelease,
|
|
||||||
assetName: ApiAssetName,
|
|
||||||
) = ApiPatchesAsset(
|
|
||||||
release.assets.first(assetRegex).downloadUrl,
|
|
||||||
release.assets.first(signatureAssetRegex).downloadUrl,
|
|
||||||
assetName,
|
|
||||||
)
|
|
||||||
|
|
||||||
val patchesAsset = configurationRepository.patches.asset(
|
|
||||||
patchesRelease,
|
|
||||||
ApiAssetName.PATCHES,
|
|
||||||
)
|
|
||||||
val integrationsAsset = configurationRepository.integrations.asset(
|
|
||||||
integrationsRelease,
|
|
||||||
ApiAssetName.INTEGRATION,
|
|
||||||
)
|
|
||||||
|
|
||||||
return ApiRelease(
|
return ApiRelease(
|
||||||
patchesRelease.tag,
|
patchesRelease.tag,
|
||||||
patchesRelease.createdAt,
|
patchesRelease.createdAt,
|
||||||
patchesRelease.releaseNote,
|
patchesRelease.releaseNote,
|
||||||
listOf(patchesAsset, integrationsAsset),
|
patchesRelease.assets.first(configurationRepository.patches.assetRegex).downloadUrl,
|
||||||
|
patchesRelease.assets.first(configurationRepository.patches.signatureAssetRegex).downloadUrl,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,14 +91,5 @@ internal class PatchesService(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun publicKeys(): ApiAssetPublicKeys {
|
fun publicKey() = ApiAssetPublicKey(configurationRepository.patches.publicKeyFile.readText())
|
||||||
fun readPublicKey(
|
|
||||||
getSignedAssetConfiguration: ConfigurationRepository.() -> ConfigurationRepository.SignedAssetConfiguration,
|
|
||||||
) = configurationRepository.getSignedAssetConfiguration().publicKeyFile.readText()
|
|
||||||
|
|
||||||
return ApiAssetPublicKeys(
|
|
||||||
readPublicKey { patches },
|
|
||||||
readPublicKey { integrations },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import java.security.MessageDigest
|
|||||||
internal class SignatureService {
|
internal class SignatureService {
|
||||||
private val signatureCache = Caffeine
|
private val signatureCache = Caffeine
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.maximumSize(2) // Assuming this is enough for patches and integrations.
|
.maximumSize(1) // 1 because currently only the latest patches is needed.
|
||||||
.build<ByteArray, Boolean>() // Hash -> Verified.
|
.build<ByteArray, Boolean>() // Hash -> Verified.
|
||||||
|
|
||||||
fun verify(
|
fun verify(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user