diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f44415d819..4407a8ccfb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -55,8 +55,35 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt
index 873769172e..84ecb3ffa5 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt
@@ -65,6 +65,15 @@ interface ChapterQueries : DbProvider {
.build())
.prepare()
+ fun getChapters(url: String) = db.get()
+ .listOfObjects(Chapter::class.java)
+ .withQuery(Query.builder()
+ .table(ChapterTable.TABLE)
+ .where("${ChapterTable.COL_URL} = ?")
+ .whereArgs(url)
+ .build())
+ .prepare()
+
fun getChapter(url: String, mangaId: Long) = db.get()
.`object`(Chapter::class.java)
.withQuery(Query.builder()
diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt
index 83c719428b..8ba52becb6 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt
@@ -5,7 +5,12 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
+import eu.kanade.tachiyomi.source.online.DelegatedHttpSource
import eu.kanade.tachiyomi.source.online.HttpSource
+import eu.kanade.tachiyomi.source.online.all.MangaDex
+import eu.kanade.tachiyomi.source.online.english.FoolSlide
+import eu.kanade.tachiyomi.source.online.english.KireiCake
+import eu.kanade.tachiyomi.source.online.english.MangaPlus
import rx.Observable
open class SourceManager(private val context: Context) {
@@ -14,6 +19,18 @@ open class SourceManager(private val context: Context) {
private val stubSourcesMap = mutableMapOf()
+ private val delegatedSources = listOf(
+ DelegatedSource(
+ "reader.kireicake.com", 5509224355268673176, KireiCake()
+ ), DelegatedSource(
+ "jaiminisbox.com", 9064882169246918586, FoolSlide("jaiminis", "/reader")
+ ), DelegatedSource(
+ "mangadex.org", 2499283573021220255, MangaDex()
+ ), DelegatedSource(
+ "mangaplus.shueisha.co.jp", 1998944621602463790, MangaPlus()
+ )
+ ).associateBy { it.sourceId }
+
init {
createInternalSources().forEach { registerSource(it) }
}
@@ -28,12 +45,17 @@ open class SourceManager(private val context: Context) {
}
}
+ fun getDelegatedSource(urlName: String): DelegatedHttpSource? {
+ return delegatedSources.values.find { it.urlName == urlName }?.delegatedHttpSource
+ }
+
fun getOnlineSources() = sourcesMap.values.filterIsInstance()
fun getCatalogueSources() = sourcesMap.values.filterIsInstance()
internal fun registerSource(source: Source, overwrite: Boolean = false) {
if (overwrite || !sourcesMap.containsKey(source.id)) {
+ delegatedSources[source.id]?.delegatedHttpSource?.delegate = source as? HttpSource
sourcesMap[source.id] = source
}
}
@@ -43,7 +65,7 @@ open class SourceManager(private val context: Context) {
}
private fun createInternalSources(): List