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
|
FileETag None
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
|
RewriteCond %{HTTP_HOST} ^alltube\.herokuapp\.com$ [NC]
|
||||||
|
RewriteRule ^(.*)$ https://www.alltubedownload.net/$1 [R=301,L]
|
||||||
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^ index.php [QSA,L]
|
RewriteRule ^ index.php [QSA,L]
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,6 @@ class FrontController
|
||||||
$this->config = Config::getInstance();
|
$this->config = Config::getInstance();
|
||||||
if (isset($params["url"])) {
|
if (isset($params["url"])) {
|
||||||
if (isset($params['audio'])) {
|
if (isset($params['audio'])) {
|
||||||
try {
|
|
||||||
try {
|
try {
|
||||||
return $this->getStream($params["url"], 'bestaudio[protocol^=http]', $response, $request);
|
return $this->getStream($params["url"], 'bestaudio[protocol^=http]', $response, $request);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -200,11 +199,7 @@ class FrontController
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
|
||||||
$error = $e->getMessage();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
|
||||||
$video = $this->download->getJSON($params["url"]);
|
$video = $this->download->getJSON($params["url"]);
|
||||||
$container->view->render(
|
$container->view->render(
|
||||||
$response,
|
$response,
|
||||||
|
@ -221,12 +216,13 @@ class FrontController
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$container->view->render($response, 'footer.tpl');
|
$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(
|
$container->view->render(
|
||||||
$response,
|
$response,
|
||||||
'head.tpl',
|
'head.tpl',
|
||||||
|
@ -238,11 +234,11 @@ class FrontController
|
||||||
$response,
|
$response,
|
||||||
'error.tpl',
|
'error.tpl',
|
||||||
array(
|
array(
|
||||||
'errors'=>$error
|
'errors'=>$exception->getMessage()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$container->view->render($response, 'footer.tpl');
|
$container->view->render($response, 'footer.tpl');
|
||||||
}
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getStream($url, $format, $response, $request)
|
private function getStream($url, $format, $response, $request)
|
||||||
|
|
|
@ -30,6 +30,8 @@ $container['view'] = function ($c) {
|
||||||
|
|
||||||
$controller = new FrontController();
|
$controller = new FrontController();
|
||||||
|
|
||||||
|
$container['errorHandler'] = array($controller, 'error');
|
||||||
|
|
||||||
$app->get(
|
$app->get(
|
||||||
'/',
|
'/',
|
||||||
array($controller, 'index')
|
array($controller, 'index')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue