[RU]Remanga notify breaking authorization (#14026)

This commit is contained in:
Eshlender 2022-10-29 19:23:57 +05:00 committed by GitHub
parent 2f26acede0
commit e8efb0f8d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Remanga' extName = 'Remanga'
pkgNameSuffix = 'ru.remanga' pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga' extClass = '.Remanga'
extVersionCode = 58 extVersionCode = 59
} }
dependencies { dependencies {

View File

@ -47,6 +47,7 @@ import rx.Observable
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.IOException
import java.net.URLDecoder import java.net.URLDecoder
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
@ -58,6 +59,8 @@ class Remanga : ConfigurableSource, HttpSource() {
override val name = "Remanga" override val name = "Remanga"
override val id: Long = 8983242087533137528
override val lang = "ru" override val lang = "ru"
private val preferences: SharedPreferences by lazy { private val preferences: SharedPreferences by lazy {
@ -89,6 +92,9 @@ class Remanga : ConfigurableSource, HttpSource() {
?.let { jsonString -> json.decodeFromString<UserDto>(jsonString) } ?.let { jsonString -> json.decodeFromString<UserDto>(jsonString) }
?: return chain.proceed(request) ?: return chain.proceed(request)
if (authCookie.access_token == null)
throw IOException("Авторизация слетела. Очистите cookies и переавторизуйтесь.")
USER_ID = authCookie.id.toString() USER_ID = authCookie.id.toString()
val authRequest = request.newBuilder() val authRequest = request.newBuilder()
.addHeader("Authorization", "bearer ${authCookie.access_token}") .addHeader("Authorization", "bearer ${authCookie.access_token}")