Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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.5/Pupil-v5.3.5.apk)
|
||||||
[](https://discord.gg/Stj4b5v)
|
[](https://discord.gg/Stj4b5v)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|||||||
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user