+同步referer功能

This commit is contained in:
1
2024-09-16 12:12:39 +08:00
parent 82045ccf68
commit 44ff2bb022
2 changed files with 11 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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()
}