Skip to content

Commit

Permalink
download referer
Browse files Browse the repository at this point in the history
  • Loading branch information
LagradOst committed Jan 3, 2021
1 parent 5218b94 commit 3a1c6d6
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 135 deletions.
9 changes: 7 additions & 2 deletions app/src/main/java/com/lagradost/fastani/DownloadManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.os.Build
import android.provider.Settings
import android.widget.Toast
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.bumptech.glide.Glide
import com.lagradost.fastani.MainActivity.Companion.activity
import com.lagradost.fastani.MainActivity.Companion.getColorFromAttr
import com.lagradost.fastani.MainActivity.Companion.isDonor
import com.lagradost.fastani.MainActivity.Companion.md5
import kotlin.concurrent.thread
import kotlin.math.pow
import kotlin.math.round
Expand Down Expand Up @@ -316,7 +318,9 @@ object DownloadManager {
val connection: URLConnection = _url.openConnection()

var bytesRead = 0L
val referer = ""
val androidId: String =
Settings.Secure.getString(localContext?.contentResolver, Settings.Secure.ANDROID_ID)
val referer = androidId.md5()

// =================== STORAGE ===================
try {
Expand All @@ -343,6 +347,7 @@ object DownloadManager {
// =================== CONNECTION ===================
connection.setRequestProperty("Accept-Encoding", "identity")
if (referer != "") {
println("REFERER: " + referer)
connection.setRequestProperty("Referer", referer)
}
connection.connectTimeout = 10000
Expand Down Expand Up @@ -417,7 +422,7 @@ object DownloadManager {

if (downloadStatus[id] == DownloadStatusType.IsStoped) {
downloadStatus.remove(id)
if(rFile.exists()) {
if (rFile.exists()) {
rFile.delete()
}
println("FILE STOPPED")
Expand Down
Loading

0 comments on commit 3a1c6d6

Please sign in to comment.