From fffca19a61e295b51d170feeda06d724befb05e0 Mon Sep 17 00:00:00 2001
From: Arjix <53124886+ArjixWasTaken@users.noreply.github.com>
Date: Thu, 2 Sep 2021 14:33:56 +0300
Subject: [PATCH 1/7] Update strings.xml
---
app/src/main/res/values-nl/strings.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index 8c772bf0..bd33e3ad 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
From 1ac8fb2700b12e2a160fe3707b2230bffdc85762 Mon Sep 17 00:00:00 2001
From: Arjix <53124886+ArjixWasTaken@users.noreply.github.com>
Date: Thu, 2 Sep 2021 15:17:30 +0300
Subject: [PATCH 2/7] Create HttpSession.kt
---
.../cloudstream3/utils/HttpSession.kt | 87 +++++++++++++++++++
1 file changed, 87 insertions(+)
create mode 100644 app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
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..07653d0c
--- /dev/null
+++ b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
@@ -0,0 +1,87 @@
+package com.lagradost.cloudstream3.utils
+
+
+import khttp.structures.authorization.Authorization
+import khttp.structures.cookie.CookieJar
+import khttp.structures.files.FileLike
+import khttp.responses.Response
+
+
+/**
+ * An HTTP session manager.
+ *
+ * This class simply keeps cookies across requests.
+ *
+ * @property sessionCookies A cookie jar.
+ */
+class Session {
+ companion object {
+ const val DEFAULT_TIMEOUT = 30.0
+
+ fun cookieStrToMap(cookie: String): Map {
+ val cookies = mutableMapOf()
+ for (string in cookie.split("; ")) {
+ val split = string.split("=").toMutableList()
+ val name = split.removeFirst().trim()
+ val value = if (split.size == 0) {
+ "true"
+ } else {
+ split.joinToString("=")
+ }
+ cookies[name] = value
+ }
+ return cookies.toMap()
+ }
+ }
+
+ public val sessionCookies = CookieJar()
+
+ public 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,
+ cookies, timeout,
+ allowRedirects,
+ stream, files
+ )
+ sessionCookies.putAll(res.cookies.toMap())
+ if (res.headers.containsKey("set-content")) {
+ sessionCookies.putAll(cookieStrToMap(res.headers["set-content"].toString().replace("path=/,", "")))
+ }
+ return res
+ }
+
+ public 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,
+ cookies, timeout,
+ allowRedirects,
+ stream, files
+ )
+ sessionCookies.putAll(res.cookies.toMap())
+ if (res.headers.containsKey("set-content")) {
+ sessionCookies.putAll(cookieStrToMap(res.headers["set-content"].toString().replace("path=/,", "")))
+ }
+ return res
+ }
+
+}
From cc0fdd8a7a3e90a088a388d90b169157ef7cd46e Mon Sep 17 00:00:00 2001
From: Arjix <53124886+ArjixWasTaken@users.noreply.github.com>
Date: Thu, 2 Sep 2021 15:32:45 +0300
Subject: [PATCH 3/7] Update HttpSession.kt
---
.../cloudstream3/utils/HttpSession.kt | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
index 07653d0c..a7e9a476 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
@@ -14,7 +14,7 @@ import khttp.responses.Response
*
* @property sessionCookies A cookie jar.
*/
-class Session {
+class HttpSession {
companion object {
const val DEFAULT_TIMEOUT = 30.0
@@ -32,11 +32,19 @@ class Session {
}
return cookies.toMap()
}
+
+ fun mergeCookies(cookie1: Map, cookie2: Map?): Map {
+ val a = cookie1.toMutableMap()
+ if (!cookie2.isNullOrEmpty()) {
+ a.putAll(cookie2.toMap())
+ }
+ return a.toMap()
+ }
}
public val sessionCookies = CookieJar()
- public fun get(
+ fun get(
url: String, headers: Map = mapOf(),
params: Map = mapOf(),
data: Any? = null, json: Any? = null,
@@ -49,7 +57,7 @@ class Session {
val res = khttp.get(
url, headers, params,
data, json, auth,
- cookies, timeout,
+ mergeCookies(sessionCookies, cookies), timeout,
allowRedirects,
stream, files
)
@@ -60,7 +68,7 @@ class Session {
return res
}
- public fun post(
+ fun post(
url: String, headers: Map = mapOf(),
params: Map = mapOf(),
data: Any? = null, json: Any? = null,
@@ -73,7 +81,7 @@ class Session {
val res = khttp.post(
url, headers, params,
data, json, auth,
- cookies, timeout,
+ mergeCookies(sessionCookies, cookies), timeout,
allowRedirects,
stream, files
)
@@ -83,5 +91,4 @@ class Session {
}
return res
}
-
}
From 51d4d296fcf455914fdcd7eb430556f3d362d946 Mon Sep 17 00:00:00 2001
From: Arjix <53124886+ArjixWasTaken@users.noreply.github.com>
Date: Thu, 2 Sep 2021 15:35:16 +0300
Subject: [PATCH 4/7] fixed header key
---
.../java/com/lagradost/cloudstream3/utils/HttpSession.kt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
index a7e9a476..16029d1b 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
@@ -62,8 +62,8 @@ class HttpSession {
stream, files
)
sessionCookies.putAll(res.cookies.toMap())
- if (res.headers.containsKey("set-content")) {
- sessionCookies.putAll(cookieStrToMap(res.headers["set-content"].toString().replace("path=/,", "")))
+ if (res.headers.containsKey("set-cookie")) {
+ sessionCookies.putAll(cookieStrToMap(res.headers["set-cookie"].toString().replace("path=/,", "")))
}
return res
}
@@ -86,8 +86,8 @@ class HttpSession {
stream, files
)
sessionCookies.putAll(res.cookies.toMap())
- if (res.headers.containsKey("set-content")) {
- sessionCookies.putAll(cookieStrToMap(res.headers["set-content"].toString().replace("path=/,", "")))
+ if (res.headers.containsKey("set-cookie")) {
+ sessionCookies.putAll(cookieStrToMap(res.headers["set-cookie"].toString().replace("path=/,", "")))
}
return res
}
From 23c7f912141035bb8e28a24c028266ecf6d66f55 Mon Sep 17 00:00:00 2001
From: Arjix <53124886+ArjixWasTaken@users.noreply.github.com>
Date: Thu, 2 Sep 2021 15:56:47 +0300
Subject: [PATCH 5/7] Update HttpSession.kt
---
.../cloudstream3/utils/HttpSession.kt | 36 +++++--------------
1 file changed, 9 insertions(+), 27 deletions(-)
diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
index 16029d1b..7e22c9b0 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
@@ -4,6 +4,7 @@ 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
@@ -18,21 +19,6 @@ class HttpSession {
companion object {
const val DEFAULT_TIMEOUT = 30.0
- fun cookieStrToMap(cookie: String): Map {
- val cookies = mutableMapOf()
- for (string in cookie.split("; ")) {
- val split = string.split("=").toMutableList()
- val name = split.removeFirst().trim()
- val value = if (split.size == 0) {
- "true"
- } else {
- split.joinToString("=")
- }
- cookies[name] = value
- }
- return cookies.toMap()
- }
-
fun mergeCookies(cookie1: Map, cookie2: Map?): Map {
val a = cookie1.toMutableMap()
if (!cookie2.isNullOrEmpty()) {
@@ -57,14 +43,12 @@ class HttpSession {
val res = khttp.get(
url, headers, params,
data, json, auth,
- mergeCookies(sessionCookies, cookies), timeout,
- allowRedirects,
+ mergeCookies(sessionCookies, cookies),
+ timeout, allowRedirects,
stream, files
)
- sessionCookies.putAll(res.cookies.toMap())
- if (res.headers.containsKey("set-cookie")) {
- sessionCookies.putAll(cookieStrToMap(res.headers["set-cookie"].toString().replace("path=/,", "")))
- }
+ sessionCookies.putAll(res.cookies)
+ sessionCookies.putAll(CookieJar(*res.headers.filter { it.key.toLowerCase() == "set-cookie" }.map { Cookie(it.value) }.toTypedArray()))
return res
}
@@ -81,14 +65,12 @@ class HttpSession {
val res = khttp.post(
url, headers, params,
data, json, auth,
- mergeCookies(sessionCookies, cookies), timeout,
- allowRedirects,
+ mergeCookies(sessionCookies, cookies),
+ timeout, allowRedirects,
stream, files
)
- sessionCookies.putAll(res.cookies.toMap())
- if (res.headers.containsKey("set-cookie")) {
- sessionCookies.putAll(cookieStrToMap(res.headers["set-cookie"].toString().replace("path=/,", "")))
- }
+ sessionCookies.putAll(res.cookies)
+ sessionCookies.putAll(CookieJar(*res.headers.filter { it.key.toLowerCase() == "set-cookie" }.map { Cookie(it.value) }.toTypedArray()))
return res
}
}
From 019f9b4ba70ffb280e8e42e1ce3ecd3c55367fca Mon Sep 17 00:00:00 2001
From: Blatzar
Date: Thu, 2 Sep 2021 15:03:37 +0200
Subject: [PATCH 6/7] fixed AsiaFlixProvider.kt
---
.../lagradost/cloudstream3/movieproviders/AsiaFlixProvider.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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")
)
From c283f9347bcc0cccf7bd22ec2d25e074f6ac137f Mon Sep 17 00:00:00 2001
From: Arjix <53124886+ArjixWasTaken@users.noreply.github.com>
Date: Thu, 2 Sep 2021 16:06:46 +0300
Subject: [PATCH 7/7] Update HttpSession.kt
---
.../lagradost/cloudstream3/utils/HttpSession.kt | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
index 7e22c9b0..9c5c0079 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/utils/HttpSession.kt
@@ -19,12 +19,12 @@ class HttpSession {
companion object {
const val DEFAULT_TIMEOUT = 30.0
- fun mergeCookies(cookie1: Map, cookie2: Map?): Map {
- val a = cookie1.toMutableMap()
+ fun mergeCookies(cookie1: CookieJar, cookie2: Map?): Map {
+ val a = cookie1
if (!cookie2.isNullOrEmpty()) {
- a.putAll(cookie2.toMap())
+ a.putAll(cookie2)
}
- return a.toMap()
+ return a
}
}
@@ -43,8 +43,8 @@ class HttpSession {
val res = khttp.get(
url, headers, params,
data, json, auth,
- mergeCookies(sessionCookies, cookies),
- timeout, allowRedirects,
+ mergeCookies(sessionCookies, cookies), timeout,
+ allowRedirects,
stream, files
)
sessionCookies.putAll(res.cookies)
@@ -65,8 +65,8 @@ class HttpSession {
val res = khttp.post(
url, headers, params,
data, json, auth,
- mergeCookies(sessionCookies, cookies),
- timeout, allowRedirects,
+ mergeCookies(sessionCookies, cookies), timeout,
+ allowRedirects,
stream, files
)
sessionCookies.putAll(res.cookies)