Proxy implemented
This commit is contained in:
@@ -20,7 +20,7 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 42
|
versionCode 42
|
||||||
versionName "4.6-beta4"
|
versionName "4.6-alpha4"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":42,"versionName":"4.6-beta4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":42,"versionName":"4.6-alpha4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||||
@@ -31,7 +31,9 @@ import com.google.android.gms.common.GooglePlayServicesNotAvailableException
|
|||||||
import com.google.android.gms.common.GooglePlayServicesRepairableException
|
import com.google.android.gms.common.GooglePlayServicesRepairableException
|
||||||
import com.google.android.gms.security.ProviderInstaller
|
import com.google.android.gms.security.ProviderInstaller
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics
|
import com.google.firebase.analytics.FirebaseAnalytics
|
||||||
|
import xyz.quaver.proxy
|
||||||
import xyz.quaver.pupil.util.Histories
|
import xyz.quaver.pupil.util.Histories
|
||||||
|
import xyz.quaver.pupil.util.getProxy
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class Pupil : MultiDexApplication() {
|
class Pupil : MultiDexApplication() {
|
||||||
@@ -46,6 +48,8 @@ class Pupil : MultiDexApplication() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
val preference = PreferenceManager.getDefaultSharedPreferences(this)
|
val preference = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
|
||||||
|
proxy = getProxy(this)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
preference.getString("dl_location", null)
|
preference.getString("dl_location", null)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@@ -83,15 +83,6 @@ class ReaderAdapter(private val context: Context,
|
|||||||
|
|
||||||
var onItemClickListener : ((Int) -> (Unit))? = null
|
var onItemClickListener : ((Int) -> (Unit))? = null
|
||||||
|
|
||||||
init {
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
|
||||||
reader = Cache(context).getReader(galleryID)
|
|
||||||
launch(Dispatchers.Main) {
|
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ViewHolder(val view: View) : RecyclerView.ViewHolder(view)
|
class ViewHolder(val view: View) : RecyclerView.ViewHolder(view)
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.content.Intent
|
|||||||
import android.graphics.drawable.Animatable
|
import android.graphics.drawable.Animatable
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
@@ -238,9 +239,11 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
timer.schedule(1000, 1000) {
|
timer.schedule(1000, 1000) {
|
||||||
|
Log.i("PUPILD", "TIMER")
|
||||||
if (worker.progress.indexOfKey(galleryID) < 0) //loading
|
if (worker.progress.indexOfKey(galleryID) < 0) //loading
|
||||||
return@schedule
|
return@schedule
|
||||||
|
|
||||||
|
Log.i("PUPILD", "LOADEND")
|
||||||
if (worker.progress[galleryID] == null) { //Gallery not found
|
if (worker.progress[galleryID] == null) { //Gallery not found
|
||||||
timer.cancel()
|
timer.cancel()
|
||||||
Snackbar
|
Snackbar
|
||||||
@@ -248,15 +251,25 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i("PUPILD", "GALLERY")
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
|
Log.i("PUPILD", "UI")
|
||||||
reader_download_progressbar.max = reader_recyclerview.adapter?.itemCount ?: 0
|
reader_download_progressbar.max = reader_recyclerview.adapter?.itemCount ?: 0
|
||||||
reader_download_progressbar.progress = worker.progress[galleryID]?.count { !it.isFinite() } ?: 0
|
reader_download_progressbar.progress = worker.progress[galleryID]?.count { !it.isFinite() } ?: 0
|
||||||
reader_progressbar.max = reader_recyclerview.adapter?.itemCount ?: 0
|
reader_progressbar.max = reader_recyclerview.adapter?.itemCount ?: 0
|
||||||
|
|
||||||
|
Log.i("PUPILD", "COUNTEND")
|
||||||
if (title == getString(R.string.reader_loading)) {
|
if (title == getString(R.string.reader_loading)) {
|
||||||
val reader = (reader_recyclerview.adapter as ReaderAdapter).reader
|
Log.i("PUPILD", "LOADING")
|
||||||
|
val reader = Cache(this@ReaderActivity).getReaderOrNull(galleryID)
|
||||||
|
|
||||||
|
Log.i("PUPILD", "READER")
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
|
Log.i("PUPILD", "NOTNULL")
|
||||||
|
with (reader_recyclerview?.adapter as ReaderAdapter) {
|
||||||
|
this.reader = reader
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
title = reader.title
|
title = reader.title
|
||||||
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/${reader.galleryInfo.size}"
|
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/${reader.galleryInfo.size}"
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.widget.AdapterView
|
|||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import kotlinx.android.synthetic.main.dialog_proxy.view.*
|
import kotlinx.android.synthetic.main.dialog_proxy.view.*
|
||||||
|
import xyz.quaver.proxy
|
||||||
import xyz.quaver.pupil.R
|
import xyz.quaver.pupil.R
|
||||||
import xyz.quaver.pupil.util.ProxyInfo
|
import xyz.quaver.pupil.util.ProxyInfo
|
||||||
import xyz.quaver.pupil.util.getProxyInfo
|
import xyz.quaver.pupil.util.getProxyInfo
|
||||||
@@ -114,9 +115,14 @@ class ProxyDialog(context: Context) : Dialog(context) {
|
|||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putString("proxy",
|
ProxyInfo(type, addr, port, username, password).let {
|
||||||
json.stringify(ProxyInfo.serializer(), ProxyInfo(type, addr, port, username, password))
|
|
||||||
).apply()
|
PreferenceManager.getDefaultSharedPreferences(context).edit().putString("proxy",
|
||||||
|
json.stringify(ProxyInfo.serializer(), it)
|
||||||
|
).apply()
|
||||||
|
|
||||||
|
proxy = it.proxy()
|
||||||
|
}
|
||||||
|
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,9 +155,11 @@ class Cache(context: Context) : ContextWrapper(context) {
|
|||||||
var retval: Reader? = null
|
var retval: Reader? = null
|
||||||
|
|
||||||
for (source in sources) {
|
for (source in sources) {
|
||||||
retval = kotlin.runCatching {
|
retval = try {
|
||||||
source.value.invoke()
|
source.value.invoke()
|
||||||
}.getOrNull()
|
} catch (e: Exception) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
if (retval != null)
|
if (retval != null)
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.content.Context
|
|||||||
import android.content.ContextWrapper
|
import android.content.ContextWrapper
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.util.Log
|
||||||
import android.util.SparseArray
|
import android.util.SparseArray
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.app.NotificationManagerCompat
|
import androidx.core.app.NotificationManagerCompat
|
||||||
@@ -40,9 +41,9 @@ import xyz.quaver.hitomi.urlFromUrlFromHash
|
|||||||
import xyz.quaver.hiyobi.cookie
|
import xyz.quaver.hiyobi.cookie
|
||||||
import xyz.quaver.hiyobi.createImgList
|
import xyz.quaver.hiyobi.createImgList
|
||||||
import xyz.quaver.hiyobi.user_agent
|
import xyz.quaver.hiyobi.user_agent
|
||||||
|
import xyz.quaver.proxy
|
||||||
import xyz.quaver.pupil.R
|
import xyz.quaver.pupil.R
|
||||||
import xyz.quaver.pupil.ui.ReaderActivity
|
import xyz.quaver.pupil.ui.ReaderActivity
|
||||||
import xyz.quaver.pupil.util.getProxy
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import java.util.concurrent.LinkedBlockingQueue
|
import java.util.concurrent.LinkedBlockingQueue
|
||||||
@@ -160,7 +161,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
|||||||
OkHttpClient.Builder()
|
OkHttpClient.Builder()
|
||||||
.addInterceptor(interceptor)
|
.addInterceptor(interceptor)
|
||||||
.dispatcher(Dispatcher(Executors.newFixedThreadPool(4)))
|
.dispatcher(Dispatcher(Executors.newFixedThreadPool(4)))
|
||||||
.proxy(getProxy(this))
|
.proxy(proxy)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
fun stop() {
|
fun stop() {
|
||||||
@@ -263,6 +264,8 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
|||||||
}.toMutableList())
|
}.toMutableList())
|
||||||
exception.put(galleryID, reader.galleryInfo.map { null }.toMutableList())
|
exception.put(galleryID, reader.galleryInfo.map { null }.toMutableList())
|
||||||
|
|
||||||
|
Log.i("PUPILD", "READER HERE!")
|
||||||
|
|
||||||
if (notification[galleryID] == null)
|
if (notification[galleryID] == null)
|
||||||
initNotification(galleryID)
|
initNotification(galleryID)
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
package xyz.quaver
|
package xyz.quaver
|
||||||
|
|
||||||
|
import java.net.Proxy
|
||||||
|
|
||||||
|
var proxy = Proxy.NO_PROXY
|
||||||
|
|
||||||
fun availableInHiyobi(galleryID: Int) : Boolean {
|
fun availableInHiyobi(galleryID: Int) : Boolean {
|
||||||
return try {
|
return try {
|
||||||
xyz.quaver.hiyobi.getReader(galleryID)
|
xyz.quaver.hiyobi.getReader(galleryID)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package xyz.quaver.hitomi
|
|||||||
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.list
|
import kotlinx.serialization.list
|
||||||
|
import xyz.quaver.proxy
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
const val protocol = "https:"
|
const val protocol = "https:"
|
||||||
@@ -27,7 +28,9 @@ fun getGalleryInfo(galleryID: Int) =
|
|||||||
Json.nonstrict.parse(
|
Json.nonstrict.parse(
|
||||||
GalleryInfo.serializer().list,
|
GalleryInfo.serializer().list,
|
||||||
Regex("""\[.+]""").find(
|
Regex("""\[.+]""").find(
|
||||||
URL("$protocol//$domain/galleries/$galleryID.js").readText()
|
URL("$protocol//$domain/galleries/$galleryID.js").openConnection(proxy).getInputStream().use {
|
||||||
|
it.reader().readText()
|
||||||
|
}
|
||||||
)?.value ?: "[]"
|
)?.value ?: "[]"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package xyz.quaver.hitomi
|
|||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
|
import xyz.quaver.proxy
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@@ -36,7 +37,7 @@ data class Gallery(
|
|||||||
val thumbnails: List<String>
|
val thumbnails: List<String>
|
||||||
)
|
)
|
||||||
fun getGallery(galleryID: Int) : Gallery {
|
fun getGallery(galleryID: Int) : Gallery {
|
||||||
val url = Jsoup.connect("https://hitomi.la/galleries/$galleryID.html").get()
|
val url = Jsoup.connect("https://hitomi.la/galleries/$galleryID.html").proxy(proxy).get()
|
||||||
.select("a").attr("href")
|
.select("a").attr("href")
|
||||||
|
|
||||||
val doc = Jsoup.connect(url).get()
|
val doc = Jsoup.connect(url).get()
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package xyz.quaver.hitomi
|
|||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import xyz.quaver.Code
|
import xyz.quaver.Code
|
||||||
|
import xyz.quaver.proxy
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
@@ -78,7 +79,7 @@ data class GalleryBlock(
|
|||||||
fun getGalleryBlock(galleryID: Int) : GalleryBlock? {
|
fun getGalleryBlock(galleryID: Int) : GalleryBlock? {
|
||||||
val url = "$protocol//$domain/$galleryblockdir/$galleryID$extension"
|
val url = "$protocol//$domain/$galleryblockdir/$galleryID$extension"
|
||||||
|
|
||||||
val doc = Jsoup.connect(url).get()
|
val doc = Jsoup.connect(url).proxy(proxy).get()
|
||||||
|
|
||||||
val galleryUrl = doc.selectFirst(".lillie").attr("href")
|
val galleryUrl = doc.selectFirst(".lillie").attr("href")
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package xyz.quaver.hitomi
|
|||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import xyz.quaver.Code
|
import xyz.quaver.Code
|
||||||
|
import xyz.quaver.proxy
|
||||||
|
|
||||||
fun getReferer(galleryID: Int) = "https://hitomi.la/reader/$galleryID.html"
|
fun getReferer(galleryID: Int) = "https://hitomi.la/reader/$galleryID.html"
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ data class Reader(val code: Code, val title: String, val galleryInfo: List<Galle
|
|||||||
fun getReader(galleryID: Int) : Reader {
|
fun getReader(galleryID: Int) : Reader {
|
||||||
val readerUrl = "https://hitomi.la/reader/$galleryID.html"
|
val readerUrl = "https://hitomi.la/reader/$galleryID.html"
|
||||||
|
|
||||||
val doc = Jsoup.connect(readerUrl).get()
|
val doc = Jsoup.connect(readerUrl).proxy(proxy).get()
|
||||||
|
|
||||||
return Reader(Code.HITOMI, doc.title(), getGalleryInfo(galleryID))
|
return Reader(Code.HITOMI, doc.title(), getGalleryInfo(galleryID))
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package xyz.quaver.hitomi
|
package xyz.quaver.hitomi
|
||||||
|
|
||||||
|
import xyz.quaver.proxy
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.nio.ByteOrder
|
import java.nio.ByteOrder
|
||||||
@@ -49,8 +50,9 @@ fun sanitize(input: String) : String {
|
|||||||
|
|
||||||
fun getIndexVersion(name: String) : String {
|
fun getIndexVersion(name: String) : String {
|
||||||
return try {
|
return try {
|
||||||
URL("$protocol//$domain/$name/version?_=${System.currentTimeMillis()}")
|
URL("$protocol//$domain/$name/version?_=${System.currentTimeMillis()}").openConnection(proxy).getInputStream().use {
|
||||||
.readText()
|
it.reader().readText()
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
@@ -167,13 +169,16 @@ fun getSuggestionsFromData(field: String, data: Pair<Long, Int>) : List<Suggesti
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getGalleryIDsFromNozomi(area: String?, tag: String, language: String) : List<Int> {
|
fun getGalleryIDsFromNozomi(area: String?, tag: String, language: String) : List<Int> {
|
||||||
|
print("PUPILD: NOZOMI REQUEST: $area:$tag ($language)")
|
||||||
val nozomiAddress =
|
val nozomiAddress =
|
||||||
when(area) {
|
when(area) {
|
||||||
null -> "$protocol//$domain/$compressed_nozomi_prefix/$tag-$language$nozomiextension"
|
null -> "$protocol//$domain/$compressed_nozomi_prefix/$tag-$language$nozomiextension"
|
||||||
else -> "$protocol//$domain/$compressed_nozomi_prefix/$area/$tag-$language$nozomiextension"
|
else -> "$protocol//$domain/$compressed_nozomi_prefix/$area/$tag-$language$nozomiextension"
|
||||||
}
|
}
|
||||||
|
|
||||||
val bytes = URL(nozomiAddress).readBytes()
|
val bytes = URL(nozomiAddress).openConnection(proxy).getInputStream().use {
|
||||||
|
it.readBytes()
|
||||||
|
}
|
||||||
|
|
||||||
val nozomi = ArrayList<Int>()
|
val nozomi = ArrayList<Int>()
|
||||||
|
|
||||||
@@ -184,6 +189,7 @@ fun getGalleryIDsFromNozomi(area: String?, tag: String, language: String) : List
|
|||||||
while (arrayBuffer.hasRemaining())
|
while (arrayBuffer.hasRemaining())
|
||||||
nozomi.add(arrayBuffer.int)
|
nozomi.add(arrayBuffer.int)
|
||||||
|
|
||||||
|
print("PUPILD: NOZOMI REQUEST END: $area:$tag ($language)")
|
||||||
return nozomi
|
return nozomi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +244,7 @@ fun getNodeAtAddress(field: String, address: Long) : Node? {
|
|||||||
|
|
||||||
fun getURLAtRange(url: String, range: LongRange) : ByteArray? {
|
fun getURLAtRange(url: String, range: LongRange) : ByteArray? {
|
||||||
try {
|
try {
|
||||||
with (URL(url).openConnection() as HttpsURLConnection) {
|
with (URL(url).openConnection(proxy) as HttpsURLConnection) {
|
||||||
requestMethod = "GET"
|
requestMethod = "GET"
|
||||||
|
|
||||||
setRequestProperty("Range", "bytes=${range.first}-${range.last}")
|
setRequestProperty("Range", "bytes=${range.first}-${range.last}")
|
||||||
|
|||||||
@@ -20,11 +20,12 @@ import org.jsoup.Jsoup
|
|||||||
import xyz.quaver.Code
|
import xyz.quaver.Code
|
||||||
import xyz.quaver.hitomi.GalleryBlock
|
import xyz.quaver.hitomi.GalleryBlock
|
||||||
import xyz.quaver.hitomi.protocol
|
import xyz.quaver.hitomi.protocol
|
||||||
|
import xyz.quaver.proxy
|
||||||
|
|
||||||
fun getGalleryBlock(galleryID: Int) : GalleryBlock? {
|
fun getGalleryBlock(galleryID: Int) : GalleryBlock? {
|
||||||
val url = "$protocol//$hiyobi/info/$galleryID"
|
val url = "$protocol//$hiyobi/info/$galleryID"
|
||||||
|
|
||||||
val doc = Jsoup.connect(url).get()
|
val doc = Jsoup.connect(url).proxy(proxy).get()
|
||||||
|
|
||||||
val galleryBlock = doc.selectFirst(".gallery-content")
|
val galleryBlock = doc.selectFirst(".gallery-content")
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import xyz.quaver.Code
|
|||||||
import xyz.quaver.hitomi.GalleryInfo
|
import xyz.quaver.hitomi.GalleryInfo
|
||||||
import xyz.quaver.hitomi.Reader
|
import xyz.quaver.hitomi.Reader
|
||||||
import xyz.quaver.hitomi.protocol
|
import xyz.quaver.hitomi.protocol
|
||||||
|
import xyz.quaver.proxy
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import javax.net.ssl.HttpsURLConnection
|
import javax.net.ssl.HttpsURLConnection
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ fun renewCookie() : String {
|
|||||||
val url = "https://$hiyobi/"
|
val url = "https://$hiyobi/"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
with(URL(url).openConnection() as HttpsURLConnection) {
|
with(URL(url).openConnection(proxy) as HttpsURLConnection) {
|
||||||
setRequestProperty("User-Agent", user_agent)
|
setRequestProperty("User-Agent", user_agent)
|
||||||
connectTimeout = 2000
|
connectTimeout = 2000
|
||||||
connect()
|
connect()
|
||||||
@@ -62,12 +63,12 @@ fun getReader(galleryID: Int) : Reader {
|
|||||||
val reader = "https://$hiyobi/reader/$galleryID"
|
val reader = "https://$hiyobi/reader/$galleryID"
|
||||||
val url = "https://$hiyobi/data/json/${galleryID}_list.json"
|
val url = "https://$hiyobi/data/json/${galleryID}_list.json"
|
||||||
|
|
||||||
val title = Jsoup.connect(reader).get().title()
|
val title = Jsoup.connect(reader).proxy(proxy).get().title()
|
||||||
|
|
||||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||||
val galleryInfo = Json.parse(
|
val galleryInfo = Json.parse(
|
||||||
GalleryInfo.serializer().list,
|
GalleryInfo.serializer().list,
|
||||||
with(URL(url).openConnection() as HttpsURLConnection) {
|
with(URL(url).openConnection(proxy) as HttpsURLConnection) {
|
||||||
setRequestProperty("User-Agent", user_agent)
|
setRequestProperty("User-Agent", user_agent)
|
||||||
setRequestProperty("Cookie", cookie)
|
setRequestProperty("Cookie", cookie)
|
||||||
connectTimeout = 2000
|
connectTimeout = 2000
|
||||||
|
|||||||
Reference in New Issue
Block a user