# Halo 2.20 首个 LTS 版本发布

原文：<https://www.halo.run/archives/halo-2.20-lts-released>

Halo 是一款强大易用的开源建站工具，它让你无需太多的技术知识就可以快速搭建一个博客、网站或者内容管理系统。具备可插拔架构、主题套用、富文本编辑器等多重特性，支持用户根据自己的喜好选择不同类型的插件及主题模板来定制化自己的站点功能及外观。让内容创作和发布更加便捷生动。

截至目前（2024 年 Q3 季度），Halo 已经在 Docker Hub 获得了超过 240 万次下载，GitHub Star 数突破 33 k，并拥有一百多名社区贡献者。

2024 年 10 月 14 日，强大易用的开源建站工具 Halo 正式发布 2.20 LTS 版本。

Halo 2.20 包含多项功能更新和问题修复，标志着首个 LTS（长期支持） 版本的诞生。

## ⚠️ 重要提示

-   此版本重构了登录相关的页面，登录入口从 `/console/login` 改为了 `/login`。
    
-   在重构登录页面的过程中，也改动了登录授权相关的逻辑和 API，请在升级之后进行以下操作：
    
    -   升级所有登录认证相关的插件。
        
    -   重新在 **用户 -> 身份认证** 页面启用和排序三方认证方式。
        
    -   **系统设置 -> 用户 -> 短信验证码** 选项已废弃，需要升级之后去 **用户 -> 身份认证** 重新开启。（专业版）
        
    -   **系统设置 -> 用户 -> 默认登录方式** 选项已废弃，需要升级之后去 **用户 -> 身份认证** 中管理，拖动所需登录方式为第一个即可。（专业版）
        
-   角色的 **登录之后默认跳转位置** 设置选项在此版本已移除，建议使用 `/login?redirect_uri=` 代替。
    
-   出于安全考虑，此版本在生产环境下默认禁用了 Basic Auth 的认证方式，如有需要可以通过添加 `halo.security.basic-auth.disabled=false` 启动参数来启用。
    

## 亮点更新

### 重构登录/注册相关页面

在介绍新的登录页面之前，我们要先说明一下为什么要进行重构，在之前的版本中，和登录相关的功能存在以下问题：

1.  之前的版本中，登录注册相关的逻辑完全由 Console 处理，Console 需要处理各种异常情况和重定向，这会导致 Console 的逻辑过重，且影响整个 Console 页面加载性能。
    
2.  各种重定向在 Console 端难以处理且本身在后端有类似的处理逻辑。
    
3.  登录页面加载缓慢，因为依赖于 Console 项目，所以会加载部分使用不上的资源。
    
4.  登录和注册页面现阶段无法扩展，因为登录页面不会加载插件资源（可能会有隐性的安全问题，如果攻击方可以识别到有哪些插件，可以定向利用插件的漏洞），如果交给后端渲染登录页面则可以避免此问题。
    
5.  目前管理端不止 Console，还有 UC（个人中心），如果能提供一个统一的登录页面（/login）可能会更好（避免歧义）。
    
6.  主题无法为登录等页面自定义样式，满足不了部分自定义的场景。
    

基于以上问题，我们在 2.20 版本中彻底重构了登录/注册等页面，现在完全由后端渲染页面和路由。以下是重构之后带来的一些改进：

1.  统一使用 `/login` 页面，更加直观。
    
2.  提升页面加载性能，降低至少 30 倍的资源体积。
    
3.  提升页面的交互逻辑。
    
4.  插件扩展登录方式的方式更加合理。
    
5.  支持通过主题或者插件提供渲染模板，支持主题继承登录相关的模块。
    

#### 加载速度对比

