Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcd72bb8bd |
@@ -126,7 +126,7 @@ dependencies {
|
||||
implementation "ru.noties.markwon:core:3.1.0"
|
||||
|
||||
implementation "org.jsoup:jsoup:1.14.3"
|
||||
implementation "app.cash.zipline:zipline:1.0.0-SNAPSHOT"
|
||||
implementation "com.github.seven332:quickjs-android:0.1.0"
|
||||
|
||||
implementation "com.google.guava:guava:31.0.1-android"
|
||||
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
package xyz.quaver.pupil.hitomi
|
||||
|
||||
import android.util.Log
|
||||
import app.cash.zipline.QuickJs
|
||||
import com.hippo.quickjs.android.QuickJS
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import xyz.quaver.json
|
||||
import xyz.quaver.readText
|
||||
@@ -50,18 +55,33 @@ interface gg {
|
||||
fun getInstance(): gg =
|
||||
instance ?: synchronized(this) {
|
||||
instance ?: object: gg {
|
||||
private val engine = QuickJs.create().also {
|
||||
it.evaluate(URL("https://ltn.hitomi.la/gg.js").readText(Charset.defaultCharset()).also {
|
||||
Log.d("PUPILD", it)
|
||||
})
|
||||
private val ggjs by lazy { URL("https://ltn.hitomi.la/gg.js").readText(Charset.defaultCharset()) }
|
||||
private val quickJS = QuickJS.Builder().build()
|
||||
|
||||
override fun m(g: Int): Int =
|
||||
quickJS.createJSRuntime().use { runtime ->
|
||||
runtime.createJSContext().use { context ->
|
||||
context.evaluate(ggjs, "gg.js")
|
||||
context.evaluate("gg.m($g)", "gg.js", Int::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun m(g: Int): Int = engine.evaluate("gg.m($g)") as Int
|
||||
|
||||
override val b: String
|
||||
get() = engine.evaluate("gg.b") as String
|
||||
get() =
|
||||
quickJS.createJSRuntime().use { runtime ->
|
||||
runtime.createJSContext().use { context ->
|
||||
context.evaluate(ggjs, "gg.js")
|
||||
context.evaluate("gg.b", "gg.js", String::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun s(h: String): String = engine.evaluate("gg.s('$h')") as String
|
||||
override fun s(h: String): String =
|
||||
quickJS.createJSRuntime().use { runtime ->
|
||||
runtime.createJSContext().use { context ->
|
||||
context.evaluate(ggjs, "gg.js")
|
||||
context.evaluate("gg.s('$h')", "gg.js", String::class.java)
|
||||
}
|
||||
}
|
||||
}.also { instance = it }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class DownloadService : Service() {
|
||||
|
||||
override fun source(): BufferedSource {
|
||||
if (bufferedSource == null)
|
||||
bufferedSource = source(responseBody.source()).buffer()
|
||||
bufferedSource = Okio.buffer(source(responseBody.source()))
|
||||
|
||||
return bufferedSource!!
|
||||
}
|
||||
@@ -174,13 +174,9 @@ class DownloadService : Service() {
|
||||
private val interceptor: PupilInterceptor = { chain ->
|
||||
val request = chain.request()
|
||||
|
||||
Log.d("PUPILD", "REQ")
|
||||
|
||||
if (rateLimitHost.matches(request.url().host()))
|
||||
rateLimiter.acquire()
|
||||
|
||||
Log.d("PUPILD", "ACQ ${request.url()}")
|
||||
|
||||
var response = chain.proceed(request)
|
||||
var limit = 5
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ allprojects {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
|
||||
maven { url "https://guardian.github.io/maven/repo-releases/" }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user