Update AzuraRelays to use new URL format.

This commit is contained in:
Buster Neece 2023-08-30 05:56:31 -05:00
parent 49b822e08b
commit cce0c58c46
No known key found for this signature in database
2 changed files with 4 additions and 25 deletions

View File

@ -99,22 +99,6 @@ abstract class AbstractFrontend extends AbstractLocalAdapter
->withPath('');
}
/**
* @param Station $station
* @param UriInterface|null $baseUrl
*
* @return UriInterface[]
*/
public function getStreamUrls(Station $station, UriInterface $baseUrl = null): array
{
$urls = [];
foreach ($station->getMounts() as $mount) {
$urls[] = $this->getUrlForMount($station, $mount, $baseUrl);
}
return $urls;
}
abstract public function getAdminUrl(Station $station, UriInterface $baseUrl = null): UriInterface;
public function getNowPlaying(Station $station, bool $includeClients = true): Result

View File

@ -9,6 +9,7 @@ use App\Container\EnvironmentAwareTrait;
use App\Container\SettingsAwareTrait;
use App\Entity\Relay;
use App\Entity\StationRemote;
use App\Nginx\CustomUrls;
use GuzzleHttp\Client;
use GuzzleHttp\Promise\Create;
use GuzzleHttp\Promise\PromiseInterface;
@ -88,23 +89,17 @@ final class AzuraRelay extends AbstractRemote
$baseUrl = new Uri(rtrim($relay->getBaseUrl(), '/'));
$radioPort = $station->getFrontendConfig()->getPort();
$useRadioProxy = $this->readSettings()->getUseRadioProxy();
if (
$useRadioProxy
|| 'https' === $baseUrl->getScheme()
|| (!$this->environment->isProduction() && !$this->environment->isDocker())
) {
if ($useRadioProxy || 'https' === $baseUrl->getScheme()) {
// Web proxy support.
return (string)$baseUrl
->withPath($baseUrl->getPath() . '/radio/' . $radioPort . $remote->getMount());
->withPath($baseUrl->getPath() . CustomUrls::getListenUrl($station) . $remote->getmount());
}
// Remove port number and other decorations.
return (string)$baseUrl
->withPort($radioPort)
->withPort($station->getFrontendConfig()->getPort())
->withPath($remote->getMount() ?? '');
}
}