pull/274/head
gedoor 4 years ago
parent fcc7519021
commit 99b9a59129
  1. 5
      app/src/main/java/io/legado/app/help/http/HttpHelper.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt

@ -49,11 +49,12 @@ object HttpHelper {
return null
}
fun getBytes(url: String): ByteArray? {
fun getBytes(url: String, refer: String): ByteArray? {
NetworkUtils.getBaseUrl(url)?.let { baseUrl ->
val headers = mapOf(Pair(AppConst.UA_NAME, AppConst.userAgent), Pair("refer", refer))
return getByteRetrofit(baseUrl)
.create(HttpGetApi::class.java)
.getMapByte(url, mapOf(), mapOf(Pair(AppConst.UA_NAME, AppConst.userAgent)))
.getMapByte(url, mapOf(), headers)
.execute()
.body()
}

@ -29,7 +29,7 @@ object ImageProvider {
out.close()
}
} else {
HttpHelper.getBytes(src)?.let {
HttpHelper.getBytes(src, src)?.let {
FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it)
}
}

Loading…
Cancel
Save