From ca55deb29e7ec9912da22dec32f13735a8d9252d Mon Sep 17 00:00:00 2001 From: pjaudiomv <34245618+pjaudiomv@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:04:38 -0500 Subject: [PATCH] fixes for bad api keys (#22) --- Dockerfile | 4 ++-- README.md | 3 +++ bmlt-versions.php | 10 +++++----- readme.txt | 7 +++++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 69a592c..a1c97c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM wordpress:6.3.1-php8.2-apache +FROM wordpress:6.4.2-php8.1-apache RUN apt-get update && \ apt-get install -y --no-install-recommends ssl-cert && \ @@ -17,4 +17,4 @@ RUN pecl install xdebug-3.2.2 && docker-php-ext-enable xdebug \ && echo "xdebug.idekey=IDE_DEBUG" >> ${PHP_INI_PATH} EXPOSE 80 -EXPOSE 443 \ No newline at end of file +EXPOSE 443 diff --git a/README.md b/README.md index 0c0cbee..cd36aa4 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,9 @@ This section describes how to install the plugin and get it working. # Changelog += 1.8.1 = +* Better handling for bad API keys. + = 1.8.0 = * Refactored codebase. diff --git a/bmlt-versions.php b/bmlt-versions.php index 8c55cb8..7fd042a 100644 --- a/bmlt-versions.php +++ b/bmlt-versions.php @@ -6,7 +6,7 @@ Description: A simple content generator to display the versions and links of the various BMLT components. Add [bmlt_versions] to a page or a post to generate the list. Author: bmlt-enabled Author URI: https://bmlt.app -Version: 1.8.0 +Version: 1.8.1 Install: Drop this directory into the "wp-content/plugins/" directory and activate it. */ /* Disallow direct access to the plugin file */ @@ -68,7 +68,7 @@ public function bmltVersionsAdminOptionsPage() ?>

BMLT Versions

-

You must activate a GitHub personal access token to use this plugin. Instructions can be found here https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token.

+

You must activate a GitHub personal access token to use this plugin. Instructions can be found here https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token.

Links for documentation are optional and only configured for [bmlt_versions_simple]. You can find all the documentations pages here https://bmlt.app. If inputs are left blank, "View Documentation" link will not display on the front end

@@ -311,12 +311,12 @@ public function githubLatestReleaseInfo($repo) public function githubLatestReleaseVersion($result) { - return $result['tag_name']; + return $result['tag_name'] ?? ''; } public function githubLatestReleaseDate($result) { - return $result['published_at']; + return $result['published_at'] ?? ''; } public function githubReleaseDescription($repo) @@ -343,7 +343,7 @@ public function get($url, $cookies = null) 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0 +bmltVersions', 'Authorization' => "token $gitHubApiKey" ], - 'cookies' => isset($cookies) ? $cookies : null + 'cookies' => $cookies ?? null ]; return wp_remote_get($url, $args); diff --git a/readme.txt b/readme.txt index d4bb536..788253f 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: pjaudiomv, GarrettWeinberg, tempsaint, dgershman Tags: bmlt, meeting list -Tested up to: 6.3.2 -Stable tag: 1.8.0 +Tested up to: 6.4.2 +Stable tag: 1.8.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -45,6 +45,9 @@ This section describes how to install the plugin and get it working. == Changelog == += 1.8.1 = +* Better handling for bad API keys. + = 1.8.0 = * Refactored codebase.