Use HTTPS protocol for secure remote URLs.
This commit is contained in:
parent
1cf0119c29
commit
251bfa3433
|
@ -373,6 +373,13 @@ class StationMount implements StationMountInterface
|
|||
return $fe_settings->getPort();
|
||||
}
|
||||
|
||||
public function getAutodjProtocol(): ?string
|
||||
{
|
||||
return Adapters::FRONTEND_SHOUTCAST === $this->getAutodjAdapterType()
|
||||
? self::PROTOCOL_ICY
|
||||
: null;
|
||||
}
|
||||
|
||||
public function getAutodjUsername(): ?string
|
||||
{
|
||||
return '';
|
||||
|
|
|
@ -9,6 +9,10 @@ interface StationMountInterface
|
|||
public const FORMAT_AAC = 'aac';
|
||||
public const FORMAT_OPUS = 'opus';
|
||||
|
||||
public const PROTOCOL_ICY = 'icy';
|
||||
public const PROTOCOL_HTTP = 'http';
|
||||
public const PROTOCOL_HTTPS = 'https';
|
||||
|
||||
public function getEnableAutodj(): bool;
|
||||
|
||||
public function getAutodjUsername(): ?string;
|
||||
|
@ -23,6 +27,8 @@ interface StationMountInterface
|
|||
|
||||
public function getAutodjPort(): ?int;
|
||||
|
||||
public function getAutodjProtocol(): ?string;
|
||||
|
||||
public function getAutodjMount(): ?string;
|
||||
|
||||
public function getAutodjAdapterType(): string;
|
||||
|
|
|
@ -440,6 +440,18 @@ class StationRemote implements StationMountInterface
|
|||
$this->source_port = $source_port;
|
||||
}
|
||||
|
||||
public function getAutodjProtocol(): ?string
|
||||
{
|
||||
if (Adapters::REMOTE_SHOUTCAST2 === $this->getAutodjAdapterType()) {
|
||||
return self::PROTOCOL_ICY;
|
||||
}
|
||||
|
||||
$urlScheme = parse_url($this->getUrl(), PHP_URL_SCHEME);
|
||||
return ('https' === $urlScheme)
|
||||
? self::PROTOCOL_HTTPS
|
||||
: self::PROTOCOL_HTTP;
|
||||
}
|
||||
|
||||
public function getAutodjAdapterType(): string
|
||||
{
|
||||
return $this->getType();
|
||||
|
|
|
@ -1037,9 +1037,10 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
}
|
||||
$output_params[] = 'password = "' . $password . '"';
|
||||
|
||||
$isShoutcastMode = Adapters::REMOTE_ICECAST !== $mount->getAutodjAdapterType();
|
||||
$protocol = $mount->getAutodjProtocol();
|
||||
|
||||
if (!empty($mount->getAutodjMount())) {
|
||||
if ($isShoutcastMode) {
|
||||
if ($mount::PROTOCOL_ICY === $protocol) {
|
||||
$output_params[] = 'icy_id = ' . $id;
|
||||
} else {
|
||||
$output_params[] = 'mount = "' . self::cleanUpString($mount->getAutodjMount()) . '"';
|
||||
|
@ -1057,8 +1058,8 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
$output_params[] = 'public = ' . ($mount->getIsPublic() ? 'true' : 'false');
|
||||
$output_params[] = 'encoding = "' . $charset . '"';
|
||||
|
||||
if ($isShoutcastMode) {
|
||||
$output_params[] = 'protocol="icy"';
|
||||
if (null !== $protocol) {
|
||||
$output_params[] = 'protocol="' . $protocol . '"';
|
||||
}
|
||||
|
||||
if (Entity\StationMountInterface::FORMAT_OPUS === $mount->getAutodjFormat()) {
|
||||
|
|
Loading…
Reference in New Issue