From 7f6e29de5205f63ac4aaea490c844b58e14000c8 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 13 Nov 2024 22:22:50 +0100 Subject: [PATCH 1/7] feat: Allow setting `Announcement.createdAt` when creating an announcement --- src/main/kotlin/app/revanced/api/configuration/APISchema.kt | 5 ++++- .../api/configuration/repository/AnnouncementRepository.kt | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/api/configuration/APISchema.kt b/src/main/kotlin/app/revanced/api/configuration/APISchema.kt index 2fa588a..4e50729 100644 --- a/src/main/kotlin/app/revanced/api/configuration/APISchema.kt +++ b/src/main/kotlin/app/revanced/api/configuration/APISchema.kt @@ -1,6 +1,9 @@ package app.revanced.api.configuration +import kotlinx.datetime.Clock import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.TimeZone +import kotlinx.datetime.toLocalDateTime import kotlinx.serialization.Serializable interface ApiUser { @@ -63,7 +66,7 @@ class ApiAnnouncement( val attachments: List = emptyList(), // Using a list instead of a set because set semantics are unnecessary here. val tags: List = emptyList(), - val createdAt: LocalDateTime, + val createdAt: LocalDateTime = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()), val archivedAt: LocalDateTime? = null, val level: Int = 0, ) diff --git a/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt b/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt index 6acfa29..45942f1 100644 --- a/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt +++ b/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt @@ -100,6 +100,7 @@ internal class AnnouncementRepository(private val database: Database) { author = new.author title = new.title content = new.content + createdAt = new.createdAt archivedAt = new.archivedAt level = new.level tags = SizedCollection( From 5d5533a9200ccdf1c73d4a9c44d994a01671c8a6 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 23 Nov 2024 18:26:28 +0000 Subject: [PATCH 2/7] chore: Release v1.6.0-dev.1 [skip ci] # [1.6.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.5.0...v1.6.0-dev.1) (2024-11-23) ### Features * Allow setting `Announcement.createdAt` when creating an announcement ([7f6e29d](https://github.com/ReVanced/revanced-api/commit/7f6e29de5205f63ac4aaea490c844b58e14000c8)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e204be..6c9cef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.6.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.5.0...v1.6.0-dev.1) (2024-11-23) + + +### Features + +* Allow setting `Announcement.createdAt` when creating an announcement ([7f6e29d](https://github.com/ReVanced/revanced-api/commit/7f6e29de5205f63ac4aaea490c844b58e14000c8)) + # [1.5.0](https://github.com/ReVanced/revanced-api/compare/v1.4.0...v1.5.0) (2024-11-06) diff --git a/gradle.properties b/gradle.properties index bcf2fd8..ae636db 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 1.5.0 +version = 1.6.0-dev.1 From db22874f063bae0c9e7f0c99a20cdf1b16addd89 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 21 Dec 2024 00:25:26 +0100 Subject: [PATCH 3/7] feat: Make some announcements schema fields nullable --- .../revanced/api/configuration/APISchema.kt | 8 +-- .../repository/AnnouncementRepository.kt | 50 ++++++++++--------- .../services/AnnouncementServiceTest.kt | 4 +- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/main/kotlin/app/revanced/api/configuration/APISchema.kt b/src/main/kotlin/app/revanced/api/configuration/APISchema.kt index 4e50729..74bd854 100644 --- a/src/main/kotlin/app/revanced/api/configuration/APISchema.kt +++ b/src/main/kotlin/app/revanced/api/configuration/APISchema.kt @@ -63,9 +63,9 @@ class ApiAnnouncement( val title: String, val content: String? = null, // Using a list instead of a set because set semantics are unnecessary here. - val attachments: List = emptyList(), + val attachments: List? = null, // Using a list instead of a set because set semantics are unnecessary here. - val tags: List = emptyList(), + val tags: List? = null, val createdAt: LocalDateTime = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()), val archivedAt: LocalDateTime? = null, val level: Int = 0, @@ -78,9 +78,9 @@ class ApiResponseAnnouncement( val title: String, val content: String? = null, // Using a list instead of a set because set semantics are unnecessary here. - val attachments: List = emptyList(), + val attachments: List? = null, // Using a list instead of a set because set semantics are unnecessary here. - val tags: List = emptyList(), + val tags: List? = null, val createdAt: LocalDateTime, val archivedAt: LocalDateTime? = null, val level: Int = 0, diff --git a/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt b/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt index 45942f1..f4e4dbf 100644 --- a/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt +++ b/src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt @@ -69,8 +69,7 @@ internal class AnnouncementRepository(private val database: Database) { fun latestId() = latestAnnouncement?.id?.value.toApiResponseAnnouncementId() - fun latestId(tags: Set) = - tags.map { tag -> latestAnnouncementByTag[tag]?.id?.value }.toApiResponseAnnouncementId() + fun latestId(tags: Set) = tags.map { tag -> latestAnnouncementByTag[tag]?.id?.value }.toApiResponseAnnouncementId() suspend fun paged(cursor: Int, count: Int, tags: Set?) = transaction { Announcement.find { @@ -103,11 +102,13 @@ internal class AnnouncementRepository(private val database: Database) { createdAt = new.createdAt archivedAt = new.archivedAt level = new.level - tags = SizedCollection( - new.tags.map { tag -> Tag.find { Tags.name eq tag }.firstOrNull() ?: Tag.new { name = tag } }, - ) + if (new.tags != null) { + tags = SizedCollection( + new.tags.map { tag -> Tag.find { Tags.name eq tag }.firstOrNull() ?: Tag.new { name = tag } }, + ) + } }.apply { - new.attachments.map { attachmentUrl -> + new.attachments?.map { attachmentUrl -> Attachment.new { url = attachmentUrl announcement = this@apply @@ -125,24 +126,28 @@ internal class AnnouncementRepository(private val database: Database) { it.archivedAt = new.archivedAt it.level = new.level - // Get the old tags, create new tags if they don't exist, - // and delete tags that are not in the new tags, after updating the announcement. - val oldTags = it.tags.toList() - val updatedTags = new.tags.map { name -> - Tag.find { Tags.name eq name }.firstOrNull() ?: Tag.new { this.name = name } - } - it.tags = SizedCollection(updatedTags) - oldTags.forEach { tag -> - if (tag in updatedTags || !tag.announcements.empty()) return@forEach - tag.delete() + if (new.tags != null) { + // Get the old tags, create new tags if they don't exist, + // and delete tags that are not in the new tags, after updating the announcement. + val oldTags = it.tags.toList() + val updatedTags = new.tags.map { name -> + Tag.find { Tags.name eq name }.firstOrNull() ?: Tag.new { this.name = name } + } + it.tags = SizedCollection(updatedTags) + oldTags.forEach { tag -> + if (tag in updatedTags || !tag.announcements.empty()) return@forEach + tag.delete() + } } // Delete old attachments and create new attachments. - it.attachments.forEach { attachment -> attachment.delete() } - new.attachments.map { attachment -> - Attachment.new { - url = attachment - announcement = it + if (new.attachments != null) { + it.attachments.forEach { attachment -> attachment.delete() } + new.attachments.map { attachment -> + Attachment.new { + url = attachment + announcement = it + } } } }?.let(::updateLatestAnnouncement) ?: Unit @@ -175,8 +180,7 @@ internal class AnnouncementRepository(private val database: Database) { Tag.all().toList().toApiTag() } - private suspend fun transaction(statement: suspend Transaction.() -> T) = - newSuspendedTransaction(Dispatchers.IO, database, statement = statement) + private suspend fun transaction(statement: suspend Transaction.() -> T) = newSuspendedTransaction(Dispatchers.IO, database, statement = statement) private object Announcements : IntIdTable() { val author = varchar("author", 32).nullable() diff --git a/src/test/kotlin/app/revanced/api/configuration/services/AnnouncementServiceTest.kt b/src/test/kotlin/app/revanced/api/configuration/services/AnnouncementServiceTest.kt index b2007a7..120d290 100644 --- a/src/test/kotlin/app/revanced/api/configuration/services/AnnouncementServiceTest.kt +++ b/src/test/kotlin/app/revanced/api/configuration/services/AnnouncementServiceTest.kt @@ -135,7 +135,7 @@ private object AnnouncementServiceTest { val latestAnnouncement = announcementService.latest()!! val latestId = latestAnnouncement.id - val attachments = latestAnnouncement.attachments + val attachments = latestAnnouncement.attachments!! assertEquals(2, attachments.size) assert(attachments.any { it == "attachment1" }) assert(attachments.any { it == "attachment2" }) @@ -144,7 +144,7 @@ private object AnnouncementServiceTest { latestId, ApiAnnouncement(title = "title", attachments = listOf("attachment1", "attachment3")), ) - assert(announcementService.get(latestId)!!.attachments.any { it == "attachment3" }) + assert(announcementService.get(latestId)!!.attachments!!.any { it == "attachment3" }) } @Test From 712ab3be8cc5588e5d19237c7381fce0a67bf46c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 20 Dec 2024 23:27:48 +0000 Subject: [PATCH 4/7] chore: Release v1.6.0-dev.2 [skip ci] # [1.6.0-dev.2](https://github.com/ReVanced/revanced-api/compare/v1.6.0-dev.1...v1.6.0-dev.2) (2024-12-20) ### Features * Make some announcements schema fields nullable ([db22874](https://github.com/ReVanced/revanced-api/commit/db22874f063bae0c9e7f0c99a20cdf1b16addd89)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c9cef5..9a5fba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.6.0-dev.2](https://github.com/ReVanced/revanced-api/compare/v1.6.0-dev.1...v1.6.0-dev.2) (2024-12-20) + + +### Features + +* Make some announcements schema fields nullable ([db22874](https://github.com/ReVanced/revanced-api/commit/db22874f063bae0c9e7f0c99a20cdf1b16addd89)) + # [1.6.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.5.0...v1.6.0-dev.1) (2024-11-23) diff --git a/gradle.properties b/gradle.properties index ae636db..c49be00 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 1.6.0-dev.1 +version = 1.6.0-dev.2 From 8a957cd797e7e42f43670baaed60ac0d3543342f Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 24 Dec 2024 17:03:00 +0100 Subject: [PATCH 5/7] feat: Add status page link to about --- about.example.json | 1 + src/main/kotlin/app/revanced/api/configuration/APISchema.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/about.example.json b/about.example.json index f452fe4..3611a4c 100644 --- a/about.example.json +++ b/about.example.json @@ -5,6 +5,7 @@ "branding": { "logo": "https://raw.githubusercontent.com/ReVanced/revanced-branding/main/assets/revanced-logo/revanced-logo.svg" }, + "status": "https://status.revanced.app", "contact": { "email": "contact@revanced.app" }, diff --git a/src/main/kotlin/app/revanced/api/configuration/APISchema.kt b/src/main/kotlin/app/revanced/api/configuration/APISchema.kt index 74bd854..d99a70d 100644 --- a/src/main/kotlin/app/revanced/api/configuration/APISchema.kt +++ b/src/main/kotlin/app/revanced/api/configuration/APISchema.kt @@ -123,6 +123,7 @@ class APIAbout( // Using a list instead of a set because set semantics are unnecessary here. val socials: List?, val donations: Donations?, + val status: String, ) { @Serializable class Branding( From c25bc8b4ba2bd4bf1708f19dc8bc228a7f54d548 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 25 Dec 2024 11:49:34 +0100 Subject: [PATCH 6/7] feat: Add support for prereleases --- .../repository/BackendRepository.kt | 6 +++-- .../repository/GitHubBackendRepository.kt | 14 +++++------ .../api/configuration/routes/ManagerRoute.kt | 20 +++++++++++++-- .../api/configuration/routes/PatchesRoute.kt | 25 ++++++++++++++++--- .../configuration/services/ManagerService.kt | 6 +++-- .../configuration/services/PatchesService.kt | 9 ++++--- .../services/SignatureService.kt | 2 +- 7 files changed, 62 insertions(+), 20 deletions(-) diff --git a/src/main/kotlin/app/revanced/api/configuration/repository/BackendRepository.kt b/src/main/kotlin/app/revanced/api/configuration/repository/BackendRepository.kt index 85d10bb..6bf6d52 100644 --- a/src/main/kotlin/app/revanced/api/configuration/repository/BackendRepository.kt +++ b/src/main/kotlin/app/revanced/api/configuration/repository/BackendRepository.kt @@ -135,12 +135,14 @@ abstract class BackendRepository internal constructor( * @property tag The tag of the release. * @property assets The assets of the release. * @property createdAt The date and time the release was created. + * @property prerelease Whether the release is a prerelease. * @property releaseNote The release note of the release. */ class BackendRelease( val tag: String, val releaseNote: String, val createdAt: LocalDateTime, + val prerelease: Boolean, // Using a list instead of a set because set semantics are unnecessary here. val assets: List, ) { @@ -180,13 +182,13 @@ abstract class BackendRepository internal constructor( * * @param owner The owner of the repository. * @param repository The name of the repository. - * @param tag The tag of the release. If null, the latest release is returned. + * @param prerelease Whether to get a prerelease. * @return The release. */ abstract suspend fun release( owner: String, repository: String, - tag: String? = null, + prerelease: Boolean, ): BackendOrganization.BackendRepository.BackendRelease /** diff --git a/src/main/kotlin/app/revanced/api/configuration/repository/GitHubBackendRepository.kt b/src/main/kotlin/app/revanced/api/configuration/repository/GitHubBackendRepository.kt index 420ccaf..0afe8d1 100644 --- a/src/main/kotlin/app/revanced/api/configuration/repository/GitHubBackendRepository.kt +++ b/src/main/kotlin/app/revanced/api/configuration/repository/GitHubBackendRepository.kt @@ -24,10 +24,10 @@ class GitHubBackendRepository : BackendRepository("https://api.github.com", "htt override suspend fun release( owner: String, repository: String, - tag: String?, + prerelease: Boolean, ): BackendRelease { - val release: GitHubRelease = if (tag != null) { - client.get(Releases.Tag(owner, repository, tag)).body() + val release: GitHubRelease = if (prerelease) { + client.get(Releases(owner, repository)).body>().first { it.prerelease } } else { client.get(Releases.Latest(owner, repository)).body() } @@ -36,6 +36,7 @@ class GitHubBackendRepository : BackendRepository("https://api.github.com", "htt tag = release.tagName, releaseNote = release.body, createdAt = release.createdAt.toLocalDateTime(TimeZone.UTC), + prerelease = release.prerelease, assets = release.assets.map { BackendAsset( name = it.name, @@ -163,6 +164,7 @@ class GitHubOrganization { // Using a list instead of a set because set semantics are unnecessary here. val assets: List, val createdAt: Instant, + val prerelease: Boolean, val body: String, ) { @Serializable @@ -200,10 +202,8 @@ class Organization { @Resource("/repos/{owner}/{repo}/contributors") class Contributors(val owner: String, val repo: String, @SerialName("per_page") val perPage: Int = 100) - class Releases { - @Resource("/repos/{owner}/{repo}/releases/tags/{tag}") - class Tag(val owner: String, val repo: String, val tag: String) - + @Resource("/repos/{owner}/{repo}/releases") + class Releases(val owner: String, val repo: String) { @Resource("/repos/{owner}/{repo}/releases/latest") class Latest(val owner: String, val repo: String) } diff --git a/src/main/kotlin/app/revanced/api/configuration/routes/ManagerRoute.kt b/src/main/kotlin/app/revanced/api/configuration/routes/ManagerRoute.kt index c82c0fb..e3ef9c9 100644 --- a/src/main/kotlin/app/revanced/api/configuration/routes/ManagerRoute.kt +++ b/src/main/kotlin/app/revanced/api/configuration/routes/ManagerRoute.kt @@ -5,6 +5,8 @@ import app.revanced.api.configuration.ApiReleaseVersion import app.revanced.api.configuration.installNotarizedRoute import app.revanced.api.configuration.services.ManagerService import io.bkbn.kompendium.core.metadata.GetInfo +import io.bkbn.kompendium.json.schema.definition.TypeDefinition +import io.bkbn.kompendium.oas.payload.Parameter import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.plugins.ratelimit.* @@ -19,25 +21,38 @@ internal fun Route.managerRoute() = route("manager") { rateLimit(RateLimitName("weak")) { get { - call.respond(managerService.latestRelease()) + val prerelease = call.parameters["prerelease"]?.toBoolean() ?: false + + call.respond(managerService.latestRelease(prerelease)) } route("version") { installManagerVersionRouteDocumentation() get { - call.respond(managerService.latestVersion()) + val prerelease = call.parameters["prerelease"]?.toBoolean() ?: false + + call.respond(managerService.latestVersion(prerelease)) } } } } +private val prereleaseParameter = Parameter( + name = "prerelease", + `in` = Parameter.Location.query, + schema = TypeDefinition.STRING, + description = "Whether to get the current manager prerelease", + required = false, +) + private fun Route.installManagerRouteDocumentation() = installNotarizedRoute { tags = setOf("Manager") get = GetInfo.builder { description("Get the current manager release") summary("Get current manager release") + parameters(prereleaseParameter) response { description("The latest manager release") mediaTypes("application/json") @@ -53,6 +68,7 @@ private fun Route.installManagerVersionRouteDocumentation() = installNotarizedRo get = GetInfo.builder { description("Get the current manager release version") summary("Get current manager release version") + parameters(prereleaseParameter) response { description("The current manager release version") mediaTypes("application/json") diff --git a/src/main/kotlin/app/revanced/api/configuration/routes/PatchesRoute.kt b/src/main/kotlin/app/revanced/api/configuration/routes/PatchesRoute.kt index 9672d9e..9c5b5b5 100644 --- a/src/main/kotlin/app/revanced/api/configuration/routes/PatchesRoute.kt +++ b/src/main/kotlin/app/revanced/api/configuration/routes/PatchesRoute.kt @@ -7,6 +7,8 @@ import app.revanced.api.configuration.installCache import app.revanced.api.configuration.installNotarizedRoute import app.revanced.api.configuration.services.PatchesService import io.bkbn.kompendium.core.metadata.GetInfo +import io.bkbn.kompendium.json.schema.definition.TypeDefinition +import io.bkbn.kompendium.oas.payload.Parameter import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.plugins.ratelimit.* @@ -22,14 +24,18 @@ internal fun Route.patchesRoute() = route("patches") { rateLimit(RateLimitName("weak")) { get { - call.respond(patchesService.latestRelease()) + val prerelease = call.parameters["prerelease"]?.toBoolean() ?: false + + call.respond(patchesService.latestRelease(prerelease)) } route("version") { installPatchesVersionRouteDocumentation() get { - call.respond(patchesService.latestVersion()) + val prerelease = call.parameters["prerelease"]?.toBoolean() ?: false + + call.respond(patchesService.latestVersion(prerelease)) } } } @@ -39,7 +45,9 @@ internal fun Route.patchesRoute() = route("patches") { installPatchesListRouteDocumentation() get { - call.respondBytes(ContentType.Application.Json) { patchesService.list() } + val prerelease = call.parameters["prerelease"]?.toBoolean() ?: false + + call.respondBytes(ContentType.Application.Json) { patchesService.list(prerelease) } } } } @@ -57,12 +65,21 @@ internal fun Route.patchesRoute() = route("patches") { } } +private val prereleaseParameter = Parameter( + name = "prerelease", + `in` = Parameter.Location.query, + schema = TypeDefinition.STRING, + description = "Whether to get the current patches prerelease", + required = false, +) + private fun Route.installPatchesRouteDocumentation() = installNotarizedRoute { tags = setOf("Patches") get = GetInfo.builder { description("Get the current patches release") summary("Get current patches release") + parameters(prereleaseParameter) response { description("The current patches release") mediaTypes("application/json") @@ -78,6 +95,7 @@ private fun Route.installPatchesVersionRouteDocumentation() = installNotarizedRo get = GetInfo.builder { description("Get the current patches release version") summary("Get current patches release version") + parameters(prereleaseParameter) response { description("The current patches release version") mediaTypes("application/json") @@ -93,6 +111,7 @@ private fun Route.installPatchesListRouteDocumentation() = installNotarizedRoute get = GetInfo.builder { description("Get the list of patches from the current patches release") summary("Get list of patches from current patches release") + parameters(prereleaseParameter) response { description("The list of patches") mediaTypes("application/json") diff --git a/src/main/kotlin/app/revanced/api/configuration/services/ManagerService.kt b/src/main/kotlin/app/revanced/api/configuration/services/ManagerService.kt index af53621..2bf0703 100644 --- a/src/main/kotlin/app/revanced/api/configuration/services/ManagerService.kt +++ b/src/main/kotlin/app/revanced/api/configuration/services/ManagerService.kt @@ -10,10 +10,11 @@ internal class ManagerService( private val backendRepository: BackendRepository, private val configurationRepository: ConfigurationRepository, ) { - suspend fun latestRelease(): ApiRelease { + suspend fun latestRelease(prerelease: Boolean): ApiRelease { val managerRelease = backendRepository.release( configurationRepository.organization, configurationRepository.manager.repository, + prerelease, ) return ApiRelease( @@ -24,10 +25,11 @@ internal class ManagerService( ) } - suspend fun latestVersion(): ApiReleaseVersion { + suspend fun latestVersion(prerelease: Boolean): ApiReleaseVersion { val managerRelease = backendRepository.release( configurationRepository.organization, configurationRepository.manager.repository, + prerelease, ) return ApiReleaseVersion(managerRelease.tag) diff --git a/src/main/kotlin/app/revanced/api/configuration/services/PatchesService.kt b/src/main/kotlin/app/revanced/api/configuration/services/PatchesService.kt index b9d3608..563509a 100644 --- a/src/main/kotlin/app/revanced/api/configuration/services/PatchesService.kt +++ b/src/main/kotlin/app/revanced/api/configuration/services/PatchesService.kt @@ -19,10 +19,11 @@ internal class PatchesService( private val backendRepository: BackendRepository, private val configurationRepository: ConfigurationRepository, ) { - suspend fun latestRelease(): ApiRelease { + suspend fun latestRelease(prerelease: Boolean): ApiRelease { val patchesRelease = backendRepository.release( configurationRepository.organization, configurationRepository.patches.repository, + prerelease, ) return ApiRelease( @@ -34,10 +35,11 @@ internal class PatchesService( ) } - suspend fun latestVersion(): ApiReleaseVersion { + suspend fun latestVersion(prerelease: Boolean): ApiReleaseVersion { val patchesRelease = backendRepository.release( configurationRepository.organization, configurationRepository.patches.repository, + prerelease, ) return ApiReleaseVersion(patchesRelease.tag) @@ -48,10 +50,11 @@ internal class PatchesService( .maximumSize(1) .build() - suspend fun list(): ByteArray { + suspend fun list(prerelease: Boolean): ByteArray { val patchesRelease = backendRepository.release( configurationRepository.organization, configurationRepository.patches.repository, + prerelease, ) return withContext(Dispatchers.IO) { diff --git a/src/main/kotlin/app/revanced/api/configuration/services/SignatureService.kt b/src/main/kotlin/app/revanced/api/configuration/services/SignatureService.kt index fc69005..9f65109 100644 --- a/src/main/kotlin/app/revanced/api/configuration/services/SignatureService.kt +++ b/src/main/kotlin/app/revanced/api/configuration/services/SignatureService.kt @@ -12,7 +12,7 @@ import java.security.MessageDigest internal class SignatureService { private val signatureCache = Caffeine .newBuilder() - .maximumSize(1) // 1 because currently only the latest patches is needed. + .maximumSize(2) // 2 because currently only the latest release and prerelease patches are needed. .build() // Hash -> Verified. fun verify( From 5b447aa62df2c491551447421e834430a8009436 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 25 Dec 2024 10:52:04 +0000 Subject: [PATCH 7/7] chore: Release v1.6.0-dev.3 [skip ci] # [1.6.0-dev.3](https://github.com/ReVanced/revanced-api/compare/v1.6.0-dev.2...v1.6.0-dev.3) (2024-12-25) ### Features * Add status page link to about ([8a957cd](https://github.com/ReVanced/revanced-api/commit/8a957cd797e7e42f43670baaed60ac0d3543342f)) * Add support for prereleases ([c25bc8b](https://github.com/ReVanced/revanced-api/commit/c25bc8b4ba2bd4bf1708f19dc8bc228a7f54d548)) --- CHANGELOG.md | 8 ++++++++ gradle.properties | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a5fba5..28ca42e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# [1.6.0-dev.3](https://github.com/ReVanced/revanced-api/compare/v1.6.0-dev.2...v1.6.0-dev.3) (2024-12-25) + + +### Features + +* Add status page link to about ([8a957cd](https://github.com/ReVanced/revanced-api/commit/8a957cd797e7e42f43670baaed60ac0d3543342f)) +* Add support for prereleases ([c25bc8b](https://github.com/ReVanced/revanced-api/commit/c25bc8b4ba2bd4bf1708f19dc8bc228a7f54d548)) + # [1.6.0-dev.2](https://github.com/ReVanced/revanced-api/compare/v1.6.0-dev.1...v1.6.0-dev.2) (2024-12-20) diff --git a/gradle.properties b/gradle.properties index c49be00..be9d2c0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 1.6.0-dev.2 +version = 1.6.0-dev.3