From 4cab0a04750c195960ae0fd902981b8cec1ccefa Mon Sep 17 00:00:00 2001 From: Doghole Date: Tue, 6 Jan 2026 01:02:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A2=98=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=80=A7=E3=80=82sketch=20=E5=BD=92=E6=A1=A3=E9=A1=B5=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/qwq/doghouse/service/ThemeService.java | 13 +++++++------ .../templates/blog/sketch/template/archives.html | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/qwq/doghouse/service/ThemeService.java b/src/main/java/me/qwq/doghouse/service/ThemeService.java index dbe9373..3f930f9 100644 --- a/src/main/java/me/qwq/doghouse/service/ThemeService.java +++ b/src/main/java/me/qwq/doghouse/service/ThemeService.java @@ -215,16 +215,12 @@ public class ThemeService { } /** - * 获取当前主题 + * 获取当前主题,若为配置或不存在则取读取到的第一个主题 * @return */ public ThemeInfo getCurrentTheme() { String identity = siteConfig.getThemeIdentity(); - Optional optionalTheme = cachedThemes.stream().filter(theme -> { - return theme.isInternal() || OSUtils.isCaseSensitiveFS() ? - theme.getIdentity().equals(identity): - theme.getIdentity().equalsIgnoreCase(identity); - }).findAny(); + Optional optionalTheme = Optional.ofNullable(getThemeInfo(identity)); return optionalTheme.orElseGet(() -> { ThemeInfo defaultTheme = cachedThemes.get(0); @@ -233,6 +229,11 @@ public class ThemeService { }); } + /** + * 根据 identity 获取指定主题 + * @param identity + * @return + */ public ThemeInfo getThemeInfo(String identity) { Optional optionalTheme = cachedThemes.stream().filter(theme -> { return theme.isInternal() || OSUtils.isCaseSensitiveFS() ? diff --git a/src/main/resources/templates/blog/sketch/template/archives.html b/src/main/resources/templates/blog/sketch/template/archives.html index 9dc9ad4..272e1b0 100644 --- a/src/main/resources/templates/blog/sketch/template/archives.html +++ b/src/main/resources/templates/blog/sketch/template/archives.html @@ -20,8 +20,8 @@ - - + +
@@ -39,7 +39,7 @@ - +