parent
36f5609434
commit
019f12b61d
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".HitomiActivity"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay"
|
||||||
|
android:excludeFromRecents="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https"
|
||||||
|
android:host="hitomi.la"
|
||||||
|
android:pathPattern="/cg/..*"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Hitomi.la'
|
extName = 'Hitomi.la'
|
||||||
pkgNameSuffix = 'all.hitomi'
|
pkgNameSuffix = 'all.hitomi'
|
||||||
extClass = '.HitomiFactory'
|
extClass = '.HitomiFactory'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,11 @@ open class Hitomi(override val lang: String, private val nozomiLang: String) : H
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
|
return if (query.startsWith(PREFIX_ID_SEARCH)) {
|
||||||
|
val id = query.removePrefix(PREFIX_ID_SEARCH)
|
||||||
|
client.newCall(GET("$baseUrl/cg/$id", headers)).asObservableSuccess()
|
||||||
|
.map { MangasPage(listOf(mangaDetailsParse(it).apply { url = "/cg/$id" }), false) }
|
||||||
|
} else {
|
||||||
val splitQuery = query.split(" ")
|
val splitQuery = query.split(" ")
|
||||||
|
|
||||||
val positive = splitQuery.filter { !it.startsWith('-') }.toMutableList()
|
val positive = splitQuery.filter { !it.startsWith('-') }.toMutableList()
|
||||||
|
@ -190,7 +195,7 @@ open class Hitomi(override val lang: String, private val nozomiLang: String) : H
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.flatMap { (_, ids) ->
|
base.flatMap { (_, ids) ->
|
||||||
val chunks = ids.chunked(PAGE_SIZE)
|
val chunks = ids.chunked(PAGE_SIZE)
|
||||||
|
|
||||||
nozomiIdsToMangas(chunks[page - 1]).map { mangas ->
|
nozomiIdsToMangas(chunks[page - 1]).map { mangas ->
|
||||||
|
@ -198,6 +203,7 @@ open class Hitomi(override val lang: String, private val nozomiLang: String) : H
|
||||||
}
|
}
|
||||||
}.toObservable()
|
}.toObservable()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = throw UnsupportedOperationException("Not used")
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = throw UnsupportedOperationException("Not used")
|
||||||
override fun searchMangaParse(response: Response) = throw UnsupportedOperationException("Not used")
|
override fun searchMangaParse(response: Response) = throw UnsupportedOperationException("Not used")
|
||||||
|
@ -307,6 +313,8 @@ open class Hitomi(override val lang: String, private val nozomiLang: String) : H
|
||||||
private const val INDEX_VERSION_CACHE_TIME_MS = 1000 * 60 * 10
|
private const val INDEX_VERSION_CACHE_TIME_MS = 1000 * 60 * 10
|
||||||
private const val PAGE_SIZE = 25
|
private const val PAGE_SIZE = 25
|
||||||
|
|
||||||
|
const val PREFIX_ID_SEARCH = "id:"
|
||||||
|
|
||||||
// From HitomiSearchMetaData
|
// From HitomiSearchMetaData
|
||||||
const val LTN_BASE_URL = "https://ltn.hitomi.la"
|
const val LTN_BASE_URL = "https://ltn.hitomi.la"
|
||||||
const val BASE_URL = "https://hitomi.la"
|
const val BASE_URL = "https://hitomi.la"
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.all.hitomi
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.ActivityNotFoundException
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Springboard that accepts https://hitomi.la/cg/xxxx intents
|
||||||
|
* and redirects them to the main Tachiyomi process.
|
||||||
|
*/
|
||||||
|
class HitomiActivity : Activity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val pathSegments = intent?.data?.pathSegments
|
||||||
|
if (pathSegments != null && pathSegments.size > 1) {
|
||||||
|
val id = pathSegments[1]
|
||||||
|
val mainIntent = Intent().apply {
|
||||||
|
action = "eu.kanade.tachiyomi.SEARCH"
|
||||||
|
putExtra("query", "${Hitomi.PREFIX_ID_SEARCH}$id")
|
||||||
|
putExtra("filter", packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
startActivity(mainIntent)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
Log.e("HitomiActivity", e.toString())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("HitomiActivity", "Could not parse URI from intent $intent")
|
||||||
|
}
|
||||||
|
|
||||||
|
finish()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue