mirror of
https://github.com/ReVanced/revanced-api.git
synced 2026-01-11 05:46:18 +00:00
chore: Merge branch dev to main(#195)
This commit is contained in:
23
CHANGELOG.md
23
CHANGELOG.md
@@ -1,3 +1,26 @@
|
|||||||
|
# [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)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Allow updating `createdAt` field for announcements ([58ba4cb](https://github.com/ReVanced/revanced-api/commit/58ba4cb11c789507826cd70ac548943a94da4223))
|
||||||
|
* Simplify log pattern ([d5d9e04](https://github.com/ReVanced/revanced-api/commit/d5d9e04325fa93540be0438e7b51243e2aeeab3d))
|
||||||
|
|
||||||
|
# [1.5.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.4.0...v1.5.0-dev.1) (2024-11-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Move spec url to versioned path ([e871b23](https://github.com/ReVanced/revanced-api/commit/e871b23210798723c34bce93c7567d8fbcf4e060))
|
||||||
|
* Simplify log pattern ([d5d9e04](https://github.com/ReVanced/revanced-api/commit/d5d9e04325fa93540be0438e7b51243e2aeeab3d))
|
||||||
|
|
||||||
|
# [1.5.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.4.0...v1.5.0-dev.1) (2024-11-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Move spec url to versioned path ([e871b23](https://github.com/ReVanced/revanced-api/commit/e871b23210798723c34bce93c7567d8fbcf4e060))
|
||||||
|
|
||||||
# [1.4.0](https://github.com/ReVanced/revanced-api/compare/v1.3.0...v1.4.0) (2024-11-06)
|
# [1.4.0](https://github.com/ReVanced/revanced-api/compare/v1.3.0...v1.4.0) (2024-11-06)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 1.4.0
|
version = 1.5.0-dev.2
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class ApiAnnouncement(
|
|||||||
val attachments: List<String> = emptyList(),
|
val attachments: List<String> = emptyList(),
|
||||||
// Using a list instead of a set because set semantics are unnecessary here.
|
// Using a list instead of a set because set semantics are unnecessary here.
|
||||||
val tags: List<String> = emptyList(),
|
val tags: List<String> = emptyList(),
|
||||||
|
val createdAt: LocalDateTime,
|
||||||
val archivedAt: LocalDateTime? = null,
|
val archivedAt: LocalDateTime? = null,
|
||||||
val level: Int = 0,
|
val level: Int = 0,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import org.koin.ktor.ext.get
|
|||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.minutes
|
||||||
|
|
||||||
fun Application.configureHTTP() {
|
fun Application.configureHTTP() {
|
||||||
val configurationRepository = get<ConfigurationRepository>()
|
val configuration = get<ConfigurationRepository>()
|
||||||
|
|
||||||
install(CORS) {
|
install(CORS) {
|
||||||
HttpMethod.DefaultMethods.minus(HttpMethod.Options).forEach(::allowMethod)
|
HttpMethod.DefaultMethods.minus(HttpMethod.Options).forEach(::allowMethod)
|
||||||
@@ -22,7 +22,7 @@ fun Application.configureHTTP() {
|
|||||||
|
|
||||||
allowCredentials = true
|
allowCredentials = true
|
||||||
|
|
||||||
configurationRepository.corsAllowedHosts.forEach { host ->
|
configuration.corsAllowedHosts.forEach { host ->
|
||||||
allowHost(host = host, schemes = listOf("https"))
|
allowHost(host = host, schemes = listOf("https"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package app.revanced.api.configuration
|
|||||||
|
|
||||||
import app.revanced.api.command.applicationVersion
|
import app.revanced.api.command.applicationVersion
|
||||||
import app.revanced.api.configuration.repository.ConfigurationRepository
|
import app.revanced.api.configuration.repository.ConfigurationRepository
|
||||||
|
import io.bkbn.kompendium.core.attribute.KompendiumAttributes
|
||||||
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
||||||
import io.bkbn.kompendium.oas.OpenApiSpec
|
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||||
@@ -12,13 +13,22 @@ import io.bkbn.kompendium.oas.info.License
|
|||||||
import io.bkbn.kompendium.oas.security.BearerAuth
|
import io.bkbn.kompendium.oas.security.BearerAuth
|
||||||
import io.bkbn.kompendium.oas.server.Server
|
import io.bkbn.kompendium.oas.server.Server
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
import org.koin.ktor.ext.get
|
import io.ktor.server.response.*
|
||||||
|
import io.ktor.server.routing.*
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
import org.koin.ktor.ext.get as koinGet
|
||||||
|
|
||||||
internal fun Application.configureOpenAPI() {
|
internal fun Application.configureOpenAPI() {
|
||||||
val configurationRepository = get<ConfigurationRepository>()
|
val configuration = koinGet<ConfigurationRepository>()
|
||||||
|
|
||||||
install(NotarizedApplication()) {
|
install(NotarizedApplication()) {
|
||||||
|
openApiJson = {
|
||||||
|
route("/${configuration.apiVersion}/openapi.json") {
|
||||||
|
get {
|
||||||
|
call.respond(application.attributes[KompendiumAttributes.openApiSpec])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
spec = OpenApiSpec(
|
spec = OpenApiSpec(
|
||||||
info = Info(
|
info = Info(
|
||||||
title = "ReVanced API",
|
title = "ReVanced API",
|
||||||
@@ -41,7 +51,7 @@ internal fun Application.configureOpenAPI() {
|
|||||||
),
|
),
|
||||||
).apply {
|
).apply {
|
||||||
servers += Server(
|
servers += Server(
|
||||||
url = URI(configurationRepository.endpoint),
|
url = URI(configuration.endpoint),
|
||||||
description = "ReVanced API server",
|
description = "ReVanced API server",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ internal fun Application.configureRouting() = routing {
|
|||||||
extensions("json", "asc")
|
extensions("json", "asc")
|
||||||
}
|
}
|
||||||
|
|
||||||
swagger(pageTitle = "ReVanced API", path = "/")
|
val specUrl = "/${configuration.apiVersion}/openapi.json"
|
||||||
redoc(pageTitle = "ReVanced API", path = "/redoc")
|
swagger(pageTitle = "ReVanced API", path = "/", specUrl = specUrl)
|
||||||
|
redoc(pageTitle = "ReVanced API", path = "/redoc", specUrl = specUrl)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ internal class AnnouncementRepository(private val database: Database) {
|
|||||||
it.author = new.author
|
it.author = new.author
|
||||||
it.title = new.title
|
it.title = new.title
|
||||||
it.content = new.content
|
it.content = new.content
|
||||||
|
it.createdAt = new.createdAt
|
||||||
it.archivedAt = new.archivedAt
|
it.archivedAt = new.archivedAt
|
||||||
it.level = new.level
|
it.level = new.level
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} %-5level %msg%n</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
<root level="\${LOG_LEVEL:-INFO}">
|
<root level="\${LOG_LEVEL:-INFO}">
|
||||||
|
|||||||
Reference in New Issue
Block a user