revert: remove proxy apk at mediamtx #2
1 changed files with 10 additions and 15 deletions
|
|
@ -858,27 +858,22 @@ class PttAudioClient @Inject constructor(
|
||||||
suppliedUrl: String?,
|
suppliedUrl: String?,
|
||||||
fallbackPath: String
|
fallbackPath: String
|
||||||
): String {
|
): String {
|
||||||
|
|
||||||
if (suppliedUrl.isNullOrBlank()) {
|
if (suppliedUrl.isNullOrBlank()) {
|
||||||
return "$MEDIA_BASE_URL/$fallbackPath"
|
return "$MEDIA_BASE_URL/$fallbackPath"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rails (BROWSER_PROXY) envía "/media-mtx/ptt/u/:id/whip".
|
|
||||||
// MediaMTX espera "http://host:8889/ptt/u/:id/whip" (sin prefijo media-mtx).
|
|
||||||
val raw = suppliedUrl.trim()
|
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
raw.startsWith("http://") || raw.startsWith("https://") -> {
|
suppliedUrl.startsWith(
|
||||||
if (raw.contains("/media-mtx/")) {
|
"http://"
|
||||||
"$MEDIA_BASE_URL/" + raw.substringAfter("/media-mtx/").trimStart('/')
|
) ||
|
||||||
} else {
|
suppliedUrl.startsWith(
|
||||||
raw
|
"https://"
|
||||||
}
|
) -> suppliedUrl
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
else ->
|
||||||
val path = raw.trimStart('/').removePrefix("media-mtx/")
|
"$MEDIA_BASE_URL/" +
|
||||||
"$MEDIA_BASE_URL/$path"
|
suppliedUrl.trimStart('/')
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue