parent
71953e59c0
commit
33d1ccd2a7
19
src/all/ehentai/AndroidManifest.xml
Normal file
19
src/all/ehentai/AndroidManifest.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".EHUrlActivity"
|
||||||
|
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="e-hentai.org"
|
||||||
|
android:pathPattern="/g/..*/..*" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
@ -5,7 +5,7 @@ ext {
|
|||||||
appName = 'Tachiyomi: E-Hentai'
|
appName = 'Tachiyomi: E-Hentai'
|
||||||
pkgNameSuffix = 'all.ehentai'
|
pkgNameSuffix = 'all.ehentai'
|
||||||
extClass = '.EHFactory'
|
extClass = '.EHFactory'
|
||||||
extVersionCode = 9
|
extVersionCode = 10
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package eu.kanade.tachiyomi.extension.all.ehentai
|
||||||
|
|
||||||
|
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://e-hentai.net/g/xxxxx/yyyyy/ intents and redirects them to
|
||||||
|
* the main Tachiyomi process.
|
||||||
|
*/
|
||||||
|
class EHUrlActivity : Activity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val pathSegments = intent?.data?.pathSegments
|
||||||
|
if (pathSegments != null && pathSegments.size > 2) {
|
||||||
|
val id = pathSegments[1]
|
||||||
|
val key = pathSegments[2]
|
||||||
|
val mainIntent = Intent().apply {
|
||||||
|
action = "eu.kanade.tachiyomi.SEARCH"
|
||||||
|
putExtra("query", "${EHentai.PREFIX_ID_SEARCH}$id/$key")
|
||||||
|
putExtra("filter", packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
startActivity(mainIntent)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
Log.e("EHUrlActivity", e.toString())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("EHUrlActivity", "could not parse uri from intent $intent")
|
||||||
|
}
|
||||||
|
|
||||||
|
finish()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
}
|
@ -209,6 +209,25 @@ open class EHentai(override val lang: String, private val ehLang: String) : Http
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun searchMangaByIdRequest(id: String) = GET("$baseUrl/g/$id", headers)
|
||||||
|
|
||||||
|
private fun searchMangaByIdParse(response: Response, id: String): MangasPage {
|
||||||
|
val details = mangaDetailsParse(response)
|
||||||
|
details.url = "/g/$id/"
|
||||||
|
return MangasPage(listOf(details), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
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(searchMangaByIdRequest(id))
|
||||||
|
.asObservableSuccess()
|
||||||
|
.map { response -> searchMangaByIdParse(response, id) }
|
||||||
|
} else {
|
||||||
|
super.fetchSearchManga(page, query, filters)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun chapterListParse(response: Response) = throw UnsupportedOperationException("Unused method was called somehow!")
|
override fun chapterListParse(response: Response) = throw UnsupportedOperationException("Unused method was called somehow!")
|
||||||
|
|
||||||
override fun pageListParse(response: Response) = throw UnsupportedOperationException("Unused method was called somehow!")
|
override fun pageListParse(response: Response) = throw UnsupportedOperationException("Unused method was called somehow!")
|
||||||
@ -366,6 +385,7 @@ open class EHentai(override val lang: String, private val ehLang: String) : Http
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val QUERY_PREFIX = "?f_apply=Apply+Filter"
|
const val QUERY_PREFIX = "?f_apply=Apply+Filter"
|
||||||
|
const val PREFIX_ID_SEARCH = "id:"
|
||||||
const val TR_SUFFIX = "TR"
|
const val TR_SUFFIX = "TR"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user