![2.20-login-static-compare-1.png](https://www.halo.run/upload/2.20-login-static-compare-1.png)

**2.19**

![2.20-login-static-compare-2.png](https://www.halo.run/upload/2.20-login-static-compare-2.png)

**2.20**

#### 部分界面预览

![2.20-login.png](https://www.halo.run/upload/2.20-login.png)

**登录**

![2.20-signup.png](https://www.halo.run/upload/2.20-signup.png)

**注册**

![2.20-totp.png](https://www.halo.run/upload/2.20-totp.png)

**两步验证**

![2.20-logout.png](https://www.halo.run/upload/2.20-logout.png)

**退出登录**

![2.20-login-theme.png](https://www.halo.run/upload/2.20-login-theme.png)

**主题继承登录模块**

![2.20-login-theme-2.png](https://www.halo.run/upload/2.20-login-theme-2.png)

**主题自定义样式**

### 个人中心内容管理优化

在 Halo 2.20 中，我们在个人中心中支持了上传和访问自己的附件以及删除自己创建的文章，可以更好地适应多人管理网站的需求。

#### 支持上传和访问自己的附件

![2.20-uc-attachments.png](https://www.halo.run/upload/2.20-uc-attachments.png)

#### 支持删除文章

![2.20-delete-my-posts.png](https://www.halo.run/upload/2.20-delete-my-posts.png)

## **完整更新日志**

### 新特性

-   支持用户在个人中心上传和访问自己的附件（需要具有对应权限）。 by [@guqing](https://github.com/guqing) in [#6731](https://github.com/halo-dev/halo/pull/6731)
    
-   支持在个人中心的文章管理界面删除用户创建的文章。 by [@guqing](https://github.com/guqing) in [#6729](https://github.com/halo-dev/halo/pull/6729)
    
-   重构登录、注册相关的页面。 by [@JohnNiang](https://github.com/JohnNiang) in [#6488](https://github.com/halo-dev/halo/pull/6488)
    
    -   登录、注册相关页面改为由后端渲染页面，提供统一的访问入口。
        
    -   提升页面加载性能。
        
    -   优化登录、注册相关页面的交互逻辑。
        
    -   登录、注册等页面支持通过主题或者插件提供。
        

### 破坏性更新

-   移除角色的 **登录之后默认跳转位置** 设置选项。 by [@ruibaby](https://github.com/ruibaby) in [#6776](https://github.com/halo-dev/halo/pull/6776)
    
-   生产环境下默认禁用 Basic Auth 的认证方式。 by [@guqing](https://github.com/guqing) in [#6689](https://github.com/halo-dev/halo/pull/6689)
    

### 功能优化

-   优化密码输入框的明文切换图标的状态显示。 by [@ruibaby](https://github.com/ruibaby) in [#6800](https://github.com/halo-dev/halo/pull/6800)
    
-   在用户选择组件中不再显示匿名与已删除用户。 by [@LIlGG](https://github.com/LIlGG) in [#6781](https://github.com/halo-dev/halo/pull/6781)
    
-   备份时排除全文索引目录 indices，防止恢复之后因为索引文件问题无法启动。 by [@ruibaby](https://github.com/ruibaby) in [#6753](https://github.com/halo-dev/halo/pull/6753)
    
-   修复文章编辑页面标题输入框中，英文字符可能会被隐藏的问题。 by [@YttriumC](https://github.com/YttriumC) in [#6749](https://github.com/halo-dev/halo/pull/6749)
    
-   优化系统初始化流程以适配新的登录流程。 by [@guqing](https://github.com/guqing) in [#6739](https://github.com/halo-dev/halo/pull/6739)
    
-   为系统默认的存储策略添加保护措施，不允许删除。 by [@ruibaby](https://github.com/ruibaby) in [#6735](https://github.com/halo-dev/halo/pull/6735)
    
-   备份时忽略缩略图目录以减少文件大小。 by [@guqing](https://github.com/guqing) in [#6725](https://github.com/halo-dev/halo/pull/6725)
    
-   代码注入功能忽略对错误页面和登录注册等页面的注入。 by [@guqing](https://github.com/guqing) in [#6709](https://github.com/halo-dev/halo/pull/6709)
    
-   简化页面回收站的页面标题。 by [@ruibaby](https://github.com/ruibaby) in [#6708](https://github.com/halo-dev/halo/pull/6708)
    
-   优化默认编辑器的加载方式，防止出现灰屏闪烁的问题。 by [@ruibaby](https://github.com/ruibaby) in [#6707](https://github.com/halo-dev/halo/pull/6707)
    
-   提升页面访问速度。 by [@guqing](https://github.com/guqing) in [#6706](https://github.com/halo-dev/halo/pull/6706)
    
-   统一空状态界面中操作按钮的风格。 by [@ruibaby](https://github.com/ruibaby) in [#6704](https://github.com/halo-dev/halo/pull/6704)
    
-   支持自动绑定 OAuth2 登录用户。 by [@JohnNiang](https://github.com/JohnNiang) in [#6702](https://github.com/halo-dev/halo/pull/6702)
    
-   修复系统未启动完全时访问页面出错的问题。 by [@guqing](https://github.com/guqing) in [#6700](https://github.com/halo-dev/halo/pull/6700)
    
-   修复文章封面图链接包含空格时主题端会因为生成缩略图错误而无法访问的问题。 by [@guqing](https://github.com/guqing) in [#6698](https://github.com/halo-dev/halo/pull/6698)
    
-   允许通过 `halo.security.basic-auth.disabled=true` 配置来禁用 Basic Auth 认证，在 2.20 版本生产环境下默认禁用了 Basic Auth。 by [@guqing](https://github.com/guqing) in [#6689](https://github.com/halo-dev/halo/pull/6689)
    
-   优化文件类型检测并支持根据文件名作为决策依据。 by [@guqing](https://github.com/guqing) in [#6675](https://github.com/halo-dev/halo/pull/6675)
    
-   新增 API 用于以 JSON 格式获取和更新插件和主题的配置。 by [@guqing](https://github.com/guqing) in [#6661](https://github.com/halo-dev/halo/pull/6661)
    
-   修复 external-url 配置带了尾部斜杠导致邮件通知的查看通知链接无法访问的问题。 by [@guqing](https://github.com/guqing) in [#6660](https://github.com/halo-dev/halo/pull/6660)
    
-   支持利用参数 language 切换地域语言。 by [@JohnNiang](https://github.com/JohnNiang) in [#6658](https://github.com/halo-dev/halo/pull/6658)
    
-   解决重启后可能无法更新附件链接的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6641](https://github.com/halo-dev/halo/pull/6641)
    
-   当存储策略的配置变更后自动触发关联附件的状态（如访问链接等）更新。 by [@guqing](https://github.com/guqing) in [#6639](https://github.com/halo-dev/halo/pull/6639)
    
-   优化根据 URI 生成缩略图时的请求头，修复可能因为无法访问原图导致无法正常生成的问题。 by [@guqing](https://github.com/guqing) in [#6628](https://github.com/halo-dev/halo/pull/6628)
    
-   禁止非管理员回复未通过审核的评论。 by [@guqing](https://github.com/guqing) in [#6622](https://github.com/halo-dev/halo/pull/6622)
    
-   优化 Formkit Select 组件在多选状态下的待选中状态。 by [@LIlGG](https://github.com/LIlGG) in [#6607](https://github.com/halo-dev/halo/pull/6607)
    
-   为 FormKit Select 组件远程查询增加指定 Key 的字段。 by [@LIlGG](https://github.com/LIlGG) in [#6591](https://github.com/halo-dev/halo/pull/6591)
    
-   当生成缩略图时如果原图尺寸小于请求尺寸则返回原图以保持其质量。 by [@guqing](https://github.com/guqing) in [#6582](https://github.com/halo-dev/halo/pull/6582)
    
-   优化模板渲染时所需的内存。 by [@JohnNiang](https://github.com/JohnNiang) in [#6580](https://github.com/halo-dev/halo/pull/6580)
    
-   优化在内存紧张时 Console 端无法加载插件资源的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6573](https://github.com/halo-dev/halo/pull/6573)
    

### 问题修复

-   修复未登录情况下依然能够访问登出页面的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6812](https://github.com/halo-dev/halo/pull/6812)
    
-   修复创建用户表单的用户名长度校验不生效的问题。 by [@ruibaby](https://github.com/ruibaby) in [#6806](https://github.com/halo-dev/halo/pull/6806)
    
-   修复 Code 输入框在模态框（VModal）组件中无法正常全屏显示的问题。 by [@ruibaby](https://github.com/ruibaby) in [#6787](https://github.com/halo-dev/halo/pull/6787)
    
-   为 Code Input 设置默认高度，修复全屏按钮被遮挡的问题。 by [@ruibaby](https://github.com/ruibaby) in [#6785](https://github.com/halo-dev/halo/pull/6785)
    
-   修复恢复备份后可能会因为与恢复之前存在的数据冲突导致无法启动的问题。 by [@guqing](https://github.com/guqing) in [#6701](https://github.com/halo-dev/halo/pull/6701)
    
-   修复部分设备或者浏览器下，输入框中的下划线可能无法正常显示的问题。 by [@ruibaby](https://github.com/ruibaby) in [#6694](https://github.com/halo-dev/halo/pull/6694)
    
-   修复在 FireFox 浏览器下的编辑器中无法通过粘贴文件上传的问题。 by [@ruibaby](https://github.com/ruibaby) in [#6693](https://github.com/halo-dev/halo/pull/6693)
    
-   修复文件上传时类型校验失效的问题。 by [@guqing](https://github.com/guqing) in [#6673](https://github.com/halo-dev/halo/pull/6673)
    
-   修复编辑器中有序列表的样式问题。 by [@ruibaby](https://github.com/ruibaby) in [#6656](https://github.com/halo-dev/halo/pull/6656)
    
-   修复主题端区域和语言解析错误的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6647](https://github.com/halo-dev/halo/pull/6647)
    
-   解决当 FormKit Select 组件中的 options 延迟设置时无法正常回显的问题。 by [@LIlGG](https://github.com/LIlGG) in [#6629](https://github.com/halo-dev/halo/pull/6629)
    
-   修复 FormKit Select 组件中布尔值的显示问题。 by [@LIlGG](https://github.com/LIlGG) in [#6624](https://github.com/halo-dev/halo/pull/6624)
    
-   修复取消用户角色后无法正常渲染用户列表的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6612](https://github.com/halo-dev/halo/pull/6612)
    
-   解决 FormKit Select 组件在值变更时不会发出事件及修改选项值的问题。 by [@LIlGG](https://github.com/LIlGG) in [#6602](https://github.com/halo-dev/halo/pull/6602)
    
-   修复 GIF 缩略图生成只会保留第一帧的问题。 by [@guqing](https://github.com/guqing) in [#6597](https://github.com/halo-dev/halo/pull/6597)
    
-   解决无法为 FormKit Select 组件的选项设置禁用的问题。 by [@LIlGG](https://github.com/LIlGG) in [#6595](https://github.com/halo-dev/halo/pull/6595)
    
-   解决在默认编辑器中添加表格报错的问题。 by [@LIlGG](https://github.com/LIlGG) in [#6587](https://github.com/halo-dev/halo/pull/6587)
    
-   解决 FormKit 选择器回显数据异常的问题。 by [@LIlGG](https://github.com/LIlGG) in [#6571](https://github.com/halo-dev/halo/pull/6571)
    
-   修复重启后无法搜索部分文档的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6570](https://github.com/halo-dev/halo/pull/6570)
    
-   修复仅分配菜单权限时菜单页面报 403 错误的问题。 by [@guqing](https://github.com/guqing) in [#6688](https://github.com/halo-dev/halo/pull/6688)
    
-   修复可配置无效的外部访问地址的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6840](https://github.com/halo-dev/halo/pull/6840)
    
-   修复竖向图片生成缩略图后会丢失方向信息展示为横向图片的问题。 by [@guqing](https://github.com/guqing) in [#6842](https://github.com/halo-dev/halo/pull/6842)
    

### 开发者相关

-   Dialog API 支持传入 uniqueId，以限制同一时间仅打开一个。 by [@ruibaby](https://github.com/ruibaby) in [#6737](https://github.com/halo-dev/halo/pull/6737)
    
-   主题支持通过 `${site.version}` 得到 Halo 版本号。 by [@guqing](https://github.com/guqing) in [#6677](https://github.com/halo-dev/halo/pull/6677)
    
-   支持在插件中操作渲染结果。 by [@JohnNiang](https://github.com/JohnNiang) in [#6670](https://github.com/halo-dev/halo/pull/6670)
    
-   为主题端切换地区语言提供支持。 by [@JohnNiang](https://github.com/JohnNiang) in [#6657](https://github.com/halo-dev/halo/pull/6657)
    
-   支持在主题中通过 Thymeleaf 默认行为实现国际化。 by [@JohnNiang](https://github.com/JohnNiang) in [#6648](https://github.com/halo-dev/halo/pull/6648)
    
-   允许在插件使用 CryptoService 和 RateLimiterRegistry。 by [@JohnNiang](https://github.com/JohnNiang) in [#6638](https://github.com/halo-dev/halo/pull/6638)
    
-   为 FormKit 添加菜单选择输入类型。 by [@ruibaby](https://github.com/ruibaby) in [#6642](https://github.com/halo-dev/halo/pull/6642)
    

### 依赖更新

-   升级编辑器依赖 Tiptap 的版本至 [2.8.x](https://github.com/ueberdosis/tiptap/releases/tag/v2.8.0)。 by [@ruibaby](https://github.com/ruibaby) in [#6777](https://github.com/halo-dev/halo/pull/6777)
    
-   升级依赖 jsoup 至 1.18.1。 by [@JohnNiang](https://github.com/JohnNiang) in [#6765](https://github.com/halo-dev/halo/pull/6765)
    
-   升级依赖 Lucene 至 9.12.0。 by [@JohnNiang](https://github.com/JohnNiang) in [#6763](https://github.com/halo-dev/halo/pull/6763)
    
-   升级依赖 Guava 至 33.3.1-jre。 by [@JohnNiang](https://github.com/JohnNiang) in [#6762](https://github.com/halo-dev/halo/pull/6762)
    
-   升级至 Gradle 8.10.2。 by [@JohnNiang](https://github.com/JohnNiang) in [#6755](https://github.com/halo-dev/halo/pull/6755)
    
-   升级 UI 项目的 Vue 版本至 3.5.x。 by [@ruibaby](https://github.com/ruibaby) in [#6696](https://github.com/halo-dev/halo/pull/6696)
    
-   升级 Spring Boot 至 3.4.0-M3。 by [@JohnNiang](https://github.com/JohnNiang) in [#6687](https://github.com/halo-dev/halo/pull/6687)
    

* * *

## 升级文档

[https://docs.halo.run/category/安装指南](https://docs.halo.run/category/%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97)
