Skip to content

Commit

Permalink
Add Proxy(not sure if it actually works, please give feedback :Prayge:)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuftVerbot committed May 30, 2024
1 parent 3fd3f1a commit 2d79e09
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.ResponseBody.Companion.toResponseBody
import org.json.JSONObject
import java.math.BigInteger
import java.net.InetSocketAddress
import java.net.Proxy
import java.security.MessageDigest
import java.util.zip.GZIPInputStream

Expand Down Expand Up @@ -58,6 +60,7 @@ class DeezerApi {
get() = DeezerCredentials.pass

private val client: OkHttpClient = OkHttpClient.Builder()
.proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved("uk.proxy.murglar.app", 3128)))
.addInterceptor { chain ->
val originalResponse = chain.proceed(chain.request())
if (originalResponse.header("Content-Encoding") == "gzip") {
Expand Down Expand Up @@ -128,7 +131,7 @@ class DeezerApi {
requestBuilder.get()
}
requestBuilder.headers(getHeaders(method))
val request = requestBuilder.build()
val request = requestBuilder.build()

// Execute request
val response = client.newCall(request).execute()
Expand Down

0 comments on commit 2d79e09

Please sign in to comment.