Mangaku: use by lazy for loading assets (#372)

This commit is contained in:
Vetle Ledaal 2024-01-19 09:31:13 +00:00 committed by Draff
parent 8a55ca5d6f
commit 27bed17520

View File

@ -204,7 +204,6 @@ class Mangaku : ParsedHttpSource() {
latch.await(5, TimeUnit.SECONDS)
handler.post { webView?.destroy() }
if (latch.count == 1L) {
throw Exception("Kehabisan waktu saat men-decrypt tautan gambar") //Timeout while decrypting image links
}
@ -238,10 +237,15 @@ class Mangaku : ParsedHttpSource() {
}
}
private val jQueryScript = javaClass
.getResource("/assets/zepto.min.js")!!
.readText() // Zepto v1.2.0 (jQuery compatible)
private val cryptoJSScript = javaClass
.getResource("/assets/crypto-js.min.js")!!
.readText() // CryptoJS v4.0.0 (on site: cpr2.js)
private val jQueryScript by lazy {
javaClass
.getResource("/assets/zepto.min.js")!!
.readText() // Zepto v1.2.0 (jQuery compatible)
}
private val cryptoJSScript by lazy {
javaClass
.getResource("/assets/crypto-js.min.js")!!
.readText() // CryptoJS v4.0.0 (on site: cpr2.js)
}
}