mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-26 02:57:50 +02:00
Allow extensions to open manga or chapter by URL (#9996)
* open manga and chapter using URL * removing unnnecessary logs * Resolving comments * Resolving comments
This commit is contained in:
@ -289,6 +289,13 @@ abstract class HttpSource : CatalogueSource {
|
||||
*/
|
||||
protected abstract fun chapterListParse(response: Response): List<SChapter>
|
||||
|
||||
/**
|
||||
* Parses the response from the site and returns a SChapter Object.
|
||||
*
|
||||
* @param response the response from the site.
|
||||
*/
|
||||
protected abstract fun chapterPageParse(response: Response): SChapter
|
||||
|
||||
/**
|
||||
* Get the list of pages a chapter has. Pages should be returned
|
||||
* in the expected order; the index is ignored.
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.source.online
|
||||
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
|
||||
/**
|
||||
@ -11,11 +12,12 @@ import eu.kanade.tachiyomi.source.model.SManga
|
||||
interface ResolvableSource : Source {
|
||||
|
||||
/**
|
||||
* Whether this source may potentially handle the given URI.
|
||||
* Returns the UriType of the uri input.
|
||||
* Returns Unknown if unable to resolve the URI
|
||||
*
|
||||
* @since extensions-lib 1.5
|
||||
*/
|
||||
fun canResolveUri(uri: String): Boolean
|
||||
fun getUriType(uri: String): UriType
|
||||
|
||||
/**
|
||||
* Called if canHandleUri is true. Returns the corresponding SManga, if possible.
|
||||
@ -23,4 +25,17 @@ interface ResolvableSource : Source {
|
||||
* @since extensions-lib 1.5
|
||||
*/
|
||||
suspend fun getManga(uri: String): SManga?
|
||||
|
||||
/**
|
||||
* Called if canHandleUri is true. Returns the corresponding SChapter, if possible.
|
||||
*
|
||||
* @since extensions-lib 1.5
|
||||
*/
|
||||
suspend fun getChapter(uri: String): SChapter?
|
||||
}
|
||||
|
||||
sealed interface UriType {
|
||||
object Manga : UriType
|
||||
object Chapter : UriType
|
||||
object Unknown : UriType
|
||||
}
|
||||
|
Reference in New Issue
Block a user