revert: remove proxy apk at mediamtx #2

Merged
mperalta merged 1 commit from remove/proxy_apk_at_mediamtx into main 2026-09-25 14:02:51 +00:00

View file

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