revert: remove proxy apk at mediamtx
This commit is contained in:
parent
bea09b691d
commit
01681a33d4
1 changed files with 10 additions and 15 deletions
|
|
@ -858,27 +858,22 @@ class PttAudioClient @Inject constructor(
|
|||
suppliedUrl: String?,
|
||||
fallbackPath: String
|
||||
): String {
|
||||
|
||||
if (suppliedUrl.isNullOrBlank()) {
|
||||
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 {
|
||||
raw.startsWith("http://") || raw.startsWith("https://") -> {
|
||||
if (raw.contains("/media-mtx/")) {
|
||||
"$MEDIA_BASE_URL/" + raw.substringAfter("/media-mtx/").trimStart('/')
|
||||
} else {
|
||||
raw
|
||||
}
|
||||
}
|
||||
suppliedUrl.startsWith(
|
||||
"http://"
|
||||
) ||
|
||||
suppliedUrl.startsWith(
|
||||
"https://"
|
||||
) -> suppliedUrl
|
||||
|
||||
else -> {
|
||||
val path = raw.trimStart('/').removePrefix("media-mtx/")
|
||||
"$MEDIA_BASE_URL/$path"
|
||||
}
|
||||
else ->
|
||||
"$MEDIA_BASE_URL/" +
|
||||
suppliedUrl.trimStart('/')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue