* Luscious: fix 403 error + Open URL in app (closes #10924) * Luscious: Preserve app provided useragent
This commit is contained in:
parent
156f67ad7e
commit
b6f6b46a4f
27
src/all/luscious/AndroidManifest.xml
Normal file
27
src/all/luscious/AndroidManifest.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".all.luscious.LusciousUrlActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.NoDisplay">
|
||||
<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:host="www.luscious.net"
|
||||
android:pathPattern="/albums/..*"
|
||||
android:scheme="https" />
|
||||
<data
|
||||
android:host="members.luscious.net"
|
||||
android:pathPattern="/albums/..*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'Luscious'
|
||||
extClass = '.LusciousFactory'
|
||||
extVersionCode = 22
|
||||
extVersionCode = 23
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import kotlinx.serialization.json.long
|
||||
import kotlinx.serialization.json.put
|
||||
import kotlinx.serialization.json.putJsonArray
|
||||
import kotlinx.serialization.json.putJsonObject
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
@ -55,6 +56,11 @@ abstract class Luscious(
|
||||
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
override fun headersBuilder(): Headers.Builder {
|
||||
return super.headersBuilder()
|
||||
.add("Referer", "$baseUrl/")
|
||||
}
|
||||
|
||||
override val client: OkHttpClient
|
||||
get() = network.cloudflareClient.newBuilder()
|
||||
.addNetworkInterceptor(rewriteOctetStream)
|
||||
@ -487,6 +493,12 @@ abstract class Luscious(
|
||||
client.newCall(buildAlbumInfoRequest(id))
|
||||
.asObservableSuccess()
|
||||
.map { MangasPage(listOf(detailsParse(it)), false) }
|
||||
} else if (query.startsWith("ALBUM:")) {
|
||||
val album = query.substringAfterLast("ALBUM:")
|
||||
val id = album.split("_").last()
|
||||
client.newCall(buildAlbumInfoRequest(id))
|
||||
.asObservableSuccess()
|
||||
.map { MangasPage(listOf(detailsParse(it)), false) }
|
||||
} else {
|
||||
super.fetchSearchManga(page, query, filters)
|
||||
}
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package eu.kanade.tachiyomi.extension.all.luscious
|
||||
|
||||
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://www.luscious.net/albums/xxxxxx intents and redirects them to
|
||||
* the main Tachiyomi process.
|
||||
*/
|
||||
class LusciousUrlActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val pathSegments = intent?.data?.pathSegments
|
||||
if (pathSegments != null && pathSegments.size > 1) {
|
||||
val album = pathSegments[1]
|
||||
val mainIntent = Intent().apply {
|
||||
action = "eu.kanade.tachiyomi.SEARCH"
|
||||
putExtra("query", "ALBUM:$album")
|
||||
putExtra("filter", packageName)
|
||||
}
|
||||
|
||||
try {
|
||||
startActivity(mainIntent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Log.e("LusciousUrlActivity", e.toString())
|
||||
}
|
||||
} else {
|
||||
Log.e("LusciousUrlActivity", "could not parse uri from intent $intent")
|
||||
}
|
||||
|
||||
finish()
|
||||
exitProcess(0)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user