# 支持两步验证以及大量性能优化，Halo 2.12.0 发布

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

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

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

2024 年 02 月 01 日，强大易用的开源建站工具 Halo 正式发布 2.12.0 版本。

在这个版本中，Halo 主要支持了 2FA 认证和模型索引机制，以及其他 40 多项功能优化和问题修复。

## 亮点更新

### 支持索引机制，优化查询效率和内存占用

从 Halo 2.0 开始，我们提供了一种新的模型定义方式，开发者可以非常方便的定义数据模型并进行数据操作。但此机制在数据量达到一定程度时，可能会造成一定的性能问题，反馈到最终使用体验就是数据查询速度慢以及消耗更多的服务器资源。

所以在这个版本中为了解决此问题，我们引入了索引机制。有了此机制之后，在服务内部查询数据或者过滤数据的时候就不再需要扫描全表，可以带来更高的查询效率和更低的资源消耗。

### 支持 2FA 认证

在 2.12 中，我们为系统用户添加了两步验证的功能，并内置了 TOTP 的验证方式。有了这个功能之后，可以更好的保障用户的账户安全。

![](https://www.halo.run/upload/2.12-2fa.png)

配置 TOTP 验证器：

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

登录之后跳转到两步验证的页面：

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

### 编辑器更新

在 2.12 版本中，我们继续为编辑器进行了大量优化和功能更新，

#### 搜索与替换

现在，你可以在编辑器中使用快捷键（Ctrl / Command + F）调出搜索框，可以根据关键词进行文本搜索，同时支持大小写、正则等验证。此外，也支持关键词替换和批量替换。

![](https://www.halo.run/upload/2.12-editor-find-and-replace.png)

#### 图片插入

在这个版本中，我们重构了图片的内容块，现在支持插入图片之后选择图片的来源并上传，也可以从附件库选择。与此同时，优化了粘贴和拖拽图片上传的功能，现在可以及时查看到图片的上传进度，也支持取消上传。

![](https://www.halo.run/upload/2.12-editor-image.png)

上传图片支持显示上传进度，不再是等待上传完成才显示图片：

![](https://www.halo.run/upload/2.12-editor-image-upload.png)

支持替换图片：

![](https://www.halo.run/upload/2.12-editor-image-replace.png)

### 重新发行 Jar 包

从 Halo 2.0 开始，我们推荐使用 Docker 进行部署，并且未提供原生的 Jar 包部署方式，目的是为了提供更加简单快捷和统一的部署方式，这可以一定程度上抹平配置环境带来的差异。但后续收到不少关于仍然需要 Jar 运行方式的反馈，所以从此版本开始重新发行 Jar 包，并提供相关的部署文档。

## 完整更新日志

### 新特性

-   新增自定义模型索引机制，优化查询效率和内存占用。 by [@guqing](https://github.com/guqing) in [#5121](https://github.com/halo-dev/halo/pull/5121)
    
-   支持发布构建产物 halo-x.y.z.jar。 by [@JohnNiang](https://github.com/JohnNiang) in [#5170](https://github.com/halo-dev/halo/pull/5170)
    
-   支持 2FA 认证方式。 by [@JohnNiang](https://github.com/JohnNiang) & [@ruibaby](https://github.com/ruibaby) in [#4737](https://github.com/halo-dev/halo/pull/4737)
    
-   为默认富文本编辑器添加查找与搜索的功能扩展。 by [@LIlGG](https://github.com/LIlGG) in [#5206](https://github.com/halo-dev/halo/pull/5206)
    
-   使用索引功能检索文章以显著降低资源消耗并提供更快、更高效的文章检索体验。 by [@guqing](https://github.com/guqing) in [#5230](https://github.com/halo-dev/halo/pull/5230)
    

### 功能优化

-   为默认富文本编辑器 table 组件渲染后的 html 增加 colgroup 元素与 width 属性。 by [@LIlGG](https://github.com/LIlGG) in [#5176](https://github.com/halo-dev/halo/pull/5176)
    
-   为默认富文本编辑器表格组件增加退格键删除方式。 by [@LIlGG](https://github.com/LIlGG) in [#5163](https://github.com/halo-dev/halo/pull/5163)
    
-   在 Console 和 UC 的页面底部添加 Powered by 信息。 by [@ruibaby](https://github.com/ruibaby) in [#5153](https://github.com/halo-dev/halo/pull/5153)
    
-   在 Console 的概览页面添加使用 H2 数据库的警告。 by [@ruibaby](https://github.com/ruibaby) in [#5072](https://github.com/halo-dev/halo/pull/5072)
    
-   Console 端的用户管理列表支持在地址栏记录筛选条件。 by [@ruibaby](https://github.com/ruibaby) in [#5071](https://github.com/halo-dev/halo/pull/5071)
    
-   当编辑器切换组件中有不可用编辑器时，添加提示。 by [@ruibaby](https://github.com/ruibaby) in [#5070](https://github.com/halo-dev/halo/pull/5070)
    
-   修复 Halo 还未处于准备就绪时访问页面或接口出现“Scheme not found”错误的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#5032](https://github.com/halo-dev/halo/pull/5032)
    
-   添加 Tabbar 组件内容超出时的水平方向滚动指示器。 by [@AeroWang](https://github.com/AeroWang) in [#4979](https://github.com/halo-dev/halo/pull/4979)
    
-   重构编辑器图片块上传逻辑，增加选择文件上传、上传进度条、取消、重试等机制。 by [@LIlGG](https://github.com/LIlGG) in [#5159](https://github.com/halo-dev/halo/pull/5159)
    
-   修改文章编辑角色的显示名称为**文章管理员**。 by [@ruibaby](https://github.com/ruibaby) in [#5224](https://github.com/halo-dev/halo/pull/5224)
    
-   优化角色模板依赖的相关功能，优化文章相关角色的翻译。 by [@ruibaby](https://github.com/ruibaby) in [#5227](https://github.com/halo-dev/halo/pull/5227)
    
-   优化富文本编辑器中表格组件可滚动时的显示效果。 by [@LIlGG](https://github.com/LIlGG) in [#5191](https://github.com/halo-dev/halo/pull/5191)
    
-   优化 Console 左侧菜单的展开逻辑，支持通过点击图标来展开子菜单。 by [@ruibaby](https://github.com/ruibaby) in [#5244](https://github.com/halo-dev/halo/pull/5244)
    
-   优化文章数据的调协过程以降低 Halo 启动时文章的调协耗时同时提高性能和资源利用率。 by [@guqing](https://github.com/guqing) in [#5250](https://github.com/halo-dev/halo/pull/5250)
    
-   为个人中心的文章适配自动保存功能。 by [@LIlGG](https://github.com/LIlGG) in [#5272](https://github.com/halo-dev/halo/pull/5272)
    
-   优化头像上传，防止因为后端服务异常导致无法重新上传。 by [@ruibaby](https://github.com/ruibaby) in [#5270](https://github.com/halo-dev/halo/pull/5270)
    
-   重构 Console 仪表盘中小部件的数据获取方式。 by [@ruibaby](https://github.com/ruibaby) in [#5280](https://github.com/halo-dev/halo/pull/5280)
    
-   为通知类型设置添加 UI 权限判断。 by [@ruibaby](https://github.com/ruibaby) in [#5286](https://github.com/halo-dev/halo/pull/5286)
    

### 问题修复

-   解决默认编辑器表格合并单元格后行丢失的问题。 by [@LIlGG](https://github.com/LIlGG) in [#5166](https://github.com/halo-dev/halo/pull/5166)
    
-   解决在 Firefox 浏览器下的代码块编辑问题。 by [@LIlGG](https://github.com/LIlGG) in [#5140](https://github.com/halo-dev/halo/pull/5140)
    
-   修复个人中心创建新文章时无法上传图片的问题。 by [@ruibaby](https://github.com/ruibaby) in [#5114](https://github.com/halo-dev/halo/pull/5114)
    
-   修复编辑器中无法删除有序/无序列表后空行的问题。 by [@AirboZH](https://github.com/AirboZH) in [#5102](https://github.com/halo-dev/halo/pull/5102)
    
-   解决默认编辑器中具有重名标题时，锚点只会跳转至首个的问题。 by [@LIlGG](https://github.com/LIlGG) in [#5101](https://github.com/halo-dev/halo/pull/5101)
    
-   修复个人中心用户登录方式仅显示解绑问题。 by [@xzyone](https://github.com/xzyone) in [#5079](https://github.com/halo-dev/halo/pull/5079)
    
-   修复 labelSelector 单字符值查询无效的问题。 by [@OnlyTL](https://github.com/OnlyTL) in [#5007](https://github.com/halo-dev/halo/pull/5007)
    
-   修复文章渲染后内容中标题不存在 id 的问题。 by [@LIlGG](https://github.com/LIlGG) in [#4997](https://github.com/halo-dev/halo/pull/4997)
    
-   修复默认编辑器中图片无法等比例拖动放大缩小的问题。 by [@pillar-cat](https://github.com/pillar-cat) in [#4993](https://github.com/halo-dev/halo/pull/4993)
    
-   修复在默认编辑器中无法使用拼音输入法输入标题的问题。 by [@ruibaby](https://github.com/ruibaby) in [#4975](https://github.com/halo-dev/halo/pull/4975)
    
-   解决默认富文本编辑器中表格后的文本选中后无法删除的问题。 by [@LIlGG](https://github.com/LIlGG) in [#5234](https://github.com/halo-dev/halo/pull/5234)
    
-   修复同一个自定义模型构建出的 Scheme 不相等导致无法正确从 SchemeManager 中移除的问题。 by [@guqing](https://github.com/guqing) in [#5245](https://github.com/halo-dev/halo/pull/5245)
    
-   解决编辑器冒泡菜单会被顶部工具栏遮挡的问题。 by [@LIlGG](https://github.com/LIlGG) in [#5246](https://github.com/halo-dev/halo/pull/5246)
    
-   修复当浏览器标签页不活跃时，文章编辑页面的 health 接口没有定时请求的问题。 by [@ruibaby](https://github.com/ruibaby) in [#5266](https://github.com/halo-dev/halo/pull/5266)
    
-   修复摘要中包含特殊字符导致无法解析页面的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#5263](https://github.com/halo-dev/halo/pull/5263)
    
-   修复创建 PAT 之后，点击复制按钮无法复制 token 的问题。 by [@ruibaby](https://github.com/ruibaby) in [#5274](https://github.com/halo-dev/halo/pull/5274)
    
-   优化启动时用户头像获取不到的错误提示。 by [@guqing](https://github.com/guqing) in [#5269](https://github.com/halo-dev/halo/pull/5269)
    
-   修复文章列表的贡献者数据顺序不固定的问题。 by [@guqing](https://github.com/guqing) in [#5279](https://github.com/halo-dev/halo/pull/5279)
    
-   修复个人令牌创建表单中，角色设置显示了非模板角色的问题。 by [@ruibaby](https://github.com/ruibaby) in [#5291](https://github.com/halo-dev/halo/pull/5291)
    
-   解决默认富文本编辑器内容刷新后空白字符丢失的问题。 by [@LIlGG](https://github.com/LIlGG) in [#5292](https://github.com/halo-dev/halo/pull/5292)
    

### 依赖更新

-   升级 Tiptap 相关依赖至 2.1.15。 by [@ruibaby](https://github.com/ruibaby) in [#5173](https://github.com/halo-dev/halo/pull/5173)
    
-   升级 FormKit 的依赖至 [1.4.0](https://formkit.com/changelog#_140)。 by [@ruibaby](https://github.com/ruibaby) in [#5137](https://github.com/halo-dev/halo/pull/5137)
    
-   升级 Uppy 相关的依赖。 by [@ruibaby](https://github.com/ruibaby) in [#5128](https://github.com/halo-dev/halo/pull/5128)
    
-   升级 SpringDoc 至 2.3.0。 by [@JohnNiang](https://github.com/JohnNiang) in [#4987](https://github.com/halo-dev/halo/pull/4987)
    
-   升级依赖 Spring Boot 至 3.2.2。 by [@JohnNiang](https://github.com/JohnNiang) in [#5232](https://github.com/halo-dev/halo/pull/5232)
    
-   升级依赖 Lucene 至 9.9.1。 by [@JohnNiang](https://github.com/JohnNiang) in [#5261](https://github.com/halo-dev/halo/pull/5261)
    
-   升级依赖 Resilience4j 至 2.2.0。 by [@JohnNiang](https://github.com/JohnNiang) in [#5262](https://github.com/halo-dev/halo/pull/5262)
    

### 开发者相关

-   修复开发环境运行 Console 报错的问题。 by [@pillar-cat](https://github.com/pillar-cat) in [#4983](https://github.com/halo-dev/halo/pull/4983)
    
-   重构 Console 和 UC 的菜单生成逻辑，支持配置二级菜单项。 by [@ruibaby](https://github.com/ruibaby) in [#5177](https://github.com/halo-dev/halo/pull/5177)
    
-   导出必要的默认编辑器扩展及工具类。 by [@LIlGG](https://github.com/LIlGG) in [#5104](https://github.com/halo-dev/halo/pull/5104)
    
-   重构 UI 的 Modal 组件，支持通过 v-if 控制是否显示（渲染）。 by [@ruibaby](https://github.com/ruibaby) in [#5078](https://github.com/halo-dev/halo/pull/5078)
    
-   为 Console 提供工具页面和菜单项，方便插件集成。 by [@ruibaby](https://github.com/ruibaby) in [#5252](https://github.com/halo-dev/halo/pull/5252)
    
-   为 Console 和 UC 添加 Vue 社区新的 [Dev Tools](https://github.com/vuejs/devtools-next)。 by [@ruibaby](https://github.com/ruibaby) in [#5134](https://github.com/halo-dev/halo/pull/5134)
