Skip to content

Commit 2e4f490

Browse files
committed
Update Ktor to 3.2.1 / Koin to 4.1.0
Koin added support for Ktor 3 in version 4.1.0, but apparently also broke Ktor 2 support in the same release. Thus, we need to update both dependencies simultaneously. For some reason, Ktor hasn't published ktor-server-tests for Ktor 3 even though Ktor 3 has been out since 2024-10-10. We're not actually using Ktor tests currently, so we can remove that dependency to allow the upgrade to build.
1 parent ba84dc6 commit 2e4f490

File tree

10 files changed

+728
-1022
lines changed

10 files changed

+728
-1022
lines changed

console/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ dependencies {
5555
implementation(libs.ktor.server.resources)
5656
implementation(libs.logback)
5757
implementation(libs.postgresql)
58-
testImplementation(libs.ktor.server.tests)
5958
testImplementation(libs.kotlin.test)
6059
}
6160

console/src/main/kotlin/app/accrescent/parcelo/console/data/Database.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fun Application.configureDatabase(): DataSource {
6565
BaselineWhitelistedGitHubUsers,
6666
)
6767

68-
if (environment.developmentMode) {
68+
if (developmentMode) {
6969
// Create a default superuser
7070
val debugUserGitHubId = (System.getenv("DEBUG_USER_GITHUB_ID")
7171
?: throw Exception("DEBUG_USER_GITHUB_ID not specified in environment")).toLong()

console/src/main/kotlin/app/accrescent/parcelo/console/routes/Drafts.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import io.ktor.http.content.PartData
3535
import io.ktor.http.content.readAllParts
3636
import io.ktor.http.content.streamProvider
3737
import io.ktor.resources.Resource
38-
import io.ktor.server.application.call
3938
import io.ktor.server.auth.authenticate
4039
import io.ktor.server.auth.principal
4140
import io.ktor.server.request.receive
@@ -105,6 +104,7 @@ fun Route.createDraftRoute() {
105104
var shortDescription: String? = null
106105
var iconData: ByteArray? = null
107106

107+
@Suppress("DEPRECATION_ERROR")
108108
val multipart = call.receiveMultipart().readAllParts()
109109

110110
try {

console/src/main/kotlin/app/accrescent/parcelo/console/routes/Edits.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ fun Route.createEditRoute() {
9191

9292
var shortDescription: String? = null
9393

94+
@Suppress("DEPRECATION_ERROR")
9495
val multipart = call.receiveMultipart().readAllParts()
9596

9697
try {

console/src/main/kotlin/app/accrescent/parcelo/console/routes/Updates.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ fun Route.createUpdateRoute() {
110110

111111
var apkSet: ApkSet? = null
112112

113+
@Suppress("DEPRECATION_ERROR")
113114
val multipart = call.receiveMultipart().readAllParts()
114115

115116
try {

console/src/main/kotlin/app/accrescent/parcelo/console/routes/auth/Auth.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fun Application.configureAuthentication(
4242
githubRedirectUrl: String,
4343
httpClient: HttpClient = HttpClient(),
4444
) {
45-
val developmentMode = environment.developmentMode
45+
val developmentMode = developmentMode
4646

4747
install(Sessions) {
4848
cookie<Session>(if (!developmentMode) "__Host-session" else "session") {

console/src/main/kotlin/app/accrescent/parcelo/console/routes/auth/GitHub.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import io.ktor.client.HttpClient
1515
import io.ktor.http.Cookie
1616
import io.ktor.http.HttpMethod
1717
import io.ktor.http.HttpStatusCode
18+
import io.ktor.server.application.Application
1819
import io.ktor.server.application.ApplicationEnvironment
1920
import io.ktor.server.application.call
2021
import io.ktor.server.auth.AuthenticationConfig
@@ -52,7 +53,7 @@ const val COOKIE_OAUTH_STATE_LIFETIME = 60 * 60 // 1 hour
5253
/**
5354
* A helper method for getting the name of the OAuth2 state cookie name in the current mode
5455
*/
55-
val ApplicationEnvironment.oauthStateCookieName
56+
val Application.oauthStateCookieName
5657
get() =
5758
if (!developmentMode) COOKIE_OAUTH_STATE_PROD else COOKIE_OAUTH_STATE_DEVEL
5859

@@ -90,7 +91,7 @@ fun AuthenticationConfig.github(
9091
// See https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-30#section-10.12
9192
call.response.cookies.append(
9293
Cookie(
93-
name = call.application.environment.oauthStateCookieName,
94+
name = call.application.oauthStateCookieName,
9495
value = state,
9596
maxAge = COOKIE_OAUTH_STATE_LIFETIME,
9697
path = "/",
@@ -118,7 +119,7 @@ fun Route.githubRoutes() {
118119
// Cross-site request forgery (CSRF) protection.
119120
// See https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-30#section-10.12
120121
val oauthCookie =
121-
call.request.cookies[call.application.environment.oauthStateCookieName]
122+
call.request.cookies[call.application.oauthStateCookieName]
122123
if (oauthCookie == null) {
123124
call.respond(HttpStatusCode.Forbidden)
124125
return@get

console/src/test/kotlin/app/accrescent/parcelo/ApplicationTest.kt

Lines changed: 0 additions & 8 deletions
This file was deleted.

gradle/libs.versions.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ github = "1.327"
1313
google-cloud = "26.63.0"
1414
jackson = "2.19.1"
1515
jobrunr = "7.5.3"
16-
koin = "4.0.0"
16+
koin = "4.1.0"
1717
kotlin = "2.2.0"
1818
ksp = "2.2.0-2.0.2"
19-
ktor = "2.3.12"
19+
ktor = "3.2.1"
2020
logback = "1.5.18"
2121
postgresql = "42.7.7"
2222
protobuf = "4.31.1"
@@ -48,7 +48,6 @@ ktor-server-cors = { module = "io.ktor:ktor-server-cors", version.ref = "ktor" }
4848
ktor-server-negotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" }
4949
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
5050
ktor-server-resources = { module = "io.ktor:ktor-server-resources", version.ref = "ktor" }
51-
ktor-server-tests = { module = "io.ktor:ktor-server-tests", version.ref = "ktor" }
5251
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
5352
postgresql = { module = "org.postgresql:postgresql", version.ref = "postgresql" }
5453
protobuf = { module = "com.google.protobuf:protobuf-java", version.ref = "protobuf" }

0 commit comments

Comments
 (0)