Skip to content

Commit 7f9159f

Browse files
committed
chore: Merge branch dev to main(#195)
2 parents e22ec16 + b063b4d commit 7f9159f

File tree

8 files changed

+45
-9
lines changed

8 files changed

+45
-9
lines changed

Diff for: CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# [1.5.0-dev.2](https://github.com/ReVanced/revanced-api/compare/v1.5.0-dev.1...v1.5.0-dev.2) (2024-11-06)
2+
3+
4+
### Features
5+
6+
* Allow updating `createdAt` field for announcements ([58ba4cb](https://github.com/ReVanced/revanced-api/commit/58ba4cb11c789507826cd70ac548943a94da4223))
7+
* Simplify log pattern ([d5d9e04](https://github.com/ReVanced/revanced-api/commit/d5d9e04325fa93540be0438e7b51243e2aeeab3d))
8+
9+
# [1.5.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.4.0...v1.5.0-dev.1) (2024-11-06)
10+
11+
12+
### Features
13+
14+
* Move spec url to versioned path ([e871b23](https://github.com/ReVanced/revanced-api/commit/e871b23210798723c34bce93c7567d8fbcf4e060))
15+
* Simplify log pattern ([d5d9e04](https://github.com/ReVanced/revanced-api/commit/d5d9e04325fa93540be0438e7b51243e2aeeab3d))
16+
17+
# [1.5.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.4.0...v1.5.0-dev.1) (2024-11-06)
18+
19+
20+
### Features
21+
22+
* Move spec url to versioned path ([e871b23](https://github.com/ReVanced/revanced-api/commit/e871b23210798723c34bce93c7567d8fbcf4e060))
23+
124
# [1.4.0](https://github.com/ReVanced/revanced-api/compare/v1.3.0...v1.4.0) (2024-11-06)
225

326

Diff for: gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.parallel = true
22
org.gradle.caching = true
33
kotlin.code.style = official
4-
version = 1.4.0
4+
version = 1.5.0-dev.2

Diff for: src/main/kotlin/app/revanced/api/configuration/APISchema.kt

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class ApiAnnouncement(
6363
val attachments: List<String> = emptyList(),
6464
// Using a list instead of a set because set semantics are unnecessary here.
6565
val tags: List<String> = emptyList(),
66+
val createdAt: LocalDateTime,
6667
val archivedAt: LocalDateTime? = null,
6768
val level: Int = 0,
6869
)

Diff for: src/main/kotlin/app/revanced/api/configuration/HTTP.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.koin.ktor.ext.get
1111
import kotlin.time.Duration.Companion.minutes
1212

1313
fun Application.configureHTTP() {
14-
val configurationRepository = get<ConfigurationRepository>()
14+
val configuration = get<ConfigurationRepository>()
1515

1616
install(CORS) {
1717
HttpMethod.DefaultMethods.minus(HttpMethod.Options).forEach(::allowMethod)
@@ -22,7 +22,7 @@ fun Application.configureHTTP() {
2222

2323
allowCredentials = true
2424

25-
configurationRepository.corsAllowedHosts.forEach { host ->
25+
configuration.corsAllowedHosts.forEach { host ->
2626
allowHost(host = host, schemes = listOf("https"))
2727
}
2828
}

Diff for: src/main/kotlin/app/revanced/api/configuration/OpenAPI.kt

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package app.revanced.api.configuration
22

33
import app.revanced.api.command.applicationVersion
44
import app.revanced.api.configuration.repository.ConfigurationRepository
5+
import io.bkbn.kompendium.core.attribute.KompendiumAttributes
56
import io.bkbn.kompendium.core.plugin.NotarizedApplication
67
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
78
import io.bkbn.kompendium.oas.OpenApiSpec
@@ -12,13 +13,22 @@ import io.bkbn.kompendium.oas.info.License
1213
import io.bkbn.kompendium.oas.security.BearerAuth
1314
import io.bkbn.kompendium.oas.server.Server
1415
import io.ktor.server.application.*
15-
import org.koin.ktor.ext.get
16+
import io.ktor.server.response.*
17+
import io.ktor.server.routing.*
1618
import java.net.URI
19+
import org.koin.ktor.ext.get as koinGet
1720

1821
internal fun Application.configureOpenAPI() {
19-
val configurationRepository = get<ConfigurationRepository>()
22+
val configuration = koinGet<ConfigurationRepository>()
2023

2124
install(NotarizedApplication()) {
25+
openApiJson = {
26+
route("/${configuration.apiVersion}/openapi.json") {
27+
get {
28+
call.respond(application.attributes[KompendiumAttributes.openApiSpec])
29+
}
30+
}
31+
}
2232
spec = OpenApiSpec(
2333
info = Info(
2434
title = "ReVanced API",
@@ -41,7 +51,7 @@ internal fun Application.configureOpenAPI() {
4151
),
4252
).apply {
4353
servers += Server(
44-
url = URI(configurationRepository.endpoint),
54+
url = URI(configuration.endpoint),
4555
description = "ReVanced API server",
4656
)
4757
}

Diff for: src/main/kotlin/app/revanced/api/configuration/Routing.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ internal fun Application.configureRouting() = routing {
5252
extensions("json", "asc")
5353
}
5454

55-
swagger(pageTitle = "ReVanced API", path = "/")
56-
redoc(pageTitle = "ReVanced API", path = "/redoc")
55+
val specUrl = "/${configuration.apiVersion}/openapi.json"
56+
swagger(pageTitle = "ReVanced API", path = "/", specUrl = specUrl)
57+
redoc(pageTitle = "ReVanced API", path = "/redoc", specUrl = specUrl)
5758
}

Diff for: src/main/kotlin/app/revanced/api/configuration/repository/AnnouncementRepository.kt

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ internal class AnnouncementRepository(private val database: Database) {
120120
it.author = new.author
121121
it.title = new.title
122122
it.content = new.content
123+
it.createdAt = new.createdAt
123124
it.archivedAt = new.archivedAt
124125
it.level = new.level
125126

Diff for: src/main/resources/logback.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<configuration>
22
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
33
<encoder>
4-
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
4+
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} %-5level %msg%n</pattern>
55
</encoder>
66
</appender>
77
<root level="\${LOG_LEVEL:-INFO}">

0 commit comments

Comments
 (0)