mirror of
https://github.com/InvertGeek/MixFile.git
synced 2026-06-06 12:29:45 +08:00
+同步referer功能
This commit is contained in:
@@ -14,8 +14,8 @@ android {
|
||||
applicationId = "com.donut.mixfile"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 21
|
||||
versionName = "1.1.2"
|
||||
versionCode = 22
|
||||
versionName = "1.1.3"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
||||
@@ -10,6 +10,8 @@ import io.ktor.client.request.url
|
||||
import io.ktor.client.statement.bodyAsText
|
||||
import io.ktor.client.statement.readBytes
|
||||
import io.ktor.http.isSuccess
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
var CUSTOM_UPLOAD_URL by cachedMutableOf("", "CUSTOM_UPLOAD_URL")
|
||||
|
||||
@@ -20,6 +22,13 @@ object CustomUploader : Uploader("自定义") {
|
||||
override suspend fun genHead(): ByteArray {
|
||||
return uploadClient.get {
|
||||
url(CUSTOM_UPLOAD_URL)
|
||||
}.also {
|
||||
val referer = it.headers["referer"]
|
||||
if (!referer.isNullOrEmpty()) {
|
||||
withContext(Dispatchers.Main) {
|
||||
CUSTOM_REFERER = referer
|
||||
}
|
||||
}
|
||||
}.readBytes()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user