Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b821dd7cb | ||
|
|
213902c854 | ||
|
|
2054922586 | ||
|
|
a17b7355f5 | ||
|
|
066a1e1f3a | ||
|
|
b10cbfbd63 | ||
|
|
fcd72bb8bd |
17
.idea/deploymentTargetDropDown.xml
generated
17
.idea/deploymentTargetDropDown.xml
generated
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="deploymentTargetDropDown">
|
|
||||||
<runningDeviceTargetSelectedWithDropDown>
|
|
||||||
<Target>
|
|
||||||
<type value="RUNNING_DEVICE_TARGET" />
|
|
||||||
<deviceKey>
|
|
||||||
<Key>
|
|
||||||
<type value="VIRTUAL_DEVICE_PATH" />
|
|
||||||
<value value="$USER_HOME$/.android/avd/Pixel_2_API_30.avd" />
|
|
||||||
</Key>
|
|
||||||
</deviceKey>
|
|
||||||
</Target>
|
|
||||||
</runningDeviceTargetSelectedWithDropDown>
|
|
||||||
<timeTargetWasSelectedWithDropDown value="2022-01-01T07:38:11.679673Z" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
*Pupil, Hitomi.la viewer for Android*
|
*Pupil, Hitomi.la viewer for Android*
|
||||||
|
|
||||||

|

