适配Halo 2.20.0及以上版本

detailed:
1.更新主题最低Halo版本要求为>=2.20.0。
2.适配Halo 2.20.0版本的登录退出方式。
3.移除了配置静态资源中的onmicrosoft和cbd选项。
This commit is contained in:
UPToZ 2024-12-17 19:11:23 +08:00
parent ab1ccd77c9
commit 7be697e633
6 changed files with 16 additions and 12 deletions

View File

@ -32,12 +32,20 @@
## 🚨 注意事项(看我看我) ## 🚨 注意事项(看我看我)
1. **建站时间必填** 1. **建站时间必填**
2. 如果安装主题后报错,请仔细查阅<a href="https://gitea.uptoz.cn/UPToZ/halo-theme-hao" target="_blank" rel="noopener noreferrer">主题说明</a> 2. 如果安装主题后报错,请仔细查阅<a href="https://gitea.uptoz.cn/UPToZ/halo-theme-hao" target="_blank" rel="noopener noreferrer">主题说明</a>
<a href="https://gitea.uptoz.cn/UPToZ/halo-theme-hao/releases" target="_blank" rel="noopener noreferrer">更新说明</a> <a href="https://gitea.uptoz.cn/UPToZ/halo-theme-hao/releases" target="_blank" rel="noopener noreferrer">更新说明</a>
3. 建议每次更新主题后重载一次主题配置然后重启Halo以降低旧数据缓存对程序带来的影响。 3. 建议每次更新主题后重载一次主题配置然后重启Halo以降低旧数据缓存对程序带来的影响。
4. 如果遇到问题解决不了,可以提 <a href="https://gitee.com/uptoz/halo-theme-hao/issues" target="_blank" rel="noopener noreferrer">ISSUE</a> 4. 如果遇到问题解决不了,可以提 <a href="https://gitee.com/uptoz/halo-theme-hao/issues" target="_blank" rel="noopener noreferrer">ISSUE</a>
5. `1.0.0`及以上版本需要`Halo`版本>=`2.14.0` 5. `1.0.0`及以上版本需要`Halo`版本>=`2.14.0`
`1.0.3`及以上版本需要`Halo`版本>=`2.20.0`
6. **若安装主题后出现500错误请到主题设置页面将每个设置项都保存一下** 6. **若安装主题后出现500错误请到主题设置页面将每个设置项都保存一下**
7. 此主题`所有版本`必须使用`本地资源`。 7. 此主题`所有版本`必须使用`本地资源`。
### 🔌 插件依赖 ### 🔌 插件依赖

View File

@ -3063,10 +3063,6 @@ spec:
options: options:
- label: 本地 - label: 本地
value: local value: local
- label: onmicrosoft
value: onmicrosoft
- label: cbd
value: cbd
- label: 自定义 - label: 自定义
value: custom value: custom
- $formkit: url - $formkit: url

View File

@ -33,7 +33,7 @@
font-size: 14px; font-size: 14px;
color: var(--heo-card-bg); color: var(--heo-card-bg);
font-weight: bold; font-weight: bold;
top: 10px; top: 7px;
white-space: nowrap; white-space: nowrap;
transition: left 0.5s linear; transition: left 0.5s linear;
visibility: hidden; visibility: hidden;

View File

@ -1,8 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN" th:fragment="layout(content, htmlType, title, head)" xmlns:th="http://www.thymeleaf.org" <html lang="zh-CN" th:fragment="layout(content, htmlType, title, head)" xmlns:th="http://www.thymeleaf.org"
th:with="assets_link=${theme.config.other.staticResource.use == 'onmicrosoft' ? 'https://npm.onmicrosoft.cn/hao-theme-static@' + theme.spec.version +'/templates/assets' : th:with="assets_link=${theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')},
theme.config.other.staticResource.use == 'cbd' ? 'https://cdn.cbd.int/hao-theme-static@' + theme.spec.version +'/templates/assets' :
theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')},
theme_version = ${ theme.config.other.staticResource.use == 'local' ? '?v='+ theme.spec.version : ''}, theme_version = ${ theme.config.other.staticResource.use == 'local' ? '?v='+ theme.spec.version : ''},
isLazyload = ${theme.config.other.vanillaLazyload.enable}, isLazyload = ${theme.config.other.vanillaLazyload.enable},
loadingImg = ${theme.config.other.vanillaLazyload.loadingImg}, loadingImg = ${theme.config.other.vanillaLazyload.loadingImg},

View File

@ -47,13 +47,15 @@
<a class="back-menu-item" rel="external nofollow" target="_blank" href="/console"> <a class="back-menu-item" rel="external nofollow" target="_blank" href="/console">
<span class="back-menu-item-text">控制台</span> <span class="back-menu-item-text">控制台</span>
</a> </a>
<a class="back-menu-item" rel="external nofollow" <a class="back-menu-item" rel="external nofollow" href="/logout">
href="javascript:$.ajax({type: 'post',url:'/logout',headers:{'X-Xsrf-Token':document.cookie.split('; ').find((row) => row.startsWith('XSRF-TOKEN'))?.split('=')[1] || ''},success: function() {window.location.reload();},error: function(xhr, status, error) {console.error('退出登录时发生错误:', error);}});">
<span class="back-menu-item-text">退出登录</span> <span class="back-menu-item-text">退出登录</span>
</a> </a>
</th:block> </th:block>
<!-- <a sec:authorize="isAnonymous()" class="back-menu-item" rel="external nofollow" target="_blank"
href="/console/login"> -->
<a sec:authorize="isAnonymous()" class="back-menu-item" rel="external nofollow" target="_blank" <a sec:authorize="isAnonymous()" class="back-menu-item" rel="external nofollow" target="_blank"
href="/console/login"> href="/login"
onclick="this.href = '/login?redirect_uri=' + encodeURIComponent(window.location.href)">
<span class="back-menu-item-text">登录</span> <span class="back-menu-item-text">登录</span>
</a> </a>
</div> </div>

View File

@ -53,7 +53,7 @@ spec:
settingName: "theme-hao-setting" settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap" configMapName: "theme-hao-configMap"
version: "1.0.3-ce" version: "1.0.3-ce"
require: ">=2.15.0" require: ">=2.20.0"
license: license:
- name: "CC BY-SA 4.0" - name: "CC BY-SA 4.0"
url: "https://gitee.com/uptoz/halo-theme-hao/blob/main/LICENSE" url: "https://gitee.com/uptoz/halo-theme-hao/blob/main/LICENSE"