Account for custom delegated image requests, fixes Hitomi pages

This commit is contained in:
Jobobby04 2020-08-11 15:20:11 -04:00
parent 69f4d1fd46
commit 51d0a67908
2 changed files with 23 additions and 0 deletions

View File

@ -99,6 +99,12 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
*/ */
override val baseUrl get() = delegate.baseUrl override val baseUrl get() = delegate.baseUrl
/**
* Version id used to generate the source id. If the site completely changes and urls are
* incompatible, you may increase this value and it'll be considered as a new source.
*/
override val versionId get() = delegate.versionId
/** /**
* Whether the source has support for latest updates. * Whether the source has support for latest updates.
*/ */
@ -221,6 +227,16 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
return delegate.fetchImageUrl(page) return delegate.fetchImageUrl(page)
} }
/**
* Returns an observable with the response of the source image.
*
* @param page the page whose source image has to be downloaded.
*/
override fun fetchImage(page: Page): Observable<Response> {
ensureDelegateCompatible()
return delegate.fetchImage(page)
}
/** /**
* Called before inserting a new chapter into database. Use it if you need to override chapter * Called before inserting a new chapter into database. Use it if you need to override chapter
* fields, like the title or the chapter number. Do not change anything to [manga]. * fields, like the title or the chapter number. Do not change anything to [manga].

View File

@ -200,6 +200,13 @@ class EnhancedHttpSource(
*/ */
override fun fetchImageUrl(page: Page) = source().fetchImageUrl(page) override fun fetchImageUrl(page: Page) = source().fetchImageUrl(page)
/**
* Returns an observable with the response of the source image.
*
* @param page the page whose source image has to be downloaded.
*/
override fun fetchImage(page: Page) = source().fetchImage(page)
/** /**
* Called before inserting a new chapter into database. Use it if you need to override chapter * Called before inserting a new chapter into database. Use it if you need to override chapter
* fields, like the title or the chapter number. Do not change anything to [manga]. * fields, like the title or the chapter number. Do not change anything to [manga].