Ktor Parsing Error Fix and Bump to v3.6.1

This commit is contained in:
Shabinder 2022-01-27 15:39:33 +05:30
parent 1b929b7449
commit c15b70b996
7 changed files with 36 additions and 36 deletions

View File

@ -32,7 +32,7 @@ jobs:
with:
draft: true
allowUpdates: true
tag: "v3.6.0"
tag: "v3.6.1"
artifacts: "desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*"
token: ${{ secrets.GH_TOKEN }}
@ -81,7 +81,7 @@ jobs:
with:
draft: true
allowUpdates: true
tag: "v3.6.0"
tag: "v3.6.1"
artifacts: "desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*,android/build/outputs/apk/release/*signed.apk"
token: ${{ secrets.GH_TOKEN }}
@ -114,6 +114,6 @@ jobs:
with:
draft: true
allowUpdates: true
tag: "v3.6.0"
tag: "v3.6.1"
artifacts: "desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*"
token: ${{ secrets.GH_TOKEN }}

View File

@ -26,9 +26,9 @@ import org.gradle.kotlin.dsl.getByType
object Versions {
// App's Version (To be bumped at each update)
const val versionName = "3.6.0"
const val versionName = "3.6.1"
const val versionCode = 28
const val versionCode = 29
// Android
const val minSdkVersion = 21

View File

@ -25,6 +25,7 @@ androidxLifecycle = "2.4.0-alpha03"
[libraries]
kotlin-kotlinGradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-serialization = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "kotlin" }
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" }
kotlin-kotlinTestCommon = { group = "org.jetbrains.kotlin", name = "kotlin-test-common", version.ref = "kotlin" }
kotlin-kotlinTestJs = { group = "org.jetbrains.kotlin", name = "kotlin-test-js", version.ref = "kotlin" }
kotlin-kotlinTestJunit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" }

View File

@ -43,8 +43,7 @@ suspend inline fun HttpClient.getFinalUrl(
}
}
fun createHttpClient(enableNetworkLogs: Boolean = false) = HttpClient {
buildHttpClient {
fun createHttpClient(enableNetworkLogs: Boolean = false) = buildHttpClient {
// https://github.com/Kotlin/kotlinx.serialization/issues/1450
install(JsonFeature) {
serializer = KotlinxSerializer(globalJson)
@ -70,11 +69,10 @@ fun createHttpClient(enableNetworkLogs: Boolean = false) = HttpClient {
level = LogLevel.INFO
}
}
}
}
expect fun buildHttpClient(extraConfig: HttpClientConfig<*>.() -> Unit): HttpClient
/*Client Active Throughout App's Lifetime*/
@SharedImmutable
val ktorHttpClient = HttpClient {}
private val ktorHttpClient = HttpClient {}

View File

@ -152,17 +152,15 @@ interface SoundCloudRequests {
suspend inline fun <reified T : Any> SoundCloudRequests.doAuthenticatedRequest(url: String): T {
var clientID: String = SoundCloudRequests.CLIENT_ID
return try {
val data: String = httpClient.get(url) {
httpClient.get(url) {
parameter("client_id", clientID)
}
globalJson.decodeFromString(data)
} catch (e: ClientRequestException) {
if (clientID != SoundCloudRequests.ALT_CLIENT_ID) {
clientID = SoundCloudRequests.ALT_CLIENT_ID
val data: String = httpClient.get(url) {
return httpClient.get(url) {
parameter("client_id", clientID)
}
return globalJson.decodeFromString(data)
}
throw e
}

View File

@ -34,9 +34,11 @@ import com.shabinder.common.providers.youtube_to_mp3.requests.YoutubeMp3
import com.shabinder.common.utils.appendPadded
import io.github.shabinder.fuzzywuzzy.diffutils.FuzzySearch
import io.ktor.client.HttpClient
import io.ktor.client.request.header
import io.ktor.client.request.headers
import io.ktor.client.request.post
import io.ktor.http.ContentType
import io.ktor.http.HttpHeaders
import io.ktor.http.contentType
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray
@ -357,8 +359,8 @@ class YoutubeMusic constructor(
private suspend fun getYoutubeMusicResponse(query: String): SuspendableEvent<String, Throwable> =
SuspendableEvent {
httpClient.post("${corsApi}https://music.youtube.com/youtubei/v1/search?alt=json&key=$apiKey") {
contentType(ContentType.Application.Json)
headers {
append(HttpHeaders.ContentType, ContentType.Application.Json.toString())
append("referer", "https://music.youtube.com/search")
}
body = buildJsonObject {

View File

@ -0,0 +1 @@
- Fixed Response Parsing Error which leaded download failure.