Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ee1bb11a0 | ||
|
|
c1de45abce | ||
|
|
8805033c8d | ||
|
|
0ed59bb8a9 | ||
|
|
8163f2fd28 | ||
|
|
521a65c9d2 |
@@ -2,7 +2,7 @@
|
||||
*Pupil, Hitomi.la viewer for Android*
|
||||
|
||||

|
||||
[](https://github.com/tom5079/Pupil/releases/download/5.3.1/Pupil-v5.3.1.apk)
|
||||
[](https://github.com/tom5079/Pupil/releases/download/5.3.3/Pupil-v5.3.3.apk)
|
||||
[](https://discord.gg/Stj4b5v)
|
||||
|
||||
# Features
|
||||
|
||||
@@ -38,7 +38,7 @@ android {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 31
|
||||
versionCode 69
|
||||
versionName "5.3.2"
|
||||
versionName "5.3.4"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 69,
|
||||
"versionName": "5.3.2",
|
||||
"versionName": "5.3.4",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -102,19 +102,19 @@ class ExampleInstrumentedTest {
|
||||
Log.d("PUPILD", r.take(10).toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun test_getBlock() {
|
||||
val galleryBlock = getGalleryBlock(2097576)
|
||||
|
||||
print(galleryBlock)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun test_getGallery() {
|
||||
val gallery = getGallery(2097751)
|
||||
|
||||
print(gallery)
|
||||
}
|
||||
// @Test
|
||||
// fun test_getBlock() {
|
||||
// val galleryBlock = getGalleryBlock(2097576)
|
||||
//
|
||||
// print(galleryBlock)
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// fun test_getGallery() {
|
||||
// val gallery = getGallery(2097751)
|
||||
//
|
||||
// print(gallery)
|
||||
// }
|
||||
|
||||
@Test
|
||||
fun test_getGalleryInfo() {
|
||||
@@ -125,42 +125,44 @@ class ExampleInstrumentedTest {
|
||||
|
||||
@Test
|
||||
fun test_getReader() {
|
||||
val reader = getGalleryInfo(1722144)
|
||||
val reader = getGalleryInfo(2128654)
|
||||
|
||||
print(reader)
|
||||
Log.d("PUPILD", reader.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun test_getImages() {
|
||||
val galleryID = 2099306
|
||||
fun test_getImages() { runBlocking {
|
||||
val galleryID = 2128654
|
||||
|
||||
val images = getGalleryInfo(galleryID).files.map {
|
||||
imageUrlFromImage(galleryID, it,false)
|
||||
}
|
||||
|
||||
images.forEachIndexed { index, image ->
|
||||
println("Testing $index/${images.size}: $image")
|
||||
val response = client.newCall(
|
||||
Request.Builder()
|
||||
.url(image)
|
||||
.header("Referer", "https://hitomi.la/")
|
||||
.build()
|
||||
).execute()
|
||||
Log.d("PUPILD", images.toString())
|
||||
|
||||
assertEquals(200, response.code())
|
||||
// images.forEachIndexed { index, image ->
|
||||
// println("Testing $index/${images.size}: $image")
|
||||
// val response = client.newCall(
|
||||
// Request.Builder()
|
||||
// .url(image)
|
||||
// .header("Referer", "https://hitomi.la/")
|
||||
// .build()
|
||||
// ).execute()
|
||||
//
|
||||
// assertEquals(200, response.code())
|
||||
//
|
||||
// println("$index/${images.size} Passed")
|
||||
// }
|
||||
} }
|
||||
|
||||
println("$index/${images.size} Passed")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun test_urlFromUrlFromHash() {
|
||||
val url = urlFromUrlFromHash(1531795, GalleryFiles(
|
||||
212, "719d46a7556be0d0021c5105878507129b5b3308b02cf67f18901b69dbb3b5ef", 1, "00.jpg", 300
|
||||
), "webp")
|
||||
|
||||
print(url)
|
||||
}
|
||||
// @Test
|
||||
// fun test_urlFromUrlFromHash() {
|
||||
// val url = urlFromUrlFromHash(1531795, GalleryFiles(
|
||||
// 212, "719d46a7556be0d0021c5105878507129b5b3308b02cf67f18901b69dbb3b5ef", 1, "00.jpg", 300
|
||||
// ), "webp")
|
||||
//
|
||||
// print(url)
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// suspend fun test_doSearch_extreme() {
|
||||
@@ -173,9 +175,9 @@ class ExampleInstrumentedTest {
|
||||
// print(doSearch("-male:yaoi -female:yaoi -female:loli").size)
|
||||
// }
|
||||
|
||||
@Test
|
||||
fun test_subdomainFromUrl() {
|
||||
val galleryInfo = getGalleryInfo(1929109).files[2]
|
||||
print(urlFromUrlFromHash(1929109, galleryInfo, "webp", null, "a"))
|
||||
}
|
||||
// @Test
|
||||
// fun test_subdomainFromUrl() {
|
||||
// val galleryInfo = getGalleryInfo(1929109).files[2]
|
||||
// print(urlFromUrlFromHash(1929109, galleryInfo, "webp", null, "a"))
|
||||
// }
|
||||
}
|
||||
@@ -81,7 +81,6 @@ private var version = ""
|
||||
var runtimeReady = false
|
||||
private set
|
||||
lateinit var runtime: QuickJs
|
||||
private set
|
||||
|
||||
class Pupil : Application() {
|
||||
companion object {
|
||||
@@ -91,7 +90,7 @@ class Pupil : Application() {
|
||||
|
||||
init {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
withContext(evaluationContext) {
|
||||
withContext(Dispatchers.Main) {
|
||||
runtime = QuickJs.create()
|
||||
}
|
||||
while (true) {
|
||||
@@ -100,11 +99,15 @@ class Pupil : Application() {
|
||||
|
||||
if (version != newVersion) {
|
||||
runtimeReady = false
|
||||
version = newVersion
|
||||
evaluationContext.cancelChildren()
|
||||
withContext(evaluationContext) {
|
||||
runtime.evaluate(URL("https://tom5079.github.io/PupilSources/assets/js/gg.js").readText())
|
||||
runtimeReady = true
|
||||
kotlin.runCatching {
|
||||
URL("https://tom5079.github.io/PupilSources/assets/js/gg.js").readText()
|
||||
}.getOrNull()?.also { gg ->
|
||||
withContext(Dispatchers.Main) {
|
||||
runtime.evaluate(gg)
|
||||
version = newVersion
|
||||
runtimeReady = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ const val galleryblockextension = ".html"
|
||||
const val galleryblockdir = "galleryblock"
|
||||
const val nozomiextension = ".nozomi"
|
||||
|
||||
val evaluationContext = Executors.newSingleThreadExecutor().asCoroutineDispatcher() + Job()
|
||||
val evaluationContext = Dispatchers.Main + Job()
|
||||
|
||||
object gg {
|
||||
|
||||
@@ -198,14 +198,15 @@ suspend fun rewriteTnPaths(html: String) {
|
||||
}
|
||||
|
||||
suspend fun imageUrlFromImage(galleryID: Int, image: GalleryFiles, noWebp: Boolean) : String {
|
||||
return when {
|
||||
noWebp ->
|
||||
urlFromUrlFromHash(galleryID, image)
|
||||
// image.hasavif != 0 ->
|
||||
// urlFromUrlFromHash(galleryID, image, "avif", null, "a")
|
||||
image.haswebp != 0 ->
|
||||
urlFromUrlFromHash(galleryID, image, "webp", null, "a")
|
||||
else ->
|
||||
urlFromUrlFromHash(galleryID, image)
|
||||
}
|
||||
return urlFromUrlFromHash(galleryID, image, "webp", null, "a")
|
||||
// return when {
|
||||
// noWebp ->
|
||||
// urlFromUrlFromHash(galleryID, image)
|
||||
//// image.hasavif != 0 ->
|
||||
//// urlFromUrlFromHash(galleryID, image, "avif", null, "a")
|
||||
// image.haswebp != 0 ->
|
||||
// urlFromUrlFromHash(galleryID, image, "webp", null, "a")
|
||||
// else ->
|
||||
// urlFromUrlFromHash(galleryID, image)
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -200,6 +200,8 @@ class Cache private constructor(context: Context, val galleryID: Int) : ContextW
|
||||
|
||||
if (!file.exists())
|
||||
file.createNewFile()
|
||||
|
||||
file.writeBytes(data)
|
||||
setMetadata { metadata -> metadata.imageList!![index] = fileName }
|
||||
}
|
||||
|
||||
|
||||
@@ -100,13 +100,11 @@ fun GalleryBlock.formatDownloadFolderTest(format: String): String =
|
||||
|
||||
suspend fun GalleryInfo.getRequestBuilders(): List<Request.Builder> {
|
||||
val galleryID = this.id.toIntOrNull() ?: 0
|
||||
val lowQuality = Preferences["low_quality", true]
|
||||
|
||||
return this.files.map {
|
||||
Request.Builder()
|
||||
.url(
|
||||
runCatching {
|
||||
imageUrlFromImage(galleryID, it, !lowQuality)
|
||||
imageUrlFromImage(galleryID, it, false)
|
||||
}
|
||||
.onFailure {
|
||||
FirebaseCrashlytics.getInstance().recordException(it)
|
||||
|
||||
@@ -56,12 +56,6 @@
|
||||
app:key="nomedia"
|
||||
app:title="@string/settings_nomedia_title"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="low_quality"
|
||||
app:title="@string/settings_low_quality"
|
||||
app:summary="@string/settings_low_quality_summary"
|
||||
app:defaultValue="true"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
Reference in New Issue
Block a user