Merge branch 'develop' into feature/stream
Conflicts: controllers/FrontController.php
This commit is contained in:
commit
94722841c9
3 changed files with 119 additions and 117 deletions
|
@ -14,6 +14,10 @@ Addtype font/truetype .ttf
|
|||
FileETag None
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{HTTP_HOST} ^alltube\.herokuapp\.com$ [NC]
|
||||
RewriteRule ^(.*)$ https://www.alltubedownload.net/$1 [R=301,L]
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [QSA,L]
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ class FrontController
|
|||
$this->config = Config::getInstance();
|
||||
if (isset($params["url"])) {
|
||||
if (isset($params['audio'])) {
|
||||
try {
|
||||
try {
|
||||
return $this->getStream($params["url"], 'bestaudio[protocol^=http]', $response, $request);
|
||||
} catch (\Exception $e) {
|
||||
|
@ -200,11 +199,7 @@ class FrontController
|
|||
}
|
||||
return $response;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$video = $this->download->getJSON($params["url"]);
|
||||
$container->view->render(
|
||||
$response,
|
||||
|
@ -221,12 +216,13 @@ class FrontController
|
|||
)
|
||||
);
|
||||
$container->view->render($response, 'footer.tpl');
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($error)) {
|
||||
|
||||
public function error($request, $response, $exception)
|
||||
{
|
||||
global $container;
|
||||
$container->view->render(
|
||||
$response,
|
||||
'head.tpl',
|
||||
|
@ -238,11 +234,11 @@ class FrontController
|
|||
$response,
|
||||
'error.tpl',
|
||||
array(
|
||||
'errors'=>$error
|
||||
'errors'=>$exception->getMessage()
|
||||
)
|
||||
);
|
||||
$container->view->render($response, 'footer.tpl');
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function getStream($url, $format, $response, $request)
|
||||
|
|
|
@ -30,6 +30,8 @@ $container['view'] = function ($c) {
|
|||
|
||||
$controller = new FrontController();
|
||||
|
||||
$container['errorHandler'] = array($controller, 'error');
|
||||
|
||||
$app->get(
|
||||
'/',
|
||||
array($controller, 'index')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue