Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9519ec681 | ||
|
|
b146ed684d | ||
|
|
d2787c36d7 | ||
|
|
3ff663114a | ||
|
|
573e62f310 | ||
|
|
f9af670b82 | ||
|
|
bf461475c6 | ||
|
|
bdea6e0cc1 | ||
|
|
57f0ec4e5d |
@@ -2,7 +2,7 @@
|
|||||||
*Pupil, Hitomi.la viewer for Android*
|
*Pupil, Hitomi.la viewer for Android*
|
||||||
|
|
||||||

|

|
||||||
[](https://github.com/tom5079/Pupil/releases/download/5.3.4/Pupil-v5.3.4.apk)
|
[](https://github.com/tom5079/Pupil/releases/download/5.3.7/Pupil-v5.3.7.apk)
|
||||||
[](https://discord.gg/Stj4b5v)
|
[](https://discord.gg/Stj4b5v)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 32
|
targetSdkVersion 32
|
||||||
versionCode 69
|
versionCode 69
|
||||||
versionName "5.3.5"
|
versionName "5.3.8"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 69,
|
"versionCode": 69,
|
||||||
"versionName": "5.3.5",
|
"versionName": "5.3.8",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class Pupil : Application() {
|
|||||||
val proxyInfo = getProxyInfo()
|
val proxyInfo = getProxyInfo()
|
||||||
|
|
||||||
clientBuilder = OkHttpClient.Builder()
|
clientBuilder = OkHttpClient.Builder()
|
||||||
.connectTimeout(0, TimeUnit.SECONDS)
|
// .connectTimeout(0, TimeUnit.SECONDS)
|
||||||
.readTimeout(0, TimeUnit.SECONDS)
|
.readTimeout(0, TimeUnit.SECONDS)
|
||||||
.proxyInfo(proxyInfo)
|
.proxyInfo(proxyInfo)
|
||||||
.addInterceptor { chain ->
|
.addInterceptor { chain ->
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import kotlinx.coroutines.*
|
|||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
import kotlinx.datetime.Clock.System.now
|
import kotlinx.datetime.Clock.System.now
|
||||||
import kotlinx.datetime.Instant
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
@@ -139,7 +138,7 @@ const val nozomiextension = ".nozomi"
|
|||||||
val evaluationContext = Dispatchers.Main + Job()
|
val evaluationContext = Dispatchers.Main + Job()
|
||||||
|
|
||||||
object gg {
|
object gg {
|
||||||
private var lastRetrieval: Instant? = null
|
private var lastRetrieval: Long? = null
|
||||||
|
|
||||||
private val mutex = Mutex()
|
private val mutex = Mutex()
|
||||||
|
|
||||||
@@ -151,7 +150,7 @@ object gg {
|
|||||||
@OptIn(ExperimentalTime::class, ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalTime::class, ExperimentalCoroutinesApi::class)
|
||||||
private suspend fun refresh() = withContext(Dispatchers.IO) {
|
private suspend fun refresh() = withContext(Dispatchers.IO) {
|
||||||
mutex.withLock {
|
mutex.withLock {
|
||||||
if (lastRetrieval == null || (lastRetrieval!! + 1.minutes) < now()) {
|
if (lastRetrieval == null || (lastRetrieval!! + 60000) < System.currentTimeMillis()) {
|
||||||
val ggjs: String = suspendCancellableCoroutine { continuation ->
|
val ggjs: String = suspendCancellableCoroutine { continuation ->
|
||||||
val call = client.newCall(Request.Builder().url("https://ltn.hitomi.la/gg.js").build())
|
val call = client.newCall(Request.Builder().url("https://ltn.hitomi.la/gg.js").build())
|
||||||
|
|
||||||
@@ -188,7 +187,7 @@ object gg {
|
|||||||
|
|
||||||
b = Regex("b: '(.+)'").find(ggjs)!!.groupValues[1]
|
b = Regex("b: '(.+)'").find(ggjs)!!.groupValues[1]
|
||||||
|
|
||||||
lastRetrieval = now()
|
lastRetrieval = System.currentTimeMillis()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,18 +168,24 @@ class DownloadService : Service() {
|
|||||||
private val interceptor: PupilInterceptor = { chain ->
|
private val interceptor: PupilInterceptor = { chain ->
|
||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
|
|
||||||
var response = chain.proceed(request)
|
var response = kotlin.runCatching {
|
||||||
|
chain.proceed(request)
|
||||||
|
}.getOrNull()
|
||||||
var limit = 5
|
var limit = 5
|
||||||
|
|
||||||
while (!response.isSuccessful) {
|
while (response?.isSuccessful != true) {
|
||||||
if (response.code() == 503) {
|
if (response?.code() == 503) {
|
||||||
Thread.sleep(200)
|
Thread.sleep(200)
|
||||||
} else if (--limit > 0)
|
} else if (--limit < 0)
|
||||||
break
|
break
|
||||||
|
|
||||||
response = chain.proceed(request)
|
response = kotlin.runCatching {
|
||||||
|
chain.proceed(request)
|
||||||
|
}.getOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkNotNull(response)
|
||||||
|
|
||||||
response.newBuilder()
|
response.newBuilder()
|
||||||
.body(response.body()?.let {
|
.body(response.body()?.let {
|
||||||
ProgressResponseBody(request.tag(), it, progressListener)
|
ProgressResponseBody(request.tag(), it, progressListener)
|
||||||
@@ -207,6 +213,7 @@ class DownloadService : Service() {
|
|||||||
private val callback = object: Callback {
|
private val callback = object: Callback {
|
||||||
|
|
||||||
override fun onFailure(call: Call, e: IOException) {
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
|
Log.d("PUPILD", "ONFAILURE ${call.request().tag()}, ${e}")
|
||||||
FirebaseCrashlytics.getInstance().recordException(e)
|
FirebaseCrashlytics.getInstance().recordException(e)
|
||||||
|
|
||||||
if (e.message?.contains("cancel", true) == false) {
|
if (e.message?.contains("cancel", true) == false) {
|
||||||
@@ -215,6 +222,7 @@ class DownloadService : Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
|
Log.d("PUPILD", "ONRESPONSE ${call.request().tag()}")
|
||||||
val (galleryID, index, startId) = call.request().tag() as Tag
|
val (galleryID, index, startId) = call.request().tag() as Tag
|
||||||
val ext = call.request().url().encodedPath().split('.').last()
|
val ext = call.request().url().encodedPath().split('.').last()
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,9 @@ class ManageStorageFragment : PreferenceFragmentCompat(), Preference.OnPreferenc
|
|||||||
if (!metadataFile.exists()) return@forEach
|
if (!metadataFile.exists()) return@forEach
|
||||||
|
|
||||||
val metadata = metadataFile.readText()?.let {
|
val metadata = metadataFile.readText()?.let {
|
||||||
json.decodeFromString<Metadata>(it)
|
runCatching {
|
||||||
|
json.decodeFromString<Metadata>(it)
|
||||||
|
}.getOrNull()
|
||||||
} ?: return@forEach
|
} ?: return@forEach
|
||||||
|
|
||||||
val galleryID = metadata.galleryBlock?.id ?: metadata.galleryInfo?.id?.toIntOrNull() ?: return@forEach
|
val galleryID = metadata.galleryBlock?.id ?: metadata.galleryInfo?.id?.toIntOrNull() ?: return@forEach
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.3'
|
classpath 'com.android.tools.build:gradle:7.2.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ kotlin.code.style=official
|
|||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
|
||||||
kotlin_version=1.6.10
|
kotlin_version=1.7.10
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user