Skip to content

Commit f1c1092

Browse files
committed
feat: Remove ReVanced Integrations
There is no need for them anymore in Patcher v20+
1 parent a5498ab commit f1c1092

File tree

11 files changed

+32
-90
lines changed

11 files changed

+32
-90
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ persistence/
4141
configuration.toml
4242
docker-compose.yml
4343
patches-public-key.asc
44-
integrations-public-key.asc
4544
node_modules/
4645
static/
4746
about.json

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,17 @@ API server for ReVanced.
6868
## ❓ About
6969

7070
ReVanced API is a server that is used as the backend for ReVanced.
71-
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)
71+
ReVanced API acts as the data source for [ReVanced Website](https://github.com/ReVanced/revanced-website) and
72+
powers [ReVanced Manager](https://github.com/ReVanced/revanced-manager)
7273
with updates and ReVanced Patches.
7374

7475
## 💪 Features
7576

7677
Some of the features ReVanced API include:
7778

7879
- 📢 **Announcements**: Post and get announcements
79-
- ℹ️ **About**: Get more information such as a description, ways to donate to,
80-
and links of the hoster of ReVanced API
80+
- ℹ️ **About**: Get more information such as a description, ways to donate to,
81+
and links of the hoster of ReVanced API
8182
- 🧩 **Patches**: Get the latest updates of ReVanced Patches, directly from ReVanced API
8283
- 👥 **Contributors**: List all contributors involved in the project
8384
- 🔄 **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.
9091

9192
To deploy ReVanced API as a Docker container, you can use Docker Compose or Docker CLI.
9293
The Docker image is published on GitHub Container registry,
93-
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).
94+
so before you can pull the image, you need
95+
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).
9496

9597
### 🗄️ Docker Compose
9698

