From 0387c7d9e55363ef89004bd75b90d2c6b8555af9 Mon Sep 17 00:00:00 2001 From: User Date: Thu, 12 Mar 2026 16:05:56 +0800 Subject: [PATCH] Fix hot reload infinite loop and graceful degradation for Duolingo badge API block --- functions.php | 14 +++++--------- sidebar.php | 5 +++++ style.css | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/functions.php b/functions.php index 9f1fa79..5479acd 100644 --- a/functions.php +++ b/functions.php @@ -522,7 +522,7 @@ function argon_frontend_hot_reload_notice() {
- × + ×

$headers )); - // 如果返回了诸如 401/403 错误(JWT 过期或无效),尝试移除 JWT 重新获取,确保基础连胜可见 - if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) !== 200 && !empty($jwt)) { - unset($headers['Authorization']); - $response = wp_remote_get($url, array( - 'timeout' => 15, - 'headers' => $headers - )); - $jwt = ''; // 标记为无效,后续不请求私有好友连胜数据 + // 如果返回了诸如 401/403 错误,说明可能遭到了 Cloudflare 拦截或者是 JWT 无效 + // 我们直接返回缓存,而不是剥离 JWT 去重试,因为当前服务器 IP 很可能就是被封的 + if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) !== 200) { + return $cached !== false ? $cached : false; } if (is_wp_error($response)) { diff --git a/sidebar.php b/sidebar.php index d3e47ab..6090ec7 100644 --- a/sidebar.php +++ b/sidebar.php @@ -670,6 +670,11 @@ $author_desc = get_option('argon_sidebar_author_description'); > streak + + + + streak + ? diff --git a/style.css b/style.css index 4240342..d4fe54f 100644 --- a/style.css +++ b/style.css @@ -8,7 +8,7 @@ Author URI: https://solstice23.top/ Description: 轻盈、简洁、美观的 Wordpress 主题 -Version: 1.5.1 +Version: 1.5.3 License: GNU General Public License v3.0