Provide config toggle to disable the 'convert seek' function (#311)
* Provide config toggle to disable the 'convert seek' function in the frontend * Add convertSeek config option to config.example * Only send from/to if convertSeek is activated
This commit is contained in:
parent
bfdb349a2b
commit
83863bd66c
5 changed files with 19 additions and 2 deletions
|
@ -147,6 +147,13 @@ class Config
|
||||||
*/
|
*/
|
||||||
public $defaultAudio = false;
|
public $defaultAudio = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable audio conversion from/to seeker.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $convertSeek = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config constructor.
|
* Config constructor.
|
||||||
*
|
*
|
||||||
|
|
|
@ -101,8 +101,12 @@ class DownloadController extends BaseController
|
||||||
*/
|
*/
|
||||||
private function getConvertedAudioResponse(Request $request, Response $response)
|
private function getConvertedAudioResponse(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
$from = $request->getQueryParam('from');
|
$from = null;
|
||||||
$to = $request->getQueryParam('to');
|
$to = null;
|
||||||
|
if ($this->config->convertSeek) {
|
||||||
|
$from = $request->getQueryParam('from');
|
||||||
|
$to = $request->getQueryParam('to');
|
||||||
|
}
|
||||||
|
|
||||||
$response = $response->withHeader(
|
$response = $response->withHeader(
|
||||||
'Content-Disposition',
|
'Content-Disposition',
|
||||||
|
|
|
@ -58,3 +58,6 @@ debug: false
|
||||||
|
|
||||||
# True to enable audio conversion mode by default
|
# True to enable audio conversion mode by default
|
||||||
defaultAudio: false
|
defaultAudio: false
|
||||||
|
|
||||||
|
# False to disable convert seek functionality
|
||||||
|
convertSeek: true
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<label for="audio"><span class="ui"></span>
|
<label for="audio"><span class="ui"></span>
|
||||||
{t}Audio only (MP3){/t}
|
{t}Audio only (MP3){/t}
|
||||||
</label>
|
</label>
|
||||||
|
{if $config->convertSeek}
|
||||||
<div class="seekOptions">
|
<div class="seekOptions">
|
||||||
<label for="from">{t}From{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
|
<label for="from">{t}From{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
|
||||||
placeholder="HH:MM:SS" value="" name="from"
|
placeholder="HH:MM:SS" value="" name="from"
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
<label for="to">{t}to{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
|
<label for="to">{t}to{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
|
||||||
placeholder="HH:MM:SS" value="" name="to" id="to"/>
|
placeholder="HH:MM:SS" value="" name="to" id="to"/>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -76,6 +76,7 @@ class ConfigTest extends BaseTest
|
||||||
$this->assertIsBool($config->stream);
|
$this->assertIsBool($config->stream);
|
||||||
$this->assertIsBool($config->remux);
|
$this->assertIsBool($config->remux);
|
||||||
$this->assertIsBool($config->defaultAudio);
|
$this->assertIsBool($config->defaultAudio);
|
||||||
|
$this->assertIsBool($config->convertSeek);
|
||||||
$this->assertIsInt($config->audioBitrate);
|
$this->assertIsInt($config->audioBitrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue