fix: Specify allowed protocols explicitely
"^=http" also catches http_dash_segments
This commit is contained in:
parent
2ebe1a5bb0
commit
506584ceee
2 changed files with 6 additions and 11 deletions
|
@ -67,7 +67,7 @@ class FrontController
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $defaultFormat = 'best[protocol^=http]';
|
private $defaultFormat = 'best[protocol=https]/best[protocol=http]';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LocaleManager instance.
|
* LocaleManager instance.
|
||||||
|
@ -265,14 +265,14 @@ class FrontController
|
||||||
private function getAudioResponse(Request $request, Response $response, array $params, $password = null)
|
private function getAudioResponse(Request $request, Response $response, array $params, $password = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (isset($params['from']) || isset($params['to'])) {
|
if (isset($params['from']) && !empty($params['from']) || isset($params['to']) && !empty($params['to'])) {
|
||||||
throw new Exception('Force convert when we need to seek.');
|
throw new Exception('Force convert when we need to seek.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->config->stream) {
|
if ($this->config->stream) {
|
||||||
return $this->getStream($params['url'], 'mp3', $response, $request, $password);
|
return $this->getStream($params['url'], 'mp3', $response, $request, $password);
|
||||||
} else {
|
} else {
|
||||||
$urls = $this->download->getURL($params['url'], 'mp3[protocol^=http]', $password);
|
$urls = $this->download->getURL($params['url'], 'mp3[protocol=https]/mp3[protocol=http]', $password);
|
||||||
|
|
||||||
return $response->withRedirect($urls[0]);
|
return $response->withRedirect($urls[0]);
|
||||||
}
|
}
|
||||||
|
@ -300,11 +300,7 @@ class FrontController
|
||||||
} catch (PasswordException $e) {
|
} catch (PasswordException $e) {
|
||||||
return $this->password($request, $response);
|
return $this->password($request, $response);
|
||||||
}
|
}
|
||||||
if ($this->config->stream) {
|
|
||||||
$protocol = '';
|
|
||||||
} else {
|
|
||||||
$protocol = '[protocol^=http]';
|
|
||||||
}
|
|
||||||
if (isset($video->entries)) {
|
if (isset($video->entries)) {
|
||||||
$template = 'playlist.tpl';
|
$template = 'playlist.tpl';
|
||||||
} else {
|
} else {
|
||||||
|
@ -324,7 +320,6 @@ class FrontController
|
||||||
'class' => 'video',
|
'class' => 'video',
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'protocol' => $protocol,
|
|
||||||
'config' => $this->config,
|
'config' => $this->config,
|
||||||
'canonical' => $this->getCanonicalUrl($request),
|
'canonical' => $this->getCanonicalUrl($request),
|
||||||
'locale' => $this->localeManager->getLocale(),
|
'locale' => $this->localeManager->getLocale(),
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
<select name="format" id="format" class="formats monospace">
|
<select name="format" id="format" class="formats monospace">
|
||||||
<optgroup label="{t}Generic formats{/t}">
|
<optgroup label="{t}Generic formats{/t}">
|
||||||
<option value="best{$protocol}">
|
<option value="{if $config->stream}best{else}best[protocol=https]/best[protocol=http]{/if}">
|
||||||
{strip}
|
{strip}
|
||||||
{t}Best{/t} ({$video->ext})
|
{t}Best{/t} ({$video->ext})
|
||||||
{/strip}
|
{/strip}
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
{t}Remux best video with best audio{/t}
|
{t}Remux best video with best audio{/t}
|
||||||
</option>
|
</option>
|
||||||
{/if}
|
{/if}
|
||||||
<option value="worst{$protocol}">
|
<option value="{if $config->stream}worst{else}worst[protocol=https]/worst[protocol=http]{/if}">
|
||||||
{t}Worst{/t}
|
{t}Worst{/t}
|
||||||
</option>
|
</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue