fix: improve transfer recognition and local data safety
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import java.io.FileInputStream
|
||||
import java.net.URI
|
||||
import java.util.Base64
|
||||
import java.util.Properties
|
||||
|
||||
@@ -120,15 +121,21 @@ val internalReleaseRequested = gradle.startParameter.taskNames.any { requestedTa
|
||||
taskName.contains("InternalRelease", ignoreCase = true)
|
||||
}
|
||||
if (internalReleaseRequested) {
|
||||
val expectedApiUrl = "https://lt.frp-say.com:38012"
|
||||
if (dartDefines["INTERNAL_BUILD"] != "true") {
|
||||
throw GradleException(
|
||||
"Internal release requires --dart-define=INTERNAL_BUILD=true",
|
||||
)
|
||||
}
|
||||
if (dartDefines["API_BASE_URL"] != expectedApiUrl) {
|
||||
val apiBaseUrl = dartDefines["API_BASE_URL"]?.trim().orEmpty()
|
||||
val validApiBaseUrl = runCatching {
|
||||
val uri = URI(apiBaseUrl)
|
||||
uri.scheme in setOf("http", "https") &&
|
||||
!uri.host.isNullOrBlank() &&
|
||||
uri.userInfo == null
|
||||
}.getOrDefault(false)
|
||||
if (!validApiBaseUrl) {
|
||||
throw GradleException(
|
||||
"Internal release requires --dart-define=API_BASE_URL=$expectedApiUrl",
|
||||
"Internal release requires an explicit HTTP(S) --dart-define=API_BASE_URL=<url>",
|
||||
)
|
||||
}
|
||||
if (dartDefines["APP_VERSION"].isNullOrBlank()) {
|
||||
|
||||
Reference in New Issue
Block a user