From 110bfc9ff15939995e68e5f0cc976a59c7e9cab1 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 00:28:36 +0200 Subject: [PATCH 01/11] Cleaner way to build the canonical URL --- classes/Controller/FrontController.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/classes/Controller/FrontController.php b/classes/Controller/FrontController.php index 912fc8d..1c1a171 100644 --- a/classes/Controller/FrontController.php +++ b/classes/Controller/FrontController.php @@ -13,6 +13,7 @@ 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; @@ -332,19 +333,11 @@ class FrontController extends BaseController */ private function getCanonicalUrl(Request $request) { + /** @var Uri $uri */ $uri = $request->getUri(); - $return = 'https://alltubedownload.net/'; - $path = $uri->getPath(); - if ($path != '/') { - $return .= $path; - } - - $query = $uri->getQuery(); - if (!empty($query)) { - $return .= '?' . $query; - } - - return $return; + return $uri->withBasePath('') + ->withHost('alltubedownload.net') + ->withScheme('https'); } } From 6bb577bccee251d2eaec61d152ba3cde2677e4fd Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 00:45:09 +0200 Subject: [PATCH 02/11] Use default view variables --- classes/Controller/FrontController.php | 33 -------------------------- classes/Factory/ViewFactory.php | 21 ++++++++++++++++ tests/ViewFactoryTest.php | 6 +++++ 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/classes/Controller/FrontController.php b/classes/Controller/FrontController.php index 1c1a171..22bbd5b 100644 --- a/classes/Controller/FrontController.php +++ b/classes/Controller/FrontController.php @@ -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'); - } } diff --git a/classes/Factory/ViewFactory.php b/classes/Factory/ViewFactory.php index 40f84f2..e17a4ed 100644 --- a/classes/Factory/ViewFactory.php +++ b/classes/Factory/ViewFactory.php @@ -19,6 +19,23 @@ use SmartyException; */ class ViewFactory { + /** + * Generate the canonical URL of the current page. + * + * @param Request $request PSR-7 Request + * + * @return string URL + */ + private static function getCanonicalUrl(Request $request) + { + /** @var Uri $uri */ + $uri = $request->getUri(); + + return $uri->withBasePath('') + ->withHost('alltubedownload.net') + ->withScheme('https'); + } + /** * Create Smarty view object. * @@ -63,6 +80,10 @@ class ViewFactory $view->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']); $view->registerPlugin('block', 't', [$localeManager, 'smartyTranslate']); + $view->offsetSet('canonical', self::getCanonicalUrl($request)); + $view->offsetSet('locale', $container->get('locale')->getLocale()); + $view->offsetSet('config', $container->get('config')); + return $view; } } diff --git a/tests/ViewFactoryTest.php b/tests/ViewFactoryTest.php index a4d4f54..868af18 100644 --- a/tests/ViewFactoryTest.php +++ b/tests/ViewFactoryTest.php @@ -6,7 +6,9 @@ namespace Alltube\Test; +use Alltube\Exception\ConfigException; use Alltube\Exception\DependencyException; +use Alltube\Factory\ConfigFactory; use Alltube\Factory\LocaleManagerFactory; use Alltube\Factory\SessionFactory; use Alltube\Factory\ViewFactory; @@ -27,12 +29,14 @@ class ViewFactoryTest extends BaseTest * @return void * @throws SmartyException * @throws DependencyException + * @throws ConfigException */ public function testCreate() { $container = new Container(); $container['session'] = SessionFactory::create($container); $container['locale'] = LocaleManagerFactory::create($container); + $container['config'] = ConfigFactory::create($container); $view = ViewFactory::create($container); $this->assertInstanceOf(Smarty::class, $view); } @@ -43,12 +47,14 @@ class ViewFactoryTest extends BaseTest * @return void * @throws SmartyException * @throws DependencyException + * @throws ConfigException */ public function testCreateWithXForwardedProto() { $container = new Container(); $container['session'] = SessionFactory::create($container); $container['locale'] = LocaleManagerFactory::create($container); + $container['config'] = ConfigFactory::create($container); $request = Request::createFromEnvironment(Environment::mock()); $view = ViewFactory::create($container, $request->withHeader('X-Forwarded-Proto', 'https')); $this->assertInstanceOf(Smarty::class, $view); From 7dead957f0de2e0cb7559d20dfc9d6687179369e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 00:45:41 +0200 Subject: [PATCH 03/11] Fix bookmarklet behind a reverse proxy --- classes/Controller/FrontController.php | 2 -- classes/Factory/ViewFactory.php | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/Controller/FrontController.php b/classes/Controller/FrontController.php index 22bbd5b..c6e620b 100644 --- a/classes/Controller/FrontController.php +++ b/classes/Controller/FrontController.php @@ -54,7 +54,6 @@ class FrontController extends BaseController */ public function index(Request $request, Response $response) { - $uri = $request->getUri()->withUserInfo(''); $this->view->render( $response, 'index.tpl', @@ -63,7 +62,6 @@ class FrontController extends BaseController 'description' => $this->localeManager->t( 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.' ), - 'domain' => $uri->getScheme() . '://' . $uri->getAuthority(), 'supportedLocales' => $this->localeManager->getSupportedLocales(), ] ); diff --git a/classes/Factory/ViewFactory.php b/classes/Factory/ViewFactory.php index e17a4ed..dc60ad0 100644 --- a/classes/Factory/ViewFactory.php +++ b/classes/Factory/ViewFactory.php @@ -83,6 +83,7 @@ class ViewFactory $view->offsetSet('canonical', self::getCanonicalUrl($request)); $view->offsetSet('locale', $container->get('locale')->getLocale()); $view->offsetSet('config', $container->get('config')); + $view->offsetSet('domain', $uri->withPath('')->withBasePath('')); return $view; } From 7d856c61fbdd43d7d6b90cd19c825362330383b6 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 01:00:52 +0200 Subject: [PATCH 04/11] Cleaner way to build the redirect --- classes/Controller/BaseController.php | 8 +++++++- classes/Controller/DownloadController.php | 2 +- classes/Controller/FrontController.php | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/classes/Controller/BaseController.php b/classes/Controller/BaseController.php index 1922aff..f57b0aa 100644 --- a/classes/Controller/BaseController.php +++ b/classes/Controller/BaseController.php @@ -10,12 +10,12 @@ use Alltube\Config; use Alltube\Library\Downloader; use Alltube\Library\Video; use Alltube\LocaleManager; -use Alltube\SessionFactory; use Aura\Session\Segment; use Consolidation\Log\Logger; use Psr\Container\ContainerInterface; use Slim\Http\Request; use Slim\Http\Response; +use Slim\Router; /** * Abstract class used by every controller. @@ -76,6 +76,11 @@ abstract class BaseController */ protected $logger; + /** + * @var Router + */ + protected $router; + /** * BaseController constructor. * @@ -89,6 +94,7 @@ abstract class BaseController $this->sessionSegment = $session->getSegment(self::class); $this->localeManager = $this->container->get('locale'); $this->downloader = $this->config->getDownloader(); + $this->router = $this->container->get('router'); $this->logger = $this->container->get('logger'); $this->downloader->setLogger($this->logger); diff --git a/classes/Controller/DownloadController.php b/classes/Controller/DownloadController.php index e3c547c..b80890f 100644 --- a/classes/Controller/DownloadController.php +++ b/classes/Controller/DownloadController.php @@ -86,7 +86,7 @@ class DownloadController extends BaseController } } } else { - return $response->withRedirect($this->container->get('router')->pathFor('index')); + return $response->withRedirect($this->router->pathFor('index')); } } diff --git a/classes/Controller/FrontController.php b/classes/Controller/FrontController.php index c6e620b..0cd8efa 100644 --- a/classes/Controller/FrontController.php +++ b/classes/Controller/FrontController.php @@ -13,6 +13,7 @@ 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; @@ -82,7 +83,7 @@ class FrontController extends BaseController { $this->localeManager->setLocale(new Locale($data['locale'])); - return $response->withRedirect($this->container->get('router')->pathFor('index')); + return $response->withRedirect($this->router->pathFor('index')); } /** @@ -209,14 +210,13 @@ class FrontController extends BaseController if ($this->config->convert && $request->getQueryParam('audio')) { // We skip the info page and get directly to the download. return $response->withRedirect( - $this->container->get('router')->pathFor('download') . - '?' . http_build_query($request->getQueryParams()) + $this->router->pathFor('download', [], $request->getQueryParams()) ); } else { return $this->getInfoResponse($request, $response); } } else { - return $response->withRedirect($this->container->get('router')->pathFor('index')); + return $response->withRedirect($this->router->pathFor('index')); } } From d97b824a4445742f724fef5f17066469bb0ff5c1 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 01:20:43 +0200 Subject: [PATCH 05/11] Cleaner way to build ugly URLs --- classes/UglyRouter.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/classes/UglyRouter.php b/classes/UglyRouter.php index 235ece0..95a60cf 100644 --- a/classes/UglyRouter.php +++ b/classes/UglyRouter.php @@ -9,6 +9,7 @@ namespace Alltube; use InvalidArgumentException; use Psr\Http\Message\ServerRequestInterface; use RuntimeException; +use Slim\Http\Uri; use Slim\Router; /** @@ -27,15 +28,17 @@ class UglyRouter extends Router */ public function dispatch(ServerRequestInterface $request) { - parse_str($request->getUri()->getQuery(), $args); - $uri = '/'; - if (isset($args['page'])) { - $uri .= $args['page']; + $params = $request->getQueryParams(); + $uri = new Uri('', ''); + + if (isset($params['page'])) { + // Build an URI that the router can understand. + $uri = $uri->withPath($params['page']); } return $this->createDispatcher()->dispatch( $request->getMethod(), - $uri + (string) $uri ); } @@ -52,10 +55,11 @@ class UglyRouter extends Router */ public function pathFor($name, array $data = [], array $queryParams = []) { - $url = str_replace('/', '/?page=', $this->relativePathFor($name, $data, $queryParams)); + $queryParams['page'] = $name; + $url = Uri::createFromString($this->relativePathFor($name, $data, $queryParams))->withPath(''); if ($this->basePath) { - $url = $this->basePath . $url; + $url = $url->withBasePath($this->basePath); } return $url; From e1d7ad44e0e637330876b62db1e0fa7e942f9a91 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 01:36:00 +0200 Subject: [PATCH 06/11] Make the bookmarklet compatible with ugly URLs --- classes/Factory/ViewFactory.php | 2 +- templates/index.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Factory/ViewFactory.php b/classes/Factory/ViewFactory.php index dc60ad0..a20b08e 100644 --- a/classes/Factory/ViewFactory.php +++ b/classes/Factory/ViewFactory.php @@ -83,7 +83,7 @@ class ViewFactory $view->offsetSet('canonical', self::getCanonicalUrl($request)); $view->offsetSet('locale', $container->get('locale')->getLocale()); $view->offsetSet('config', $container->get('config')); - $view->offsetSet('domain', $uri->withPath('')->withBasePath('')); + $view->offsetSet('domain', rtrim($uri->withPath('')->withBasePath(''), '/')); return $view; } diff --git a/templates/index.tpl b/templates/index.tpl index b26eb64..1f8af78 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -42,7 +42,7 @@

{t}Drag this to your bookmarks bar:{/t}

{t}Bookmarklet{/t} + href="javascript:window.location='{$domain}{path_for name='info' queryParams=['url' => '%url%']}'.replace('%url%', encodeURIComponent(location.href));">{t}Bookmarklet{/t}
From d83774ae7dbf2332a8641441e3e9e5fc0c80a1e2 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 21:40:20 +0200 Subject: [PATCH 07/11] Cleaner way to get the domain --- classes/Factory/ViewFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Factory/ViewFactory.php b/classes/Factory/ViewFactory.php index a20b08e..b5d2b19 100644 --- a/classes/Factory/ViewFactory.php +++ b/classes/Factory/ViewFactory.php @@ -83,7 +83,7 @@ class ViewFactory $view->offsetSet('canonical', self::getCanonicalUrl($request)); $view->offsetSet('locale', $container->get('locale')->getLocale()); $view->offsetSet('config', $container->get('config')); - $view->offsetSet('domain', rtrim($uri->withPath('')->withBasePath(''), '/')); + $view->offsetSet('domain', $uri->withBasePath('')->getBaseUrl()); return $view; } From 3d2b518cb4b9a4a3dcbd568bc65f5bca2e387eba Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 22:39:09 +0200 Subject: [PATCH 08/11] Create a test container that we can use in any test --- classes/Controller/FrontController.php | 1 - tests/ContainerTest.php | 57 ++++++++++++++++++++ tests/ControllerTest.php | 56 ++++--------------- tests/ConvertedPlaylistArchiveStreamTest.php | 6 +++ tests/FrontControllerTest.php | 16 +++--- tests/LocaleManagerTest.php | 16 ++++-- tests/LocaleMiddlewareTest.php | 37 ++++++------- tests/LocaleTest.php | 11 +++- tests/PlaylistArchiveStreamTest.php | 5 ++ tests/StreamTest.php | 14 +++-- tests/UglyRouterTest.php | 11 +++- tests/VideoStubsTest.php | 15 ++++-- tests/VideoTest.php | 11 ++-- tests/ViewFactoryTest.php | 30 +++-------- tests/YoutubeChunkStreamTest.php | 5 ++ tests/YoutubeStreamTest.php | 5 ++ 16 files changed, 179 insertions(+), 117 deletions(-) create mode 100644 tests/ContainerTest.php diff --git a/classes/Controller/FrontController.php b/classes/Controller/FrontController.php index 0cd8efa..18b1a11 100644 --- a/classes/Controller/FrontController.php +++ b/classes/Controller/FrontController.php @@ -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; diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php new file mode 100644 index 0000000..3be8ae3 --- /dev/null +++ b/tests/ContainerTest.php @@ -0,0 +1,57 @@ +checkRequirements(); + + $this->container = new Container(['environment' => Environment::mock()]); + $this->container['config'] = Config::fromFile($this->getConfigFile()); + $this->container['session'] = SessionFactory::create($this->container); + $this->container['locale'] = LocaleManagerFactory::create($this->container); + $this->container['view'] = ViewFactory::create($this->container); + $this->container['logger'] = new NullLogger(); + } + + /** + * Cleanup after each test. + */ + protected function tearDown(): void + { + $this->container->get('session')->clear(); + } +} diff --git a/tests/ControllerTest.php b/tests/ControllerTest.php index 9eae71b..ec32398 100644 --- a/tests/ControllerTest.php +++ b/tests/ControllerTest.php @@ -6,48 +6,19 @@ namespace Alltube\Test; -use Alltube\Config; use Alltube\Controller\BaseController; use Alltube\Controller\DownloadController; use Alltube\Controller\FrontController; use Alltube\Exception\ConfigException; use Alltube\Exception\DependencyException; -use Alltube\Factory\LocaleManagerFactory; -use Alltube\Factory\SessionFactory; -use Alltube\Factory\ViewFactory; -use Psr\Log\NullLogger; -use Slim\Container; -use Slim\Http\Environment; -use Slim\Http\Request; use Slim\Http\Response; use SmartyException; /** * Abstract class used by the controller tests. */ -abstract class ControllerTest extends BaseTest +abstract class ControllerTest extends ContainerTest { - /** - * Slim dependency container. - * - * @var Container - */ - protected $container; - - /** - * Mock HTTP request. - * - * @var Request - */ - protected $request; - - /** - * Mock HTTP response. - * - * @var Response - */ - protected $response; - /** * Controller instance used in tests. * @var BaseController @@ -63,27 +34,20 @@ abstract class ControllerTest extends BaseTest { parent::setUp(); - $this->container = new Container(); - $this->request = Request::createFromEnvironment(Environment::mock()); - $this->response = new Response(); - $this->container['config'] = Config::fromFile($this->getConfigFile()); - $this->container['session'] = SessionFactory::create($this->container); - $this->container['locale'] = LocaleManagerFactory::create($this->container); - $this->container['view'] = ViewFactory::create($this->container, $this->request); - $this->container['logger'] = new NullLogger(); - $frontController = new FrontController($this->container); $downloadController = new DownloadController($this->container); - $this->container['router']->map(['GET'], '/', [$frontController, 'index']) + $router = $this->container->get('router'); + + $router->map(['GET'], '/', [$frontController, 'index']) ->setName('index'); - $this->container['router']->map(['GET'], '/video', [$frontController, 'info']) + $router->map(['GET'], '/video', [$frontController, 'info']) ->setName('info'); - $this->container['router']->map(['GET'], '/extractors', [$frontController, 'extractors']) + $router->map(['GET'], '/extractors', [$frontController, 'extractors']) ->setName('extractors'); - $this->container['router']->map(['GET'], '/locale', [$frontController, 'locale']) + $router->map(['GET'], '/locale', [$frontController, 'locale']) ->setName('locale'); - $this->container['router']->map(['GET'], '/redirect', [$downloadController, 'download']) + $router->map(['GET'], '/redirect', [$downloadController, 'download']) ->setName('download'); } @@ -98,8 +62,8 @@ abstract class ControllerTest extends BaseTest protected function getRequestResult(string $request, array $params) { return $this->controller->$request( - $this->request->withQueryParams($params), - $this->response + $this->container->get('request')->withQueryParams($params), + $this->container->get('response') ); } diff --git a/tests/ConvertedPlaylistArchiveStreamTest.php b/tests/ConvertedPlaylistArchiveStreamTest.php index 4301fa7..0e42d49 100644 --- a/tests/ConvertedPlaylistArchiveStreamTest.php +++ b/tests/ConvertedPlaylistArchiveStreamTest.php @@ -7,7 +7,9 @@ namespace Alltube\Test; use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Stream\ConvertedPlaylistArchiveStream; +use SmartyException; /** * Unit tests for the ConvertedPlaylistArchiveStream class. @@ -15,9 +17,13 @@ use Alltube\Stream\ConvertedPlaylistArchiveStream; */ class ConvertedPlaylistArchiveStreamTest extends StreamTest { + /** * Prepare tests. + * * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index 51526b9..65a3d61 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -81,7 +81,7 @@ class FrontControllerTest extends ControllerTest Request::createFromEnvironment( Environment::mock(['REQUEST_URI' => '/foo', 'QUERY_STRING' => 'foo=bar']) ), - $this->response + $this->container->get('response') ); $this->assertTrue($result->isOk()); } @@ -189,9 +189,9 @@ class FrontControllerTest extends ControllerTest public function testInfoWithPassword() { $result = $this->controller->info( - $this->request->withQueryParams(['url' => 'http://vimeo.com/68375962']) + $this->container->get('request')->withQueryParams(['url' => 'http://vimeo.com/68375962']) ->withParsedBody(['password' => 'youtube-dl']), - $this->response + $this->container->get('response') ); $this->assertTrue($result->isOk()); } @@ -247,7 +247,11 @@ class FrontControllerTest extends ControllerTest */ public function testError() { - $result = $this->controller->error($this->request, $this->response, new Exception('foo')); + $result = $this->controller->error( + $this->container->get('request'), + $this->container->get('response'), + new Exception('foo') + ); $this->assertTrue($result->isServerError()); } @@ -260,8 +264,8 @@ class FrontControllerTest extends ControllerTest { $this->assertTrue( $this->controller->locale( - $this->request, - $this->response, + $this->container->get('request'), + $this->container->get('response'), ['locale' => 'fr_FR'] )->isRedirect() ); diff --git a/tests/LocaleManagerTest.php b/tests/LocaleManagerTest.php index d06af1f..e8fc7f0 100644 --- a/tests/LocaleManagerTest.php +++ b/tests/LocaleManagerTest.php @@ -6,15 +6,17 @@ namespace Alltube\Test; +use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Factory\SessionFactory; use Alltube\Locale; use Alltube\LocaleManager; -use Slim\Container; +use SmartyException; /** * Unit tests for the LocaleManagerTest class. */ -class LocaleManagerTest extends BaseTest +class LocaleManagerTest extends ContainerTest { /** * LocaleManager class instance. @@ -25,11 +27,17 @@ class LocaleManagerTest extends BaseTest /** * Prepare tests. + * + * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { + parent::setUp(); + $_SESSION[LocaleManager::class]['locale'] = 'foo_BAR'; - $this->localeManager = new LocaleManager(SessionFactory::create(new Container())); + $this->localeManager = new LocaleManager(SessionFactory::create($this->container)); } /** @@ -39,6 +47,8 @@ class LocaleManagerTest extends BaseTest */ protected function tearDown(): void { + parent::tearDown(); + $this->localeManager->unsetLocale(); } diff --git a/tests/LocaleMiddlewareTest.php b/tests/LocaleMiddlewareTest.php index 48977d8..b9a45cd 100644 --- a/tests/LocaleMiddlewareTest.php +++ b/tests/LocaleMiddlewareTest.php @@ -6,19 +6,17 @@ namespace Alltube\Test; +use Alltube\Exception\ConfigException; use Alltube\Exception\DependencyException; -use Alltube\Factory\LocaleManagerFactory; -use Alltube\Factory\SessionFactory; use Alltube\Middleware\LocaleMiddleware; -use Slim\Container; -use Slim\Http\Environment; use Slim\Http\Request; use Slim\Http\Response; +use SmartyException; /** * Unit tests for the FrontController class. */ -class LocaleMiddlewareTest extends BaseTest +class LocaleMiddlewareTest extends ContainerTest { /** * LocaleMiddleware instance. @@ -27,22 +25,17 @@ class LocaleMiddlewareTest extends BaseTest */ private $middleware; - /** - * Slim dependency container. - * - * @var Container - */ - private $container; - /** * Prepare tests. + * * @throws DependencyException + * @throws ConfigException + * @throws SmartyException */ protected function setUp(): void { - $this->container = new Container(); - $this->container['session'] = SessionFactory::create($this->container); - $this->container['locale'] = LocaleManagerFactory::create($this->container); + parent::setUp(); + $this->middleware = new LocaleMiddleware($this->container); } @@ -53,7 +46,9 @@ class LocaleMiddlewareTest extends BaseTest */ protected function tearDown(): void { - $this->container['locale']->unsetLocale(); + parent::tearDown(); + + $this->container->get('locale')->unsetLocale(); } /** @@ -66,7 +61,7 @@ class LocaleMiddlewareTest extends BaseTest { $locale = [ 'language' => 'en', - 'region' => 'US', + 'region' => 'US', ]; $this->assertEquals('en_US', $this->middleware->testLocale($locale)); } @@ -80,7 +75,7 @@ class LocaleMiddlewareTest extends BaseTest { $locale = [ 'language' => 'foo', - 'region' => 'BAR', + 'region' => 'BAR', ]; $this->assertNull($this->middleware->testLocale($locale)); $this->assertNull($this->middleware->testLocale([])); @@ -119,9 +114,8 @@ class LocaleMiddlewareTest extends BaseTest */ public function testInvoke() { - $request = Request::createFromEnvironment(Environment::mock()); $this->middleware->__invoke( - $request->withHeader('Accept-Language', 'foo-BAR'), + $this->container->get('request')->withHeader('Accept-Language', 'foo-BAR'), new Response(), [$this, 'assertHeader'] ); @@ -134,9 +128,8 @@ class LocaleMiddlewareTest extends BaseTest */ public function testInvokeWithoutHeader() { - $request = Request::createFromEnvironment(Environment::mock()); $this->middleware->__invoke( - $request->withoutHeader('Accept-Language'), + $this->container->get('request')->withoutHeader('Accept-Language'), new Response(), [$this, 'assertNoHeader'] ); diff --git a/tests/LocaleTest.php b/tests/LocaleTest.php index 2bf2358..e5949d4 100644 --- a/tests/LocaleTest.php +++ b/tests/LocaleTest.php @@ -6,12 +6,15 @@ namespace Alltube\Test; +use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Locale; +use SmartyException; /** * Unit tests for the LocaleTest class. */ -class LocaleTest extends BaseTest +class LocaleTest extends ContainerTest { /** * Locale class instance. @@ -22,9 +25,15 @@ class LocaleTest extends BaseTest /** * Prepare tests. + * + * @throws DependencyException + * @throws ConfigException + * @throws SmartyException */ protected function setUp(): void { + parent::setUp(); + $this->localeObject = new Locale('fr_FR'); } diff --git a/tests/PlaylistArchiveStreamTest.php b/tests/PlaylistArchiveStreamTest.php index ffae5ee..252bcd1 100644 --- a/tests/PlaylistArchiveStreamTest.php +++ b/tests/PlaylistArchiveStreamTest.php @@ -7,7 +7,9 @@ namespace Alltube\Test; use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Stream\PlaylistArchiveStream; +use SmartyException; /** * Unit tests for the PlaylistArchiveStream class. @@ -17,7 +19,10 @@ class PlaylistArchiveStreamTest extends StreamTest { /** * Prepare tests. + * * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { diff --git a/tests/StreamTest.php b/tests/StreamTest.php index 5b3c92a..e7a5700 100644 --- a/tests/StreamTest.php +++ b/tests/StreamTest.php @@ -6,16 +6,17 @@ namespace Alltube\Test; -use Alltube\Config; use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Library\Downloader; use Psr\Http\Message\StreamInterface; use RuntimeException; +use SmartyException; /** * Abstract class used by the stream tests. */ -abstract class StreamTest extends BaseTest +abstract class StreamTest extends ContainerTest { /** * Stream instance. @@ -31,15 +32,16 @@ abstract class StreamTest extends BaseTest /** * Prepare tests. + * + * @throws DependencyException * @throws ConfigException + * @throws SmartyException */ protected function setUp(): void { parent::setUp(); - // So ffmpeg does not spam the output with broken pipe errors. - $config = new Config(['ffmpegVerbosity' => 'fatal']); - $this->downloader = $config->getDownloader(); + $this->downloader = $this->container->get('config')->getDownloader(); } /** @@ -49,6 +51,8 @@ abstract class StreamTest extends BaseTest */ protected function tearDown(): void { + parent::tearDown(); + $this->stream->close(); } diff --git a/tests/UglyRouterTest.php b/tests/UglyRouterTest.php index f2c08ea..a70fc98 100644 --- a/tests/UglyRouterTest.php +++ b/tests/UglyRouterTest.php @@ -6,14 +6,17 @@ namespace Alltube\Test; +use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\UglyRouter; use Slim\Http\Environment; use Slim\Http\Request; +use SmartyException; /** * Unit tests for the UglyRouter class. */ -class UglyRouterTest extends BaseTest +class UglyRouterTest extends ContainerTest { /** * UglyRouter instance. @@ -24,9 +27,15 @@ class UglyRouterTest extends BaseTest /** * Prepare tests. + * + * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { + parent::setUp(); + $this->router = new UglyRouter(); $this->router->map(['GET'], '/foo', 'print')->setName('foo'); } diff --git a/tests/VideoStubsTest.php b/tests/VideoStubsTest.php index ae6f55a..35292e7 100644 --- a/tests/VideoStubsTest.php +++ b/tests/VideoStubsTest.php @@ -6,13 +6,15 @@ namespace Alltube\Test; -use Alltube\Config; +use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Library\Downloader; use Alltube\Library\Exception\AlltubeLibraryException; use Alltube\Library\Exception\PopenStreamException; use Alltube\Library\Video; use Mockery; use phpmock\mockery\PHPMockery; +use SmartyException; /** * Unit tests for the Video class. @@ -20,7 +22,7 @@ use phpmock\mockery\PHPMockery; * * @requires download */ -class VideoStubsTest extends BaseTest +class VideoStubsTest extends ContainerTest { /** * Video used in many tests. @@ -38,6 +40,10 @@ class VideoStubsTest extends BaseTest /** * Initialize properties used by test. + * + * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { @@ -46,8 +52,7 @@ class VideoStubsTest extends BaseTest PHPMockery::mock('Alltube\Library', 'popen'); PHPMockery::mock('Alltube\Library', 'fopen'); - $config = new Config(); - $this->downloader = $config->getDownloader(); + $this->downloader = $this->container->get('config')->getDownloader(); $this->video = $this->downloader->getVideo('https://www.youtube.com/watch?v=XJC9_JkzugE'); } @@ -58,6 +63,8 @@ class VideoStubsTest extends BaseTest */ protected function tearDown(): void { + parent::tearDown(); + Mockery::close(); } diff --git a/tests/VideoTest.php b/tests/VideoTest.php index 05b9856..6a26801 100644 --- a/tests/VideoTest.php +++ b/tests/VideoTest.php @@ -8,6 +8,7 @@ namespace Alltube\Test; use Alltube\Config; use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Library\Downloader; use Alltube\Library\Exception\AlltubeLibraryException; use Alltube\Library\Exception\AvconvException; @@ -18,13 +19,14 @@ use Alltube\Library\Exception\RemuxException; use Alltube\Library\Exception\WrongPasswordException; use Alltube\Library\Exception\YoutubedlException; use Alltube\Library\Video; +use SmartyException; /** * Unit tests for the Video class. * @requires download * @todo Split Downloader and Video tests. */ -class VideoTest extends BaseTest +class VideoTest extends ContainerTest { /** * Downloader instance used in tests. @@ -42,15 +44,16 @@ class VideoTest extends BaseTest /** * Prepare tests. + * * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { parent::setUp(); - // So ffmpeg does not spam the output with broken pipe errors. - $config = new Config(['ffmpegVerbosity' => 'fatal']); - $this->downloader = $config->getDownloader(); + $this->downloader = $this->container->get('config')->getDownloader(); $this->format = 'best'; } diff --git a/tests/ViewFactoryTest.php b/tests/ViewFactoryTest.php index 868af18..5802d24 100644 --- a/tests/ViewFactoryTest.php +++ b/tests/ViewFactoryTest.php @@ -6,38 +6,24 @@ namespace Alltube\Test; -use Alltube\Exception\ConfigException; -use Alltube\Exception\DependencyException; -use Alltube\Factory\ConfigFactory; -use Alltube\Factory\LocaleManagerFactory; -use Alltube\Factory\SessionFactory; use Alltube\Factory\ViewFactory; -use Slim\Container; -use Slim\Http\Environment; -use Slim\Http\Request; use Slim\Views\Smarty; use SmartyException; /** * Unit tests for the ViewFactory class. */ -class ViewFactoryTest extends BaseTest +class ViewFactoryTest extends ContainerTest { /** * Test the create() function. * * @return void * @throws SmartyException - * @throws DependencyException - * @throws ConfigException */ public function testCreate() { - $container = new Container(); - $container['session'] = SessionFactory::create($container); - $container['locale'] = LocaleManagerFactory::create($container); - $container['config'] = ConfigFactory::create($container); - $view = ViewFactory::create($container); + $view = ViewFactory::create($this->container); $this->assertInstanceOf(Smarty::class, $view); } @@ -46,17 +32,13 @@ class ViewFactoryTest extends BaseTest * * @return void * @throws SmartyException - * @throws DependencyException - * @throws ConfigException */ public function testCreateWithXForwardedProto() { - $container = new Container(); - $container['session'] = SessionFactory::create($container); - $container['locale'] = LocaleManagerFactory::create($container); - $container['config'] = ConfigFactory::create($container); - $request = Request::createFromEnvironment(Environment::mock()); - $view = ViewFactory::create($container, $request->withHeader('X-Forwarded-Proto', 'https')); + $view = ViewFactory::create( + $this->container, + $this->container->get('request')->withHeader('X-Forwarded-Proto', 'https') + ); $this->assertInstanceOf(Smarty::class, $view); } } diff --git a/tests/YoutubeChunkStreamTest.php b/tests/YoutubeChunkStreamTest.php index 8064f60..b49bc1f 100644 --- a/tests/YoutubeChunkStreamTest.php +++ b/tests/YoutubeChunkStreamTest.php @@ -7,8 +7,10 @@ namespace Alltube\Test; use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Library\Exception\AlltubeLibraryException; use Alltube\Stream\YoutubeChunkStream; +use SmartyException; /** * Unit tests for the YoutubeChunkStream class. @@ -18,8 +20,11 @@ class YoutubeChunkStreamTest extends StreamTest { /** * Prepare tests. + * * @throws AlltubeLibraryException * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { diff --git a/tests/YoutubeStreamTest.php b/tests/YoutubeStreamTest.php index 838a270..1baed87 100644 --- a/tests/YoutubeStreamTest.php +++ b/tests/YoutubeStreamTest.php @@ -7,8 +7,10 @@ namespace Alltube\Test; use Alltube\Exception\ConfigException; +use Alltube\Exception\DependencyException; use Alltube\Library\Exception\AlltubeLibraryException; use Alltube\Stream\YoutubeStream; +use SmartyException; /** * Unit tests for the YoutubeStream class. @@ -18,8 +20,11 @@ class YoutubeStreamTest extends StreamTest { /** * Prepare tests. + * * @throws AlltubeLibraryException * @throws ConfigException + * @throws DependencyException + * @throws SmartyException */ protected function setUp(): void { From 7ad0040f6084a38b2bcf097a0b4fef0425cf3071 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 22 Oct 2020 23:08:40 +0200 Subject: [PATCH 09/11] Move container creation to a new App class --- classes/App.php | 105 ++++++++++++++++++++++++++++++++++++++++++++++++ index.php | 86 +-------------------------------------- 2 files changed, 106 insertions(+), 85 deletions(-) create mode 100644 classes/App.php diff --git a/classes/App.php b/classes/App.php new file mode 100644 index 0000000..a2b8434 --- /dev/null +++ b/classes/App.php @@ -0,0 +1,105 @@ +getContainer(); + + // Config. + $container['config'] = ConfigFactory::create($container); + + // Session. + $container['session'] = SessionFactory::create($container); + + // Locales. + $container['locale'] = LocaleManagerFactory::create($container); + + // Smarty. + $container['view'] = ViewFactory::create($container); + + // Logger. + $container['logger'] = LoggerFactory::create($container); + + // Middlewares. + $this->add(new LocaleMiddleware($container)); + $this->add(new CspMiddleware($container)); + $this->add(new LinkHeaderMiddleware($container)); + $this->add(new RouterPathMiddleware($container)); + + // Controllers. + $frontController = new FrontController($container); + $jsonController = new JsonController($container); + $downloadController = new DownloadController($container); + + // Error handling. + $container['errorHandler'] = [$frontController, 'error']; + $container['phpErrorHandler'] = [$frontController, 'error']; + $container['notFoundHandler'] = [$frontController, 'notFound']; + $container['notAllowedHandler'] = [$frontController, 'notAllowed']; + + // Routes. + $this->get( + '/', + [$frontController, 'index'] + )->setName('index'); + + $this->get( + '/extractors', + [$frontController, 'extractors'] + )->setName('extractors'); + + $this->any( + '/info', + [$frontController, 'info'] + )->setName('info'); + + $this->any( + '/watch', + [$frontController, 'info'] + ); + + $this->any( + '/download', + [$downloadController, 'download'] + )->setName('download'); + + $this->get( + '/locale/{locale}', + [$frontController, 'locale'] + )->setName('locale'); + + $this->get( + '/json', + [$jsonController, 'json'] + )->setName('json'); + } +} diff --git a/index.php b/index.php index f386247..112fb7d 100644 --- a/index.php +++ b/index.php @@ -2,21 +2,8 @@ require_once __DIR__ . '/vendor/autoload.php'; -use Alltube\Controller\DownloadController; -use Alltube\Controller\FrontController; -use Alltube\Controller\JsonController; +use Alltube\App; use Alltube\ErrorHandler; -use Alltube\Factory\ConfigFactory; -use Alltube\Factory\LocaleManagerFactory; -use Alltube\Factory\LoggerFactory; -use Alltube\Factory\SessionFactory; -use Alltube\Factory\ViewFactory; -use Alltube\Middleware\CspMiddleware; -use Alltube\Middleware\LinkHeaderMiddleware; -use Alltube\Middleware\LocaleMiddleware; -use Alltube\Middleware\RouterPathMiddleware; -use Slim\App; -use Slim\Container; if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) { header('Location: ' . str_ireplace('/index.php', '/', $_SERVER['REQUEST_URI'])); @@ -27,77 +14,6 @@ try { // Create app. $app = new App(); - /** @var Container $container */ - $container = $app->getContainer(); - - // Config. - $container['config'] = ConfigFactory::create($container); - - // Session. - $container['session'] = SessionFactory::create($container); - - // Locales. - $container['locale'] = LocaleManagerFactory::create($container); - - // Smarty. - $container['view'] = ViewFactory::create($container); - - // Logger. - $container['logger'] = LoggerFactory::create($container); - - // Middlewares. - $app->add(new LocaleMiddleware($container)); - $app->add(new CspMiddleware($container)); - $app->add(new LinkHeaderMiddleware($container)); - $app->add(new RouterPathMiddleware($container)); - - // Controllers. - $frontController = new FrontController($container); - $jsonController = new JsonController($container); - $downloadController = new DownloadController($container); - - // Error handling. - $container['errorHandler'] = [$frontController, 'error']; - $container['phpErrorHandler'] = [$frontController, 'error']; - $container['notFoundHandler'] = [$frontController, 'notFound']; - $container['notAllowedHandler'] = [$frontController, 'notAllowed']; - - // Routes. - $app->get( - '/', - [$frontController, 'index'] - )->setName('index'); - - $app->get( - '/extractors', - [$frontController, 'extractors'] - )->setName('extractors'); - - $app->any( - '/info', - [$frontController, 'info'] - )->setName('info'); - - $app->any( - '/watch', - [$frontController, 'info'] - ); - - $app->any( - '/download', - [$downloadController, 'download'] - )->setName('download'); - - $app->get( - '/locale/{locale}', - [$frontController, 'locale'] - )->setName('locale'); - - $app->get( - '/json', - [$jsonController, 'json'] - )->setName('json'); - $app->run(); } catch (Throwable $e) { ErrorHandler::handle($e); From e330adec766593b708e84334ccc059615400b449 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 27 Oct 2020 23:18:59 +0100 Subject: [PATCH 10/11] Get youtube-dl from PyPI (fixes #323) --- composer.json | 4 ++-- composer.lock | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index cb6c51d..c2e26bb 100644 --- a/composer.json +++ b/composer.json @@ -88,8 +88,8 @@ "name": "ytdl-org/youtube-dl", "version": "2020.09.20", "dist": { - "type": "zip", - "url": "https://github.com/ytdl-org/youtube-dl/archive/2020.09.20.zip" + "type": "tar", + "url": "https://files.pythonhosted.org/packages/12/8b/51cae2929739d637fdfbc706b2d5f8925b5710d8f408b5319a07ea45fe99/youtube_dl-2020.9.20.tar.gz" } } } diff --git a/composer.lock b/composer.lock index d879092..260ec68 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3c2fabffdbf381b138354a986accc302", + "content-hash": "f5b6e1c6bffa544b0a74305489ea1350", "packages": [ { "name": "aura/session", @@ -2428,8 +2428,8 @@ "name": "ytdl-org/youtube-dl", "version": "2020.09.20", "dist": { - "type": "zip", - "url": "https://github.com/ytdl-org/youtube-dl/archive/2020.09.20.zip" + "type": "tar", + "url": "https://files.pythonhosted.org/packages/12/8b/51cae2929739d637fdfbc706b2d5f8925b5710d8f408b5319a07ea45fe99/youtube_dl-2020.9.20.tar.gz" }, "type": "library" }, @@ -7118,5 +7118,6 @@ "platform-dev": [], "platform-overrides": { "php": "7.3.11" - } + }, + "plugin-api-version": "1.1.0" } From c15f1e6bba78a4a11765080559fa0aea56c0f8cf Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 27 Oct 2020 23:33:00 +0100 Subject: [PATCH 11/11] Use a stable release of alltube-library --- composer.json | 2 +- composer.lock | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index c2e26bb..10d33f1 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "oomphinc/composer-installers-extender": "^2.0", "paragonie/csp-builder": "^2.5", "rinvex/countries": "^6.1", - "rudloff/alltube-library": "dev-develop", + "rudloff/alltube-library": "^0.1.1", "symfony/finder": "^5.0", "symfony/translation": "^4.0", "symfony/yaml": "^4.0", diff --git a/composer.lock b/composer.lock index 260ec68..0608a04 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f5b6e1c6bffa544b0a74305489ea1350", + "content-hash": "7db8acd0f18d73da93880f015265e1f6", "packages": [ { "name": "aura/session", @@ -1232,16 +1232,16 @@ }, { "name": "rudloff/alltube-library", - "version": "dev-develop", + "version": "0.1.1", "source": { "type": "git", "url": "https://github.com/Rudloff/alltube-library.git", - "reference": "69d09b780e01ec0f3e6e3d123be14fa3b981b64e" + "reference": "f0bbd14b06bb4df9e3fbae62a6f09b455fdcc703" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Rudloff/alltube-library/zipball/69d09b780e01ec0f3e6e3d123be14fa3b981b64e", - "reference": "69d09b780e01ec0f3e6e3d123be14fa3b981b64e", + "url": "https://api.github.com/repos/Rudloff/alltube-library/zipball/f0bbd14b06bb4df9e3fbae62a6f09b455fdcc703", + "reference": "f0bbd14b06bb4df9e3fbae62a6f09b455fdcc703", "shasum": "" }, "require": { @@ -1269,7 +1269,7 @@ ], "description": "PHP wrapper for youtube-dl", "homepage": "http://alltubedownload.net/", - "time": "2020-10-17T20:47:16+00:00" + "time": "2020-10-27T22:25:49+00:00" }, { "name": "slim/slim", @@ -7106,9 +7106,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "rudloff/alltube-library": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": {