|
||||||
[](https://github.com/tom5079/Pupil/releases/download/5.1.30/Pupil-v5.1.30.apk)
|
[](https://github.com/tom5079/Pupil/releases/download/5.1.34/Pupil-v5.1.34.apk)
|
||||||
[](https://discord.gg/Stj4b5v)
|
[](https://discord.gg/Stj4b5v)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 69
|
versionCode 69
|
||||||
versionName "5.1.30"
|
versionName "5.1.32"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,6 @@ dependencies {
|
|||||||
implementation "ru.noties.markwon:core:3.1.0"
|
implementation "ru.noties.markwon:core:3.1.0"
|
||||||
|
|
||||||
implementation "org.jsoup:jsoup:1.14.3"
|
implementation "org.jsoup:jsoup:1.14.3"
|
||||||
implementation "app.cash.zipline:zipline:1.0.0-SNAPSHOT"
|
|
||||||
|
|
||||||
implementation "com.google.guava:guava:31.0.1-android"
|
implementation "com.google.guava:guava:31.0.1-android"
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"versionCode": 69,
|
"versionCode": 69,
|
||||||
"versionName": "5.1.30",
|
"versionName": "5.1.32",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -20,8 +20,14 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil
|
package xyz.quaver.pupil
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import android.webkit.WebView
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import kotlinx.coroutines.MainScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@@ -37,5 +43,17 @@ class ExampleInstrumentedTest {
|
|||||||
fun useAppContext() {
|
fun useAppContext() {
|
||||||
// Context of the app under test.
|
// Context of the app under test.
|
||||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
|
MainScope().launch {
|
||||||
|
val webView = WebView(appContext).apply {
|
||||||
|
settings.javaScriptEnabled = true
|
||||||
|
}
|
||||||
|
webView.evaluateJavascript("3") {
|
||||||
|
Log.d("PUPILD", it)
|
||||||
|
}
|
||||||
|
Log.d("PUPILD", "SYNC?")
|
||||||
|
}.join()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil
|
package xyz.quaver.pupil
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.app.Notification
|
import android.app.Notification
|
||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
@@ -26,6 +27,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.webkit.WebView
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
@@ -69,9 +71,26 @@ val client: OkHttpClient
|
|||||||
clientHolder = it
|
clientHolder = it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
lateinit var webView: WebView
|
||||||
|
|
||||||
class Pupil : Application() {
|
class Pupil : Application() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
lateinit var instance: Pupil
|
||||||
|
private set
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
|
instance = this
|
||||||
|
|
||||||
|
webView = WebView(this).apply {
|
||||||
|
settings.javaScriptEnabled = true
|
||||||
|
|
||||||
|
loadData("""<script src="https://ltn.hitomi.la/gg.js"></script>""", "text/html", null)
|
||||||
|
}
|
||||||
|
|
||||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
|
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
|
||||||
|
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
|||||||
@@ -16,10 +16,15 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil.hitomi
|
package xyz.quaver.pupil.hitomi
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import app.cash.zipline.QuickJs
|
import android.webkit.WebView
|
||||||
|
import android.webkit.WebViewClient
|
||||||
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import xyz.quaver.json
|
import xyz.quaver.json
|
||||||
|
import xyz.quaver.pupil.Pupil
|
||||||
|
import xyz.quaver.pupil.webView
|
||||||
import xyz.quaver.readText
|
import xyz.quaver.readText
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
@@ -39,6 +44,7 @@ const val galleryblockextension = ".html"
|
|||||||
const val galleryblockdir = "galleryblock"
|
const val galleryblockdir = "galleryblock"
|
||||||
const val nozomiextension = ".nozomi"
|
const val nozomiextension = ".nozomi"
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
interface gg {
|
interface gg {
|
||||||
fun m(g: Int): Int
|
fun m(g: Int): Int
|
||||||
val b: String
|
val b: String
|
||||||
@@ -50,18 +56,51 @@ interface gg {
|
|||||||
fun getInstance(): gg =
|
fun getInstance(): gg =
|
||||||
instance ?: synchronized(this) {
|
instance ?: synchronized(this) {
|
||||||
instance ?: object: gg {
|
instance ?: object: gg {
|
||||||
private val engine = QuickJs.create().also {
|
override fun m(g: Int): Int {
|
||||||
it.evaluate(URL("https://ltn.hitomi.la/gg.js").readText(Charset.defaultCharset()).also {
|
var result: Int? = null
|
||||||
Log.d("PUPILD", it)
|
|
||||||
})
|
MainScope().launch {
|
||||||
|
while (webView.progress != 100) delay(100)
|
||||||
|
webView.evaluateJavascript("gg.m($g)") {
|
||||||
|
result = it.toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (result == null) Thread.sleep(100)
|
||||||
|
|
||||||
|
return result!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun m(g: Int): Int = engine.evaluate("gg.m($g)") as Int
|
|
||||||
|
|
||||||
override val b: String
|
override val b: String
|
||||||
get() = engine.evaluate("gg.b") as String
|
get() {
|
||||||
|
var result: String? = null
|
||||||
|
|
||||||
override fun s(h: String): String = engine.evaluate("gg.s('$h')") as String
|
MainScope().launch {
|
||||||
|
while (webView.progress != 100) delay(100)
|
||||||
|
webView.evaluateJavascript("gg.b") {
|
||||||
|
result = it.replace("\"", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (result == null) Thread.sleep(100)
|
||||||
|
|
||||||
|
return result!!
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun s(h: String): String {
|
||||||
|
var result: String? = null
|
||||||
|
|
||||||
|
MainScope().launch {
|
||||||
|
while (webView.progress != 100) delay(100)
|
||||||
|
webView.evaluateJavascript("gg.s('$h')") {
|
||||||
|
result = it.replace("\"", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (result == null) Thread.sleep(100)
|
||||||
|
|
||||||
|
return result!!
|
||||||
|
}
|
||||||
}.also { instance = it }
|
}.also { instance = it }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class DownloadService : Service() {
|
|||||||
|
|
||||||
override fun source(): BufferedSource {
|
override fun source(): BufferedSource {
|
||||||
if (bufferedSource == null)
|
if (bufferedSource == null)
|
||||||
bufferedSource = source(responseBody.source()).buffer()
|
bufferedSource = Okio.buffer(source(responseBody.source()))
|
||||||
|
|
||||||
return bufferedSource!!
|
return bufferedSource!!
|
||||||
}
|
}
|
||||||
@@ -174,13 +174,9 @@ class DownloadService : Service() {
|
|||||||
private val interceptor: PupilInterceptor = { chain ->
|
private val interceptor: PupilInterceptor = { chain ->
|
||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
|
|
||||||
Log.d("PUPILD", "REQ")
|
|
||||||
|
|
||||||
if (rateLimitHost.matches(request.url().host()))
|
if (rateLimitHost.matches(request.url().host()))
|
||||||
rateLimiter.acquire()
|
rateLimiter.acquire()
|
||||||
|
|
||||||
Log.d("PUPILD", "ACQ ${request.url()}")
|
|
||||||
|
|
||||||
var response = chain.proceed(request)
|
var response = chain.proceed(request)
|
||||||
var limit = 5
|
var limit = 5
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ allprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
|
|
||||||
maven { url "https://guardian.github.io/maven/repo-releases/" }
|
maven { url "https://guardian.github.io/maven/repo-releases/" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user