Manhastro: Fix auth cookie duplicated (#9798)
* Fix auth cookie duplicated * Remove looper
This commit is contained in:
parent
e5ab6fbb21
commit
dad8bbf372
@ -3,7 +3,7 @@ ext {
|
|||||||
extClass = '.Manhastro'
|
extClass = '.Manhastro'
|
||||||
themePkg = 'madara'
|
themePkg = 'madara'
|
||||||
baseUrl = 'https://manhastro.net'
|
baseUrl = 'https://manhastro.net'
|
||||||
overrideVersionCode = 8
|
overrideVersionCode = 9
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import android.os.Handler
|
|||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.webkit.CookieManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.preference.EditTextPreference
|
import androidx.preference.EditTextPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
@ -52,9 +53,14 @@ class Manhastro :
|
|||||||
|
|
||||||
private val application: Application by lazy { Injekt.get<Application>() }
|
private val application: Application by lazy { Injekt.get<Application>() }
|
||||||
|
|
||||||
|
private val cookieManager by lazy { CookieManager.getInstance() }
|
||||||
|
|
||||||
private var showWarning: Boolean = true
|
private var showWarning: Boolean = true
|
||||||
|
|
||||||
private val authCookie: Cookie by lazy {
|
private val authCookie: Cookie by lazy {
|
||||||
|
cookieManager.removeAllCookies(null)
|
||||||
|
cookieManager.flush()
|
||||||
|
|
||||||
val cookieJson = preferences.getString(COOKIE_STORAGE_PREF, "") as String
|
val cookieJson = preferences.getString(COOKIE_STORAGE_PREF, "") as String
|
||||||
if (cookieJson.isBlank()) {
|
if (cookieJson.isBlank()) {
|
||||||
return@lazy doAuth().also(::upsetCookie)
|
return@lazy doAuth().also(::upsetCookie)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user