diff --git a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt b/app/src/main/java/io/legado/app/help/http/HttpHelper.kt index 26c948575..e88702b32 100644 --- a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt +++ b/app/src/main/java/io/legado/app/help/http/HttpHelper.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() } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt index 69c67fbd5..8270254a1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt @@ -29,7 +29,7 @@ object ImageProvider { out.close() } } else { - HttpHelper.getBytes(src)?.let { + HttpHelper.getBytes(src, src)?.let { FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it) } }