@@ -114,8 +116,6 @@ so before you can pull the image, you need to [authenticate to the Container reg
114116
-v $(pwd)/configuration.toml:/app/configuration.toml \
115117
# Mount the patches public key
116118
-v $(pwd)/patches-public-key.asc:/app/patches-public-key.asc \
117-
# Mount the integrations public key
118-
-v $(pwd)/integrations-public-key.asc:/app/integrations-public-key.asc \
119119
# Mount the static folder
120120
-v $(pwd)/static:/app/static \
121121
# Mount the about.json file
@@ -141,7 +141,7 @@ A Java Runtime Environment (JRE) must be installed.
141141
1. [Download](https://github.com/ReVanced/revanced-api/releases/latest) ReVanced API to a folder
142142
2. In the same folder, create an `.env` file using [.env.example](.env.example) as a template
143143
3. In the same folder, create a `configuration.toml` file
144-
using [configuration.example.toml](configuration.example.toml) as a template
144+
using [configuration.example.toml](configuration.example.toml) as a template
145145
4. In the same folder, create an `about.json` file using [about.example.json](about.example.json) as a template
146146
5. Run `java -jar revanced-api.jar start` to start the server
147147

@@ -159,7 +159,8 @@ A Java Development Kit (JDK) and Git must be installed.
159159

160160
### 📙 Contributing
161161

162-
Thank you for considering contributing to ReVanced API. You can find the contribution guidelines [here](CONTRIBUTING.md).
162+
Thank you for considering contributing to ReVanced API. You can find the contribution
163+
guidelines [here](CONTRIBUTING.md).
163164

164165
### 🛠️ Building
165166

configuration.example.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
organization = "revanced"
22
patches = { repository = "revanced-patches", asset-regex = "jar$", signature-asset-regex = "asc$", public-key-file = "patches-public-key.asc", public-key-id = 0 }
3-
integrations = { repository = "revanced-integrations", asset-regex = "apk$", signature-asset-regex = "asc$", public-key-file = "integrations-public-key.asc", public-key-id = 0 }
43
manager = { repository = "revanced-manager", asset-regex = "apk$" }
54
api-version = 1
65
cors-allowed-hosts = [

docker-compose.example.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ services:
77
- /data/revanced-api/.env:/app/.env
88
- /data/revanced-api/configuration.toml:/app/configuration.toml
99
- /data/revanced-api/patches-public-key.asc:/app/patches-public-key.asc
10-
- /data/revanced-api/integrations-public-key.asc:/app/integrations-public-key.asc
1110
- /data/revanced-api/static:/app/static
1211
- /data/revanced-api/about.json:/app/about.json
1312
environment:

src/main/kotlin/app/revanced/api/configuration/repository/ConfigurationRepository.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ import kotlin.io.path.createDirectories
2222
/**
2323
* The repository storing the configuration for the API.
2424
*
25-
* @property organization The API backends organization name where the repositories for the patches and integrations are.
25+
* @property organization The API backends organization name where the repositories are.
2626
* @property patches The source of the patches.
27-
* @property integrations The source of the integrations.
2827
* @property manager The source of the manager.
2928
* @property contributorsRepositoryNames The friendly name of repos mapped to the repository names to get contributors from.
3029
* @property backendServiceName The name of the backend service to use for the repositories, contributors, etc.
@@ -41,7 +40,6 @@ import kotlin.io.path.createDirectories
4140
internal class ConfigurationRepository(
4241
val organization: String,
4342
val patches: SignedAssetConfiguration,
44-
val integrations: SignedAssetConfiguration,
4543
val manager: AssetConfiguration,
4644
@SerialName("contributors-repositories")
4745
val contributorsRepositoryNames: Map<String, String>,

src/main/kotlin/app/revanced/api/configuration/routes/ManagerRoute.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package app.revanced.api.configuration.routes
22

33
import app.revanced.api.configuration.installNotarizedRoute
4-
import app.revanced.api.configuration.schema.ApiManagerAsset
54
import app.revanced.api.configuration.schema.ApiRelease
65
import app.revanced.api.configuration.schema.ApiReleaseVersion
76
import app.revanced.api.configuration.services.ManagerService
@@ -53,7 +52,7 @@ private fun Route.installManagerRouteDocumentation(deprecated: Boolean) = instal
5352
description("The latest manager release")
5453
mediaTypes("application/json")
5554
responseCode(HttpStatusCode.OK)
56-
responseType<ApiRelease<ApiManagerAsset>>()
55+
responseType<ApiRelease>()
5756
}
5857
}
5958
}

src/main/kotlin/app/revanced/api/configuration/routes/PatchesRoute.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package app.revanced.api.configuration.routes
22

33
import app.revanced.api.configuration.installCache
44
import app.revanced.api.configuration.installNotarizedRoute
5-
import app.revanced.api.configuration.schema.ApiAssetPublicKeys
6-
import app.revanced.api.configuration.schema.ApiPatchesAsset
5+
import app.revanced.api.configuration.schema.ApiAssetPublicKey
76
import app.revanced.api.configuration.schema.ApiRelease
87
import app.revanced.api.configuration.schema.ApiReleaseVersion
98
import app.revanced.api.configuration.services.PatchesService
@@ -61,7 +60,7 @@ private fun Route.configure(deprecated: Boolean = false) {
6160
installPatchesPublicKeyRouteDocumentation(deprecated)
6261

6362
get {
64-
call.respond(patchesService.publicKeys())
63+
call.respond(patchesService.publicKey())
6564
}
6665
}
6766
}
@@ -78,7 +77,7 @@ private fun Route.installPatchesRouteDocumentation(deprecated: Boolean) = instal
7877
description("The current patches release")
7978
mediaTypes("application/json")
8079
responseCode(HttpStatusCode.OK)
81-
responseType<ApiRelease<ApiPatchesAsset>>()
80+
responseType<ApiRelease>()
8281
}
8382
}
8483
}
@@ -120,13 +119,13 @@ private fun Route.installPatchesPublicKeyRouteDocumentation(deprecated: Boolean)
120119

121120
get = GetInfo.builder {
122121
if (deprecated) isDeprecated()
123-
description("Get the public keys for verifying patches and integrations assets")
124-
summary("Get patches and integrations public keys")
122+
description("Get the public keys for verifying patches assets")
123+
summary("Get patches public keys")
125124
response {
126125
description("The public keys")
127126
mediaTypes("application/json")
128127
responseCode(HttpStatusCode.OK)
129-
responseType<ApiAssetPublicKeys>()
128+
responseType<ApiAssetPublicKey>()
130129
}
131130
}
132131
}

src/main/kotlin/app/revanced/api/configuration/schema/APISchema.kt

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,14 @@ class APIContributable(
4141
)
4242

4343
@Serializable
44-
class ApiRelease<T>(
44+
class ApiRelease(
4545
val version: String,
4646
val createdAt: LocalDateTime,
4747
val description: String,
48-
// Using a list instead of a set because set semantics are unnecessary here.
49-
val assets: List<T>,
50-
)
51-
52-
@Serializable
53-
class ApiManagerAsset(
5448
val downloadUrl: String,
49+
val signatureDownloadUrl: String? = null,
5550
)
5651

57-
@Serializable
58-
class ApiPatchesAsset(
59-
val downloadUrl: String,
60-
val signatureDownloadUrl: String,
61-
// TODO: Remove this eventually when integrations are merged into patches.
62-
val name: ApiAssetName,
63-
)
64-
65-
@Serializable
66-
enum class ApiAssetName {
67-
PATCHES,
68-
INTEGRATION,
69-
}
70-
7152
@Serializable
7253
class ApiReleaseVersion(
7354
val version: String,
@@ -125,9 +106,8 @@ class ApiRateLimit(
125106
)
126107

127108
@Serializable
128-
class ApiAssetPublicKeys(
109+
class ApiAssetPublicKey(
129110
val patchesPublicKey: String,
130-
val integrationsPublicKey: String,
131111
)
132112

133113
@Serializable

src/main/kotlin/app/revanced/api/configuration/services/ManagerService.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,24 @@ package app.revanced.api.configuration.services
33
import app.revanced.api.configuration.repository.BackendRepository
44
import app.revanced.api.configuration.repository.BackendRepository.BackendOrganization.BackendRepository.BackendRelease.Companion.first
55
import app.revanced.api.configuration.repository.ConfigurationRepository
6-
import app.revanced.api.configuration.schema.*
6+
import app.revanced.api.configuration.schema.ApiRelease
7+
import app.revanced.api.configuration.schema.ApiReleaseVersion
78

89
internal class ManagerService(
910
private val backendRepository: BackendRepository,
1011
private val configurationRepository: ConfigurationRepository,
1112
) {
12-
suspend fun latestRelease(): ApiRelease<ApiManagerAsset> {
13+
suspend fun latestRelease(): ApiRelease {
1314
val managerRelease = backendRepository.release(
1415
configurationRepository.organization,
1516
configurationRepository.manager.repository,
1617
)
1718

18-
val managerAsset = ApiManagerAsset(
19-
managerRelease.assets.first(configurationRepository.manager.assetRegex).downloadUrl,
20-
)
21-
2219
return ApiRelease(
2320
managerRelease.tag,
2421
managerRelease.createdAt,
2522
managerRelease.releaseNote,
26-
listOf(managerAsset),
23+
managerRelease.assets.first(configurationRepository.manager.assetRegex).downloadUrl,
2724
)
2825
}
2926

src/main/kotlin/app/revanced/api/configuration/services/PatchesService.kt

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package app.revanced.api.configuration.services
33
import app.revanced.api.configuration.repository.BackendRepository
44
import app.revanced.api.configuration.repository.BackendRepository.BackendOrganization.BackendRepository.BackendRelease.Companion.first
55
import app.revanced.api.configuration.repository.ConfigurationRepository
6-
import app.revanced.api.configuration.schema.*
6+
import app.revanced.api.configuration.schema.ApiAssetPublicKey
7+
import app.revanced.api.configuration.schema.ApiRelease
8+
import app.revanced.api.configuration.schema.ApiReleaseVersion
79
import app.revanced.library.serializeTo
810
import app.revanced.patcher.patch.loadPatchesFromJar
911
import com.github.benmanes.caffeine.cache.Caffeine
@@ -17,40 +19,18 @@ internal class PatchesService(
1719
private val backendRepository: BackendRepository,
1820
private val configurationRepository: ConfigurationRepository,
1921
) {
20-
suspend fun latestRelease(): ApiRelease<ApiPatchesAsset> {
22+
suspend fun latestRelease(): ApiRelease {
2123
val patchesRelease = backendRepository.release(
2224
configurationRepository.organization,
2325
configurationRepository.patches.repository,
2426
)
2527

26-
val integrationsRelease = backendRepository.release(
27-
configurationRepository.organization,
28-
configurationRepository.integrations.repository,
29-
)
30-
31-
fun ConfigurationRepository.SignedAssetConfiguration.asset(
32-
release: BackendRepository.BackendOrganization.BackendRepository.BackendRelease,
33-
assetName: ApiAssetName,
34-
) = ApiPatchesAsset(
35-
release.assets.first(assetRegex).downloadUrl,
36-
release.assets.first(signatureAssetRegex).downloadUrl,
37-
assetName,
38-
)
39-
40-
val patchesAsset = configurationRepository.patches.asset(
41-
patchesRelease,
42-
ApiAssetName.PATCHES,
43-
)
44-
val integrationsAsset = configurationRepository.integrations.asset(
45-
integrationsRelease,
46-
ApiAssetName.INTEGRATION,
47-
)
48-
4928
return ApiRelease(
5029
patchesRelease.tag,
5130
patchesRelease.createdAt,
5231
patchesRelease.releaseNote,
53-
listOf(patchesAsset, integrationsAsset),
32+
patchesRelease.assets.first(configurationRepository.patches.assetRegex).downloadUrl,
33+
patchesRelease.assets.first(configurationRepository.patches.signatureAssetRegex).downloadUrl,
5434
)
5535
}
5636

@@ -111,14 +91,5 @@ internal class PatchesService(
11191
}
11292
}
11393

114-
fun publicKeys(): ApiAssetPublicKeys {
115-
fun readPublicKey(
116-
getSignedAssetConfiguration: ConfigurationRepository.() -> ConfigurationRepository.SignedAssetConfiguration,
117-
) = configurationRepository.getSignedAssetConfiguration().publicKeyFile.readText()
118-
119-
return ApiAssetPublicKeys(
120-
readPublicKey { patches },
121-
readPublicKey { integrations },
122-
)
123-
}
94+
fun publicKey() = ApiAssetPublicKey(configurationRepository.patches.publicKeyFile.readText())
12495
}

0 commit comments

Comments
 (0)