getContainer(); $config = Config::getInstance(); if ($config->uglyUrls) { $container['router'] = new UglyRouter(); } if ($config->debug) { Debug::enable(); } $container['view'] = ViewFactory::create($container); if (!class_exists('Locale')) { die('You need to install the intl extension for PHP.'); } $container['locale'] = new LocaleManager(); $app->add(new LocaleMiddleware($container)); $frontController = new FrontController($container); $jsonController = new JsonController($container); $downloadController = new DownloadController($container); $container['errorHandler'] = [$frontController, 'error']; $app->get( '/', [$frontController, 'index'] )->setName('index'); $app->get( '/extractors', [$frontController, 'extractors'] )->setName('extractors'); $app->any( '/info', [$frontController, 'info'] )->setName('info'); // Legacy route. $app->any('/video', [$frontController, 'info']); $app->any( '/watch', [$frontController, 'info'] ); $app->any( '/download', [$downloadController, 'download'] )->setName('download'); // Legacy route. $app->get('/redirect', [$downloadController, 'download']); $app->get( '/locale/{locale}', [$frontController, 'locale'] )->setName('locale'); $app->get( '/json', [$jsonController, 'json'] )->setName('json'); try { $app->run(); } catch (SmartyException $e) { die('Smarty could not compile the template file: ' . $e->getMessage()); }