From c8b642be1c76d95bdf9715d404904bf94a720b1d Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 13 Jul 2023 14:17:51 -0400 Subject: [PATCH] Add anilist example config file, and make the interface a bit more helpful --- CHANGELOG.md | 3 +++ app/config/anilist.toml.example | 6 +++++ app/views/settings/_anilist.php | 24 +++++++++++++++++++ app/views/settings/settings.php | 32 ++++--------------------- composer.json | 2 +- src/AnimeClient/Controller/Settings.php | 6 +++-- 6 files changed, 43 insertions(+), 30 deletions(-) create mode 100644 app/config/anilist.toml.example create mode 100644 app/views/settings/_anilist.php diff --git a/CHANGELOG.md b/CHANGELOG.md index da8195a8..3e5d0e01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## Version 5.3 +* Update PHP requirement to 8.2 + ## Version 5.2 * Updated PHP requirement to 8.1 * Updated to support PHP 8.2 diff --git a/app/config/anilist.toml.example b/app/config/anilist.toml.example new file mode 100644 index 00000000..9cf0e997 --- /dev/null +++ b/app/config/anilist.toml.example @@ -0,0 +1,6 @@ +################################################################################ +# Anilist API # +################################################################################ +client_id = "your_client_id" +client_secret = "your_client_secret" +username = "user123" \ No newline at end of file diff --git a/app/views/settings/_anilist.php b/app/views/settings/_anilist.php new file mode 100644 index 00000000..c3b86bcd --- /dev/null +++ b/app/views/settings/_anilist.php @@ -0,0 +1,24 @@ + +

See the wiki to learn how to set up Anilist integration.

+ + checkAuth(); ?> + +

Anilist API Client is Not Authorized.

+ a( + $url->generate('anilist-redirect'), + 'Link Anilist Account', + ['class' => 'bracketed user-btn'] + ) ?> + + get(['anilist', 'access_token_expires']); ?> +

+ Linked to Anilist. Your access token will expire around +

+ + a( + $url->generate('anilist-redirect'), + 'Update Access Token', + ['class' => 'bracketed user-btn'] + ) ?> + + \ No newline at end of file diff --git a/app/views/settings/settings.php b/app/views/settings/settings.php index 16fef5f0..0f4a009c 100644 --- a/app/views/settings/settings.php +++ b/app/views/settings/settings.php @@ -28,29 +28,11 @@ $nestedPrefix = 'config'; />
- - checkAuth(); ?> - -

Not Authorized.

- a( - $url->generate('anilist-redirect'), - 'Link Anilist Account' - ) ?> - - get(['anilist', 'access_token_expires']); ?> -

- Linked to Anilist. Your access token will expire around -

- - a( - $url->generate('anilist-redirect'), - 'Update Access Token', - ['class' => 'bracketed user-btn'] - ) ?> - - - - +
@@ -62,7 +44,3 @@ $nestedPrefix = 'config'; - - - - diff --git a/composer.json b/composer.json index 5e16500a..039a947f 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "laminas/laminas-httphandlerrunner": "^2.6.1", "maximebf/consolekit": "^1.0.3", "monolog/monolog": "^3.0.0", - "php": ">= 8.1.0", + "php": ">= 8.2.0", "psr/http-message": "^1.0.1", "symfony/polyfill-mbstring": "^1.0.0", "symfony/polyfill-util": "^1.0.0", diff --git a/src/AnimeClient/Controller/Settings.php b/src/AnimeClient/Controller/Settings.php index e68ecdad..5842bf55 100644 --- a/src/AnimeClient/Controller/Settings.php +++ b/src/AnimeClient/Controller/Settings.php @@ -57,13 +57,15 @@ final class Settings extends BaseController $auth = $this->container->get('auth'); $form = $this->settingsModel->getSettingsForm(); - $hasAnilistLogin = $this->config->has(['anilist', 'access_token']); + $hasRequiredAnilistConfig = $this->config->has(['anilist', 'client_secret']) && + $this->config->has(['anilist', 'client_id']) && + $this->config->has(['anilist', 'username']); $this->outputHTML('settings/settings', [ 'anilistModel' => $this->anilistModel, 'auth' => $auth, 'form' => $form, - 'hasAnilistLogin' => $hasAnilistLogin, + 'hasRequiredAnilistConfig' => $hasRequiredAnilistConfig, 'config' => $this->config, 'title' => $this->config->get('whose_list') . "'s Settings", ]);