remove: proxy apk at mediamtx

This commit is contained in:
Marlon 2026-09-22 12:43:08 -05:00
parent 1a6dba6a32
commit bea09b691d

View file

@ -858,22 +858,27 @@ 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"
} }
return when { // Rails (BROWSER_PROXY) envía "/media-mtx/ptt/u/:id/whip".
suppliedUrl.startsWith( // MediaMTX espera "http://host:8889/ptt/u/:id/whip" (sin prefijo media-mtx).
"http://" val raw = suppliedUrl.trim()
) ||
suppliedUrl.startsWith(
"https://"
) -> suppliedUrl
else -> return when {
"$MEDIA_BASE_URL/" + raw.startsWith("http://") || raw.startsWith("https://") -> {
suppliedUrl.trimStart('/') if (raw.contains("/media-mtx/")) {
"$MEDIA_BASE_URL/" + raw.substringAfter("/media-mtx/").trimStart('/')
} else {
raw
}
}
else -> {
val path = raw.trimStart('/').removePrefix("media-mtx/")
"$MEDIA_BASE_URL/$path"
}
} }
} }