diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/AsiaFlixProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/AsiaFlixProvider.kt index 20b37724..592fb003 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/AsiaFlixProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/AsiaFlixProvider.kt @@ -157,7 +157,7 @@ class AsiaFlixProvider : MainAPI() { name, name, it, - "https://asianload.me/", + "https://asianload1.com/", /** <------ This provider should be added instead */ getQualityFromName(it), it.endsWith(".m3u8") ) diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt new file mode 100644 index 00000000..9c5c0079 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt @@ -0,0 +1,76 @@ +package com.lagradost.cloudstream3.utils + + +import khttp.structures.authorization.Authorization +import khttp.structures.cookie.CookieJar +import khttp.structures.files.FileLike +import khttp.structures.cookie.Cookie +import khttp.responses.Response + + +/** + * An HTTP session manager. + * + * This class simply keeps cookies across requests. + * + * @property sessionCookies A cookie jar. + */ +class HttpSession { + companion object { + const val DEFAULT_TIMEOUT = 30.0 + + fun mergeCookies(cookie1: CookieJar, cookie2: Map?): Map { + val a = cookie1 + if (!cookie2.isNullOrEmpty()) { + a.putAll(cookie2) + } + return a + } + } + + public val sessionCookies = CookieJar() + + fun get( + url: String, headers: Map = mapOf(), + params: Map = mapOf(), + data: Any? = null, json: Any? = null, + auth: Authorization? = null, + cookies: Map? = null, + timeout: Double = DEFAULT_TIMEOUT, + allowRedirects: Boolean? = null, + stream: Boolean = false, files: List = listOf(), + ): Response { + val res = khttp.get( + url, headers, params, + data, json, auth, + mergeCookies(sessionCookies, cookies), timeout, + allowRedirects, + stream, files + ) + sessionCookies.putAll(res.cookies) + sessionCookies.putAll(CookieJar(*res.headers.filter { it.key.toLowerCase() == "set-cookie" }.map { Cookie(it.value) }.toTypedArray())) + return res + } + + fun post( + url: String, headers: Map = mapOf(), + params: Map = mapOf(), + data: Any? = null, json: Any? = null, + auth: Authorization? = null, + cookies: Map? = null, + timeout: Double = DEFAULT_TIMEOUT, + allowRedirects: Boolean? = null, + stream: Boolean = false, files: List = listOf() + ): Response { + val res = khttp.post( + url, headers, params, + data, json, auth, + mergeCookies(sessionCookies, cookies), timeout, + allowRedirects, + stream, files + ) + sessionCookies.putAll(res.cookies) + sessionCookies.putAll(CookieJar(*res.headers.filter { it.key.toLowerCase() == "set-cookie" }.map { Cookie(it.value) }.toTypedArray())) + return res + } +} diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 44727b7c..20daa2ca 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -115,8 +115,8 @@ Afspeler ondertiteling instellingen Eigengrau modus Voegt de snelheid optie toe in de speler - Veeg om te zoeken - Veeg naar links of rechts om de tijd in de videoplayer te regelen + Veeg om te zoeken + Veeg naar links of rechts om de tijd in de videoplayer te regelen wissen om instellingen te wijzigen Veeg aan de linker- of rechterkant om de helderheid of het volume te wijzigen Dubbeltik om te zoeken