Skip to content
Permalink
Browse files
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
  • Loading branch information
bellington3 committed Oct 17, 2020
1 parent bfdb349 commit 83863bd66c2aab86f4a99f84521e49cc2bc0b8a7
Showing 5 changed files with 19 additions and 2 deletions.
@@ -147,6 +147,13 @@ class Config
*/
public $defaultAudio = false;

/**
* Disable audio conversion from/to seeker.
*
* @var bool
*/
public $convertSeek = true;

/**
* Config constructor.
*
@@ -101,8 +101,12 @@ public function download(Request $request, Response $response)
*/
private function getConvertedAudioResponse(Request $request, Response $response)
{
$from = $request->getQueryParam('from');
$to = $request->getQueryParam('to');
$from = null;
$to = null;
if ($this->config->convertSeek) {
$from = $request->getQueryParam('from');
$to = $request->getQueryParam('to');
}

$response = $response->withHeader(
'Content-Disposition',
@@ -58,3 +58,6 @@ debug: false

# True to enable audio conversion mode by default
defaultAudio: false

# False to disable convert seek functionality
convertSeek: true
@@ -24,13 +24,15 @@
<label for="audio"><span class="ui"></span>
{t}Audio only (MP3){/t}
</label>
{if $config->convertSeek}
<div class="seekOptions">
<label for="from">{t}From{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="from"
id="from"/>
<label for="to">{t}to{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="to" id="to"/>
</div>
{/if}
</div>
</div>
{/if}
@@ -76,6 +76,7 @@ private function assertConfig(Config $config)
$this->assertIsBool($config->stream);
$this->assertIsBool($config->remux);
$this->assertIsBool($config->defaultAudio);
$this->assertIsBool($config->convertSeek);
$this->assertIsInt($config->audioBitrate);
}

0 comments on commit 83863bd

Please sign in to comment.