diff --git a/.travis.yml b/.travis.yml index 62f82e2c..d913cc55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ install: - composer install --ignore-platform-reqs php: - - 7.3 - 7.4 - nightly @@ -12,13 +11,6 @@ script: - mkdir -p build/logs - php vendor/bin/phpunit -c build -#after_script: -# - CODECLIMATE_REPO_TOKEN=2cbddcebcb9256b3402867282e119dbe61de0b31039325356af3c7d72ed6d058 vendor/bin/test-reporter - matrix: allow_failures: - php: nightly - -#addons: -# code_climate: -# repo_token: 2cbddcebcb9256b3402867282e119dbe61de0b31039325356af3c7d72ed6d058 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e18a7bc4..2a39f112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Changelog +## Version 5 +* Updated PHP requirement to 7.4 +* Added anime history view + ## Version 4.2 * Updated dependencies * Updated PHP requirement to 7.3 +* Added option to automatically set dark mode based on the OS setting ## Version 4.1 * Added optional dark theme diff --git a/Jenkinsfile b/Jenkinsfile index 7fb02a70..c94da53f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,18 +10,6 @@ pipeline { sh 'php composer.phar install --ignore-platform-reqs' } } - stage('PHP 7.3') { - agent { - docker { - image 'php:7.3-alpine' - args '-u root --privileged' - } - } - steps { - sh 'apk add --no-cache git' - sh 'php ./vendor/bin/phpunit --colors=never' - } - } stage('PHP 7.4') { agent { docker { diff --git a/README.md b/README.md index a43e5faa..4bf489cf 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Hummingbird Anime Client -Update your anime/manga list on Kitsu.io and MyAnimeList.net +Update your anime/manga list on Kitsu.io and Anilist -[![Build Status](https://travis-ci.org/timw4mail/HummingBirdAnimeClient.svg?branch=master)](https://travis-ci.org/timw4mail/HummingBirdAnimeClient) +[![Build Status](https://travis-ci.com/timw4mail/HummingBirdAnimeClient.svg?branch=master)](https://travis-ci.com/github/timw4mail/HummingBirdAnimeClient) [![Build Status](https://jenkins.timshomepage.net/buildStatus/icon?job=timw4mail/HummingBirdAnimeClient/develop)](https://jenkins.timshomepage.net/job/timw4mail/HummingBirdAnimeClient/develop) [[Hosted Example](https://list.timshomepage.net)] @@ -31,7 +31,7 @@ Update your anime/manga list on Kitsu.io and MyAnimeList.net ### Requirements -* PHP 7.3+ +* PHP 7.4+ * PDO SQLite or PDO PostgreSQL (For collection tab) * GD extension for caching images diff --git a/app/appConf/routes.php b/app/appConf/routes.php index ba17aa55..6534c171 100644 --- a/app/appConf/routes.php +++ b/app/appConf/routes.php @@ -193,6 +193,16 @@ $routes = [ 'username' => '.*?' ] ], + 'anime_history' => [ + 'controller' => 'history', + 'path' => '/history/anime', + 'action' => 'anime', + ], + 'manga_history' => [ + 'controller' => 'history', + 'path' => '/history/manga', + 'action' => 'manga', + ], // --------------------------------------------------------------------- // Default / Shared routes // --------------------------------------------------------------------- diff --git a/app/bootstrap.php b/app/bootstrap.php index f7638021..02dd99c7 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -4,13 +4,13 @@ * * An API client for Kitsu to manage anime and manga watch lists * - * PHP version 7.3 + * PHP version 7.4 * * @package HummingbirdAnimeClient * @author Timothy J. Warren * @copyright 2015 - 2020 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 4.2 + * @version 5 * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient */ @@ -28,14 +28,15 @@ use Aviat\AnimeClient\Model; use Aviat\Banker\Pool; use Aviat\Ion\Config; use Aviat\Ion\Di\Container; +use Aviat\Ion\Di\ContainerInterface; +use Laminas\Diactoros\{Response, ServerRequestFactory}; use Monolog\Handler\RotatingFileHandler; use Monolog\Logger; -use Zend\Diactoros\{Response, ServerRequestFactory}; // ----------------------------------------------------------------------------- // Setup DI container // ----------------------------------------------------------------------------- -return static function ($configArray = []) { +return static function (array $configArray = []): Container { $container = new Container(); // ------------------------------------------------------------------------- @@ -60,26 +61,20 @@ return static function ($configArray = []) { // ------------------------------------------------------------------------- // Create Config Object - $container->set('config', static function() use ($configArray) { - return new Config($configArray); - }); + $container->set('config', fn () => new Config($configArray)); // Create Cache Object - $container->set('cache', static function($container): Pool { + $container->set('cache', static function(ContainerInterface $container): Pool { $logger = $container->getLogger(); $config = $container->get('config')->get('cache'); return new Pool($config, $logger); }); - // Create List Cache - // Create Aura Router Object - $container->set('aura-router', static function() { - return new RouterContainer; - }); + $container->set('aura-router', fn() => new RouterContainer); // Create Html helper Object - $container->set('html-helper', static function($container) { + $container->set('html-helper', static function(ContainerInterface $container) { $htmlHelper = (new HelperLocatorFactory)->newInstance(); $htmlHelper->set('menu', static function() use ($container) { $menuHelper = new Helper\Menu(); @@ -101,31 +96,23 @@ return static function ($configArray = []) { }); // Create Request/Response Objects - $container->set('request', static function() { - return ServerRequestFactory::fromGlobals( - $_SERVER, - $_GET, - $_POST, - $_COOKIE, - $_FILES - ); - }); - $container->set('response', static function() { - return new Response; - }); + $container->set('request', fn () => ServerRequestFactory::fromGlobals( + $_SERVER, + $_GET, + $_POST, + $_COOKIE, + $_FILES + )); + $container->set('response', fn () => new Response); // Create session Object - $container->set('session', static function() { - return (new SessionFactory())->newInstance($_COOKIE); - }); + $container->set('session', fn () => (new SessionFactory())->newInstance($_COOKIE)); // Miscellaneous helper methods - $container->set('util', static function($container): Util { - return new Util($container); - }); + $container->set('util', fn ($container) => new Util($container)); // Models - $container->set('kitsu-model', static function($container): Kitsu\Model { + $container->set('kitsu-model', static function(ContainerInterface $container): Kitsu\Model { $requestBuilder = new KitsuRequestBuilder(); $requestBuilder->setLogger($container->getLogger('kitsu-request')); @@ -141,7 +128,7 @@ return static function ($configArray = []) { $model->setCache($cache); return $model; }); - $container->set('anilist-model', static function($container): Anilist\Model { + $container->set('anilist-model', static function(ContainerInterface $container): Anilist\Model { $requestBuilder = new Anilist\AnilistRequestBuilder(); $requestBuilder->setLogger($container->getLogger('anilist-request')); @@ -155,39 +142,24 @@ return static function ($configArray = []) { return $model; }); - - $container->set('anime-model', static function($container) { - return new Model\Anime($container); - }); - $container->set('manga-model', static function($container) { - return new Model\Manga($container); - }); - $container->set('anime-collection-model', static function($container) { - return new Model\AnimeCollection($container); - }); - $container->set('manga-collection-model', static function($container) { - return new Model\MangaCollection($container); - }); + $container->set('anime-model', fn ($container) => new Model\Anime($container)); + $container->set('manga-model', fn ($container) => new Model\Manga($container)); + $container->set('anime-collection-model', fn ($container) => new Model\AnimeCollection($container)); + $container->set('manga-collection-model', fn ($container) => new Model\MangaCollection($container)); $container->set('settings-model', static function($container) { - $model = new Model\Settings($container->get('config')); + $model = new Model\Settings($container->get('config')); $model->setContainer($container); return $model; }); // Miscellaneous Classes - $container->set('auth', static function($container) { - return new Kitsu\Auth($container); - }); - $container->set('url-generator', static function($container) { - return new UrlGenerator($container); - }); + $container->set('auth', fn ($container) => new Kitsu\Auth($container)); + $container->set('url-generator', fn ($container) => new UrlGenerator($container)); // ------------------------------------------------------------------------- // Dispatcher // ------------------------------------------------------------------------- - $container->set('dispatcher', static function($container) { - return new Dispatcher($container); - }); + $container->set('dispatcher', fn ($container) => new Dispatcher($container)); return $container; }; diff --git a/app/views/anime/list.php b/app/views/anime/list.php index a6b15374..be69c273 100644 --- a/app/views/anime/list.php +++ b/app/views/anime/list.php @@ -75,20 +75,20 @@ - picture("images/{$link['meta']['image']}", 'svg', [ + img("/public/images/{$link['meta']['image']}", [ 'class' => 'streaming-logo', 'width' => 50, 'height' => 50, 'alt' => "{$link['meta']['name']} logo", - ]); ?> + ]) ?> - picture("images/{$link['meta']['image']}", 'svg', [ + img("/public/images/{$link['meta']['image']}", [ 'class' => 'streaming-logo', 'width' => 50, 'height' => 50, 'alt' => "{$link['meta']['name']} logo", - ]); ?> + ]) ?> diff --git a/app/views/history/anime.php b/app/views/history/anime.php new file mode 100644 index 00000000..4d12b7bf --- /dev/null +++ b/app/views/history/anime.php @@ -0,0 +1,19 @@ +
+ +

No recent watch history.

+ +
+ $item): ?> +
+
picture( + $item['coverImg'], + 'jpg', + ['width' => '110px', 'height' => '156px'], + ['width' => '110px', 'height' => '156px'] + ) ?>
+
+
+ +
+ +
diff --git a/app/views/main-menu.php b/app/views/main-menu.php index 70059648..f38082d3 100644 --- a/app/views/main-menu.php +++ b/app/views/main-menu.php @@ -5,8 +5,8 @@ namespace Aviat\AnimeClient; $whose = $config->get('whose_list') . "'s "; $lastSegment = $urlGenerator->lastSegment(); $extraSegment = $lastSegment === 'list' ? '/list' : ''; -$hasAnime = stripos($_SERVER['REQUEST_URI'], 'anime') !== FALSE; -$hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') !== FALSE; +$hasAnime = stripos($_SERVER['REQUEST_URI'], 'anime') === 1; +$hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') === 1; ?>