harden/security-and-review-fixes #1

Open
jvanvik wants to merge 3 commits from harden/security-and-review-fixes into main
2 changed files with 7 additions and 0 deletions
Showing only changes of commit af303d83c8 - Show all commits

View file

@ -33,3 +33,8 @@
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
# ─── Tink / EncryptedSharedPreferences (androidx.security-crypto) ─────────────
# Tink references compile-only Error Prone annotations that aren't on the runtime
# classpath; they're not needed at runtime, so silence the missing-class errors.
-dontwarn com.google.errorprone.annotations.**

View file

@ -1,6 +1,7 @@
package no.svorka.mcms.core
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withContext
import kotlinx.serialization.json.JsonElement
@ -24,6 +25,7 @@ import kotlin.coroutines.resumeWithException
private fun Response.closeQuietly() { runCatching { close() } }
/** Suspend bridge for an OkHttp call, with coroutine cancellation. */
@OptIn(ExperimentalCoroutinesApi::class) // resume(value) { onCancellation } overload
suspend fun Call.await(): Response = suspendCancellableCoroutine { cont ->
enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {