Use default view variables
This commit is contained in:
parent
110bfc9ff1
commit
6bb577bcce
3 changed files with 27 additions and 33 deletions
|
@ -13,7 +13,6 @@ use Alltube\Locale;
|
|||
use Alltube\Middleware\CspMiddleware;
|
||||
use Exception;
|
||||
use Slim\Http\StatusCode;
|
||||
use Slim\Http\Uri;
|
||||
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
|
||||
use Throwable;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@ -60,15 +59,12 @@ class FrontController extends BaseController
|
|||
$response,
|
||||
'index.tpl',
|
||||
[
|
||||
'config' => $this->config,
|
||||
'class' => 'index',
|
||||
'description' => $this->localeManager->t(
|
||||
'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.'
|
||||
),
|
||||
'domain' => $uri->getScheme() . '://' . $uri->getAuthority(),
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'supportedLocales' => $this->localeManager->getSupportedLocales(),
|
||||
'locale' => $this->localeManager->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -106,14 +102,11 @@ class FrontController extends BaseController
|
|||
$response,
|
||||
'extractors.tpl',
|
||||
[
|
||||
'config' => $this->config,
|
||||
'extractors' => $this->downloader->getExtractors(),
|
||||
'class' => 'extractors',
|
||||
'title' => $this->localeManager->t('Supported websites'),
|
||||
'description' => $this->localeManager->t('List of all supported websites from which Alltube Download ' .
|
||||
'can extract video or audio files'),
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->localeManager->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -134,14 +127,11 @@ class FrontController extends BaseController
|
|||
$response,
|
||||
'password.tpl',
|
||||
[
|
||||
'config' => $this->config,
|
||||
'class' => 'password',
|
||||
'title' => $this->localeManager->t('Password prompt'),
|
||||
'description' => $this->localeManager->t(
|
||||
'You need a password in order to download this video with Alltube Download'
|
||||
),
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->localeManager->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -195,9 +185,6 @@ class FrontController extends BaseController
|
|||
'class' => 'info',
|
||||
'title' => $title,
|
||||
'description' => $description,
|
||||
'config' => $this->config,
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->localeManager->getLocale(),
|
||||
'defaultFormat' => $this->defaultFormat,
|
||||
]
|
||||
);
|
||||
|
@ -250,12 +237,9 @@ class FrontController extends BaseController
|
|||
$response,
|
||||
'error.tpl',
|
||||
[
|
||||
'config' => $this->config,
|
||||
'error' => $message,
|
||||
'class' => 'video',
|
||||
'title' => $this->localeManager->t('Error'),
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->localeManager->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -323,21 +307,4 @@ class FrontController extends BaseController
|
|||
return $this->displayError($request, $response, $message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the canonical URL of the current page.
|
||||
*
|
||||
* @param Request $request PSR-7 Request
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
private function getCanonicalUrl(Request $request)
|
||||
{
|
||||
/** @var Uri $uri */
|
||||
$uri = $request->getUri();
|
||||
|
||||
return $uri->withBasePath('')
|
||||
->withHost('alltubedownload.net')
|
||||
->withScheme('https');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue