Cleanup some old Mangadex login things
This commit is contained in:
parent
2ad14c943b
commit
a960b624ce
@ -190,7 +190,7 @@ class MangaDex(delegate: HttpSource, val context: Context) :
|
|||||||
|
|
||||||
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getPageList"))
|
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getPageList"))
|
||||||
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||||
return runAsObservable { pageHandler.fetchPageList(chapter, isLogged(), usePort443Only(), dataSaver(), delegate) }
|
return runAsObservable { pageHandler.fetchPageList(chapter, usePort443Only(), dataSaver(), delegate) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchImage(page: Page): Observable<Response> {
|
override fun fetchImage(page: Page): Observable<Response> {
|
||||||
|
@ -31,7 +31,7 @@ class PageHandler(
|
|||||||
private val mdList: MdList,
|
private val mdList: MdList,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
suspend fun fetchPageList(chapter: SChapter, isLogged: Boolean, usePort443Only: Boolean, dataSaver: Boolean, mangadex: Source): List<Page> {
|
suspend fun fetchPageList(chapter: SChapter, usePort443Only: Boolean, dataSaver: Boolean, mangadex: Source): List<Page> {
|
||||||
return withIOContext {
|
return withIOContext {
|
||||||
val chapterResponse = service.viewChapter(MdUtil.getChapterId(chapter.url))
|
val chapterResponse = service.viewChapter(MdUtil.getChapterId(chapter.url))
|
||||||
|
|
||||||
@ -56,12 +56,6 @@ class PageHandler(
|
|||||||
else -> throw Exception("${chapter.scanlator} not supported")
|
else -> throw Exception("${chapter.scanlator} not supported")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val headers = if (isLogged) {
|
|
||||||
MdUtil.getAuthHeaders(headers, preferences, mdList)
|
|
||||||
} else {
|
|
||||||
headers
|
|
||||||
}
|
|
||||||
|
|
||||||
val atHomeRequestUrl = if (usePort443Only) {
|
val atHomeRequestUrl = if (usePort443Only) {
|
||||||
"${MdApi.atHomeServer}/${MdUtil.getChapterId(chapter.url)}?forcePort443=true"
|
"${MdApi.atHomeServer}/${MdUtil.getChapterId(chapter.url)}?forcePort443=true"
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package exh.md.network
|
|
||||||
|
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
class NoSessionException : IOException("Session token does not exist")
|
|
@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.source.online.all.MangaDex
|
|||||||
import eu.kanade.tachiyomi.util.PkceUtil
|
import eu.kanade.tachiyomi.util.PkceUtil
|
||||||
import exh.md.dto.MangaAttributesDto
|
import exh.md.dto.MangaAttributesDto
|
||||||
import exh.md.dto.MangaDataDto
|
import exh.md.dto.MangaDataDto
|
||||||
import exh.md.network.NoSessionException
|
|
||||||
import exh.source.getMainSource
|
import exh.source.getMainSource
|
||||||
import exh.util.dropBlank
|
import exh.util.dropBlank
|
||||||
import exh.util.floor
|
import exh.util.floor
|
||||||
@ -207,16 +206,6 @@ class MdUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sessionToken(preferences: TrackPreferences, mdList: MdList) = loadOAuth(preferences, mdList)?.access_token
|
|
||||||
|
|
||||||
fun refreshToken(preferences: TrackPreferences, mdList: MdList) = loadOAuth(preferences, mdList)?.refresh_token
|
|
||||||
|
|
||||||
fun getAuthHeaders(headers: Headers, preferences: TrackPreferences, mdList: MdList) =
|
|
||||||
headers.newBuilder().add(
|
|
||||||
"Authorization",
|
|
||||||
"Bearer " + (sessionToken(preferences, mdList) ?: throw NoSessionException()),
|
|
||||||
).build()
|
|
||||||
|
|
||||||
private var codeVerifier: String? = null
|
private var codeVerifier: String? = null
|
||||||
|
|
||||||
fun refreshTokenRequest(oauth: OAuth): Request {
|
fun refreshTokenRequest(oauth: OAuth): Request {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user