Skip to content

Commit df593a7

Browse files
authored
build(Needs bump): Update to ReVanced Patcher v22 (#209)
1 parent d3b0883 commit df593a7

File tree

12 files changed

+120
-111
lines changed

12 files changed

+120
-111
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Release
5555
uses: cycjimmy/semantic-release-action@v5
5656
env:
57-
DOCKER_REGISTRY_USER: ${{ github.actor }}
57+
DOCKER_REGISTRY_USER: ${{ env.GITHUB_ACTOR }}
5858
DOCKER_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
5959
ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ github.actor }}
6060
ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ ktor {
4444
kotlin {
4545
compilerOptions {
4646
jvmToolchain(21)
47+
48+
freeCompilerArgs.addAll(
49+
"-Xexplicit-backing-fields",
50+
"-Xcontext-parameters",
51+
)
4752
}
4853
}
4954

@@ -96,10 +101,6 @@ dependencies {
96101

97102
// The maven-publish plugin is necessary to make signing work.
98103
publishing {
99-
repositories {
100-
mavenLocal()
101-
}
102-
103104
publications {
104105
create<MavenPublication>("revanced-api-publication") {
105106
from(components["java"])

configuration.example.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ endpoint = "https://api.revanced.app"
77
static-files-path = "static/root"
88
versioned-static-files-path = "static/versioned"
99
backend-service-name = "GitHub"
10-
backend-service-main-branch = "main"
11-
backend-service-prerelease-branch = "dev"
1210
about-json-file-path = "about.json"
1311
organization = "revanced"
1412

@@ -18,7 +16,6 @@ asset-regex = "rvp$"
1816
signature-asset-regex = "asc$"
1917
public-key-file = "static/root/keys.asc"
2018
public-key-id = 3897925568445097277
21-
history-file = "CHANGELOG.md"
2219

2320
[manager]
2421
repository = "revanced-manager"

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ ktor = "3.4.0"
99
ktoml = "0.7.1"
1010
picocli = "4.7.7"
1111
datetime = "0.7.1"
12-
revanced-patcher = "21.0.0"
13-
revanced-library = "3.2.0-dev.1"
12+
revanced-patcher = "22.0.0"
13+
revanced-library = "4.0.0"
1414
caffeine = "3.2.3"
1515
bouncy-castle = "1.83"
1616

@@ -47,8 +47,8 @@ ktoml-core = { module = "com.akuleshov7:ktoml-core", version.ref = "ktoml" }
4747
ktoml-file = { module = "com.akuleshov7:ktoml-file", version.ref = "ktoml" }
4848
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
4949
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "datetime" }
50-
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
51-
revanced-library = { module = "app.revanced:revanced-library", version.ref = "revanced-library" }
50+
revanced-patcher = { module = "app.revanced:patcher", version.ref = "revanced-patcher" }
51+
revanced-library = { module = "app.revanced:library", version.ref = "revanced-library" }
5252
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
5353
bouncy-castle-provider = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncy-castle" }
5454
bouncy-castle-pgp = { module = "org.bouncycastle:bcpg-jdk18on", version.ref = "bouncy-castle" }

src/main/kotlin/app/revanced/api/server/APISchema.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ class ApiReleaseVersion(
5858
)
5959

6060
@Serializable
61-
class ApiReleaseHistory(
62-
val history: String,
61+
class ApiReleaseSimple(
62+
val version: String,
63+
val createdAt: LocalDateTime,
64+
val description: String,
6365
)
6466

6567
@Serializable

src/main/kotlin/app/revanced/api/server/repositories/BackendRepository.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,32 +179,31 @@ abstract class BackendRepository internal constructor(
179179
)
180180

181181
/**
182-
* Get the content of a file in a repository.
182+
* Get a release of a repository.
183183
*
184184
* @param owner The owner of the repository.
185185
* @param repository The name of the repository.
186-
* @param path The path to the file in the repository.
187-
* @return The content of the file.
186+
* @param prerelease Whether to get a prerelease.
187+
* @return The release.
188188
*/
189-
abstract suspend fun file(
189+
abstract suspend fun release(
190190
owner: String,
191191
repository: String,
192-
path: String,
193-
): String
192+
prerelease: Boolean,
193+
): BackendOrganization.BackendRepository.BackendRelease
194194

195195
/**
196-
* Get a release of a repository.
196+
* Get the releases of a repository.
197197
*
198198
* @param owner The owner of the repository.
199199
* @param repository The name of the repository.
200-
* @param prerelease Whether to get a prerelease.
201-
* @return The release.
200+
* @param count The maximum number of releases to get.
202201
*/
203-
abstract suspend fun release(
202+
abstract suspend fun releases(
204203
owner: String,
205204
repository: String,
206-
prerelease: Boolean,
207-
): BackendOrganization.BackendRepository.BackendRelease
205+
count: Int,
206+
): List<BackendOrganization.BackendRepository.BackendRelease>
208207

209208
/**
210209
* Get the contributors of a repository.

src/main/kotlin/app/revanced/api/server/repositories/ConfigurationRepository.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ internal class ConfigurationRepository(
4444
val contributorsRepositoryNames: Map<String, String>,
4545
@SerialName("backend-service-name")
4646
val backendServiceName: String,
47-
@SerialName("backend-service-main-branch")
48-
val backendServiceMainBranch: String,
49-
@SerialName("backend-service-prerelease-branch")
50-
val backendServicePrereleaseBranch: String,
5147
@SerialName("api-version")
5248
val apiVersion: String = "v1",
5349
@SerialName("cors-allowed-hosts")
@@ -96,8 +92,6 @@ internal class ConfigurationRepository(
9692
val publicKeyFile: File,
9793
@SerialName("public-key-id")
9894
val publicKeyId: Long,
99-
@SerialName("history-file")
100-
val historyFile: String?,
10195
)
10296

10397
/**
@@ -122,8 +116,6 @@ internal class ConfigurationRepository(
122116
@Serializable(with = RegexSerializer::class)
123117
@SerialName("downloaders-asset-regex")
124118
val downloadersAssetRegex: Regex,
125-
@SerialName("history-file")
126-
val historyFile: String?,
127119
)
128120
}
129121

src/main/kotlin/app/revanced/api/server/repositories/GitHubBackendRepository.kt

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ class GitHubBackendRepository : BackendRepository(
2525
"https://api.github.com",
2626
"https://github.com",
2727
) {
28-
override suspend fun file(
29-
owner: String,
30-
repository: String,
31-
path: String
32-
) = client.get("https://raw.githubusercontent.com/$owner/$repository/$path").body<String>()
33-
3428
override suspend fun release(
3529
owner: String,
3630
repository: String,
@@ -56,6 +50,35 @@ class GitHubBackendRepository : BackendRepository(
5650
)
5751
}
5852

53+
override suspend fun releases(
54+
owner: String,
55+
repository: String,
56+
count: Int
57+
): List<BackendRelease> {
58+
val releases: List<GitHubRelease> = client.get(
59+
Releases(
60+
owner,
61+
repository,
62+
perPage = count,
63+
),
64+
).body()
65+
66+
return releases.map {
67+
BackendRelease(
68+
tag = it.tagName,
69+
releaseNote = it.body,
70+
createdAt = it.createdAt.toLocalDateTime(TimeZone.UTC),
71+
prerelease = it.prerelease,
72+
assets = it.assets.map { asset ->
73+
BackendAsset(
74+
name = asset.name,
75+
downloadUrl = asset.browserDownloadUrl,
76+
)
77+
},
78+
)
79+
}
80+
}
81+
5982
override suspend fun contributors(
6083
owner: String,
6184
repository: String,

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package app.revanced.api.server.routes
22

33
import app.revanced.api.server.ApiRelease
4-
import app.revanced.api.server.ApiReleaseHistory
4+
import app.revanced.api.server.ApiReleaseSimple
55
import app.revanced.api.server.ApiReleaseVersion
66
import app.revanced.api.server.services.ManagerService
77
import io.ktor.http.*
@@ -42,8 +42,7 @@ internal fun Route.managerRoute() = route("manager") {
4242
val prerelease = call.parameters["prerelease"]?.toBoolean() ?: false
4343
val history = managerService.history(prerelease)
4444

45-
if (history != null) call.respond(history)
46-
else call.respond(HttpStatusCode.NotFound)
45+
call.respond(history)
4746
}.describe {
4847
description = "Get the manager release history"
4948
summary = "Get manager release history"
@@ -55,12 +54,9 @@ internal fun Route.managerRoute() = route("manager") {
5554
responses {
5655
HttpStatusCode.OK {
5756
description = "The manager release history"
58-
schema = jsonSchema<ApiReleaseHistory>()
57+
schema = jsonSchema<List<ApiReleaseSimple>>()
5958
ContentType.Application.Json()
6059
}
61-
HttpStatusCode.NotFound {
62-
description = "No manager release history found"
63-
}
6460
}
6561
}
6662

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

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

33
import app.revanced.api.server.ApiAssetPublicKey
44
import app.revanced.api.server.ApiRelease
5-
import app.revanced.api.server.ApiReleaseHistory
5+
import app.revanced.api.server.ApiReleaseSimple
66
import app.revanced.api.server.ApiReleaseVersion
77
import app.revanced.api.server.installCache
88
import app.revanced.api.server.services.PatchesService
@@ -45,8 +45,7 @@ internal fun Route.patchesRoute() = route("patches") {
4545
val prerelease = call.parameters["prerelease"]?.toBoolean() ?: false
4646
val history = patchesService.history(prerelease)
4747

48-
if (history != null) call.respond(history)
49-
else call.respond(HttpStatusCode.NotFound)
48+
call.respond(history)
5049
}.describe {
5150
description = "Get the patches release history"
5251
summary = "Get patches release history"
@@ -58,12 +57,9 @@ internal fun Route.patchesRoute() = route("patches") {
5857
responses {
5958
HttpStatusCode.OK {
6059
description = "The patches release history"
61-
schema = jsonSchema<ApiReleaseHistory>()
60+
schema = jsonSchema<List<ApiReleaseSimple>>()
6261
ContentType.Application.Json()
6362
}
64-
HttpStatusCode.NotFound {
65-
description = "No patches release history found"
66-
}
6763
}
6864
}
6965

0 commit comments

Comments
 (0)