Commit Graph

4652 Commits (694ad26c3f1f076c0f5621ae11f1f69f5df2fd87)

Author SHA1 Message Date
Ryan Wang 24d1d9460c
chore: update repository config for console packages (#4495)
#### What type of PR is this?

/area console
/kind cleanup

#### What this PR does / why we need it:

更新 Console 中 package.json 文件的 repository 设置。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2023-08-28 03:30:14 +00:00
Takagi a28c9a9781
pref: optimize the caching functionality of content editing (#4458)
#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

本 PR 优化了文章、内容编辑时的本地缓存功能,之前内容对于本地缓存的依赖性非常强,因此导致了部分问题,如 #3820 ,本 PR 计划之后本地缓存将仅用于特殊情况下的内容恢复,因此尝试做了如下修改:
1. 当前正在编辑的文章,会在正常模式(切换路由、刷新页面、失去当前窗口焦点、停止编写一定时间均属于正常模式)下进行自动保存后删除本地缓存。
2. 若本地具有缓存,则会在进入编辑页面时,比对一次 content 的 version,若缓存 version 小于线上 version,则抛弃缓存,若一致,则使用缓存。

但经过测试,本 PR 无法解决如下问题:
1. 同时编辑一篇文章时,内容会被覆盖的问题。
2. 对比版本后会抛弃缓存,而实际上应当将本地缓存加入历史版本中。

#### How to test it?

1. 新建一篇文章,编写任意内容,返回文章页查看是否已经具有新的文章,且内容已被保存。
2. 修改一篇文章的内容,然后返回文章页,查看是否不是从缓存中加载。
3. 断网模式下修改一篇文章的内容,然后返回文章页,联网后,再次打开此文章,查看是否显示从缓存中加载。
4. 断网模式下修改一篇文章的内容,然后返回文章页。在另一个浏览器或页面修改此文章并保存后,回到断网页面联网后,查看是否更新为最新内容。

#### Which issue(s) this PR fixes:

Fixes #3820 
Fixes #4223 

#### Does this PR introduce a user-facing change?
```release-note
减少内容编辑对本地缓存依赖,支持内容自动保存至服务端。
```
2023-08-25 16:18:16 +00:00
Ryan Wang 8ad59631b1
chore: bump @halo-dev/richtext-editor version to alpha.30 (#4490)
#### What type of PR is this?

/area console
/kind cleanup
/milestone 2.9.x

#### What this PR does / why we need it:

升级默认编辑器的版本,包含以下修改:

1. 图片支持修改 alt 属性。 https://github.com/halo-sigs/richtext-editor/pull/32
2. 拖拽修改图片大小的时候保持等比例。 https://github.com/halo-sigs/richtext-editor/pull/33
3. 优化在移动端下,编辑器右侧边栏的样式。 https://github.com/halo-sigs/richtext-editor/pull/35
4. 编辑器标题、段落及代码块增加 Tab 快捷键缩进。 https://github.com/halo-sigs/richtext-editor/pull/34

#### Does this PR introduce a user-facing change?

```release-note
升级默认编辑器的版本,包含以下更改:

1. 图片支持修改 alt 属性。 by @GodlessLiu in <https://github.com/halo-sigs/richtext-editor/pull/32>
2. 拖拽修改图片大小的时候保持等比例。 by @GodlessLiu in <https://github.com/halo-sigs/richtext-editor/pull/33>
3. 优化在移动端下,编辑器右侧边栏的样式。 by @ruibaby in <https://github.com/halo-sigs/richtext-editor/pull/35>
4. 编辑器标题、段落及代码块增加 Tab 快捷键缩进。 by @LIlGG in <https://github.com/halo-sigs/richtext-editor/pull/34>
```
2023-08-25 16:14:13 +00:00
Ryan Wang f01e04f5a0
feat: add batch operation feature for plugins (#4482)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.9.x

#### What this PR does / why we need it:

支持对插件进行批量操作。

<img width="577" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/ec3ed727-e151-44d0-8c18-b6ec8a309ea9">

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/4475

#### Special notes for your reviewer:

测试批量对插件进行启用、停用、卸载。

#### Does this PR introduce a user-facing change?

```release-note
Console 端的插件管理支持批量操作。
```
2023-08-25 16:00:13 +00:00
John Niang e40b5d2388
Refine search result by customizing analyzer (#4456)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

- Removes dependency `cn.shenyanchao.ik-analyzer:ik-analyzer:9.0.0` due to no significant effect for searching result.
- Customize our own analyzer with StandardTokenizer, HTMLStripCharFilter and LowerCaseFilterFactory.

Please be aware of that the default field to search has become to `content` instead of `title` + `excerpt` + `content`. If someone wants to search title only, use `title: halo` as query string. For more details, please refer to <https://lucene.apache.org/core/9_5_0/queryparser/org/apache/lucene/queryparser/flexible/standard/StandardQueryParser.html>.

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/4455

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
优化本地搜索引擎
```
2023-08-25 15:46:12 +00:00
Ryan Wang 138ffde7e2
refactor: remove the pagination feature of plugin management (#4473)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.9.x

#### What this PR does / why we need it:

移除插件管理列表的分页功能,默认列表出所有安装的插件。

#### Which issue(s) this PR fixes:

Fixes #4469 

#### Does this PR introduce a user-facing change?

```release-note
移除 Console 端插件管理列表的分页功能,默认列表出所有安装的插件。
```
2023-08-25 15:42:14 +00:00
guqing 401c3c79ce
fix: newly added setting item are not taking effect (#4486)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.9.x

#### What this PR does / why we need it:
修复新增加的配置项默认值没有填充的问题

how to test it?
测试插件和主题新增加的配置项(带默认值)在升级后是否具有默认值

#### Which issue(s) this PR fixes:
Fixes #4377

#### Does this PR introduce a user-facing change?
```release-note
修复新增加的配置项默认值没有填充的问题
```
2023-08-25 15:36:14 +00:00
Ryan Wang 03bf2aea7c
fix: setup state is not set due to an exception when initializing the data (#4484)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.9.x

#### What this PR does / why we need it:

修复因为初始化数据异常导致没有记录初始化状态的问题,这个问题可能会导致失败之后无法再让系统正常访问。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2023-08-25 15:34:14 +00:00
Ryan Wang 63bbd4fa81
Refactor plugin installation modal to support extend (#4461)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.9.x

#### What this PR does / why we need it:

重构插件安装的界面,以支持扩展。

文档:https://github.com/halo-dev/halo/pull/4461/files?short_path=fe4adc6#diff-fe4adc66005d24150478d0919c5f330ee695c2b5657ee7baed56929830c7eb90

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/4432

#### Special notes for your reviewer:

需要测试插件的本地上传和远程下载的安装的更新。

#### Does this PR introduce a user-facing change?

```release-note
重构 Console 端插件安装界面,支持通过插件扩展选项卡。
```
2023-08-25 15:28:12 +00:00
John Niang 7603b21dd2
Support restoring with downloadable URL or backup name (#4474)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

Currently, we only support restoring by uploading backup file. Downloading and uploading larger backup files can be cumbersome for users.

This PR supports restoring with downloadable URL or backup name as well.

#### Special notes for your reviewer:

```bash
# Replace ${BACKUP_NAME} by yourself.
curl -u admin:admin 'http://localhost:8090/apis/api.console.migration.halo.run/v1alpha1/restorations' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary3Al7pC6AbBNfB1js' \
  --data-raw $'------WebKitFormBoundary3Al7pC6AbBNfB1js\r\nContent-Disposition: form-data; name="backupName"\r\n\r\n${BACKUP_NAME}\r\n------WebKitFormBoundary3Al7pC6AbBNfB1js--\r\n'
```

```bash
# Replace ${DOWNLOAD_LINK} by yourself.
curl -u admin:admin 'http://localhost:8090/apis/api.console.migration.halo.run/v1alpha1/restorations' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundarytv6cqgmANkCpSuZm' \
  --data-raw $'------WebKitFormBoundarytv6cqgmANkCpSuZm\r\nContent-Disposition: form-data; name="downloadUrl"\r\n\r\n${DOWNLOAD_LINK}\r\n------WebKitFormBoundarytv6cqgmANkCpSuZm--\r\n'
```

#### Does this PR introduce a user-facing change?

```release-note
新增提供下载链接或者备份名进行系统恢复的功能。
```
2023-08-25 15:22:11 +00:00
guqing 2aeeb3e463
fix: unable to use plugin development mode on Windows systems (#4480)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.9.x

#### What this PR does / why we need it:
修复 Windows 系统上的插件路径问题

how to test it?
1. 在 windows 系统上使用插件生成模式初始化 halo 插件可以正常运行,测试上传插件 jar 升级可以正常运行
2. 测试 windows 系统上使用插件开发模式可以正确运行插件

#### Which issue(s) this PR fixes:
Fixes #4466 

#### Does this PR introduce a user-facing change?
```release-note
修复 Windows 系统上的插件路径问题
```
2023-08-25 15:16:12 +00:00
Ryan Wang e5df695f9d
chore: bump uppy related packages version (#4487)
#### What type of PR is this?

/area console
/kind cleanup
/milestone 2.9.x

#### What this PR does / why we need it:

升级 Console 端上传组件(Uppy)相关依赖的版本。

#### Does this PR introduce a user-facing change?

```release-note
升级 Console 端上传组件(Uppy)相关依赖的版本。
```
2023-08-25 15:10:12 +00:00
Hilary Liu dcddf5a355
fix: avatar component cannot watch data updates (#4459)
#### What type of PR is this?
/kind bug
/area console
/kind improvement

#### What this PR does / why we need it:
当用户对头像进行删除或修改时,文章页面和用户页面的头像会出现显示错误。
#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/4408
Fixes https://github.com/halo-dev/halo/issues/4352

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
修复 Console 端头像组件的图片更新问题
```
2023-08-25 15:06:13 +00:00
Takagi 1d9186c1db
pref: user list supports searching by username (#4451)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

用户列表搜索支持按用户名搜索

#### Which issue(s) this PR fixes:

Fixes #4256 

#### Does this PR introduce a user-facing change?
```release-note
用户列表搜索支持按用户名搜索
```
2023-08-25 15:04:12 +00:00
Hilary Liu 81cafb14bb
fix: style issue of post widget when post title is too long (#4416)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind bug
/area console
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
文章标题过长时,面板“最近文章”会存在日期显示不完整
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes https://github.com/halo-dev/halo/issues/4304

#### Special notes for your reviewer:
目前我的解决方案是将Entity加上一个flex-wrap,这样可以保证日期显示完整,但是这可能导致上下文章的布局结构不统一。不知是否可以采纳。
![image](https://github.com/halo-dev/halo/assets/110895612/45218eaf-7d7c-46ba-80ad-2d646e5b16dd)

#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
用户在仪表板页面为`最近文章`设置的宽度不够时,可以显示创建日期
```
2023-08-25 14:36:12 +00:00
guqing 637071b260
feat: support displaying private posts for owner on theme-side (#4412)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.9.x

#### What this PR does / why we need it:
登录后支持在主题端展示作者的私有文章

how to test it?
1. 测试登录后是否能访问到自己创建的私有文章,退出登录后私有文章消失
2. 不能在在主题端看到别人创建的私有文章
3. 创建私有文章测试登录后使用主题端的上一页下一页功能是否正常

#### Which issue(s) this PR fixes:
Fixes #3016

#### Does this PR introduce a user-facing change?
```release-note
登录后支持在主题端展示作者的私有文章
```
2023-08-25 14:12:12 +00:00
longjuan 5e21909e36
chore: register AttachmentFileTypeIcon component globally (#4489)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind feature
/area console
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
将 AttachmentFileTypeIcon 在 Console 全局进行注册,以在插件中复用此组件。
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes https://github.com/halo-dev/halo/issues/4413

#### Special notes for your reviewer:
我把组件放到 `@/components` 里了,不合适我改回去
#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
None
```
2023-08-25 13:24:11 +00:00
Ryan Wang 7a057679da
refactor: remove the confirmation box of the enable/disable plugin (#4472)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.9.x

#### What this PR does / why we need it:

移除启动/停止插件的确认弹框。

#### Which issue(s) this PR fixes:

Fixes #4471 

#### Special notes for your reviewer:

测试启动和停止插件是否正常工作即可。

#### Does this PR introduce a user-facing change?

```release-note
移除 Console 端启动/停止插件的确认弹框。
```
2023-08-25 09:26:13 +00:00
Ryan Wang 70eb039468
feat: add extension point for extend data list operation items (#4452)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.9.x

#### What this PR does / why we need it:

添加扩展数据列表中操作按钮列表的基础能力,并为文章和插件管理列表的操作按钮列表添加扩展点以测试此扩展能力。

todo:

- [x] 场景测试
- [x] 文档 

#### Which issue(s) this PR fixes:

Ref https://github.com/halo-dev/halo/issues/4177

#### Special notes for your reviewer:

可以使用以下插件进行测试:

- 源码:[plugin-export-md.zip](https://github.com/halo-dev/halo/files/12436956/plugin-export-md.zip)
- 可安装的 JAR 包:[plugin-export-md-1.0.0-SNAPSHOT.jar.zip](https://github.com/halo-dev/halo/files/12436950/plugin-export-md-1.0.0-SNAPSHOT.jar.zip)

安装之后可以在文章列表的操作按钮列表中新增一个 `导出为 Markdown 文档` 的按钮,点击之后会导出一个 Markdown 文档。

<img width="374" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/eb0b7c61-f5c8-4af3-bf13-579681d36097">


#### Does this PR introduce a user-facing change?

```release-note
Console 端的文章和插件列表的操作按钮列表支持扩展。
```
2023-08-25 09:02:12 +00:00
John Niang acb738a8ac
Upgrade Lucene to 9.7.0 (#4479)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

This PR upgrades Lucene to 9.7.0. See: 
- https://lucene.apache.org/core/corenews.html#apache-lucenetm-970-available
- https://lucene.apache.org/core/9_7_0/changes/Changes.html

for more. for more.

#### Does this PR introduce a user-facing change?

```release-note
升级依赖 Lucene 至 9.7.0
```
2023-08-25 08:50:12 +00:00
John Niang 229bcafe71
Upgrade Spring Boot to 3.1.3 (#4478)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

This PR upgrades Spring Boot to 3.1.3. See https://github.com/spring-projects/spring-boot/releases/tag/v3.1.3 for more.

#### Does this PR introduce a user-facing change?

```release-note
升级依赖 Spring Boot 至 3.1.3
```
2023-08-25 08:40:11 +00:00
Ryan Wang 141e22e2c6
feat: add mouse scrolling handler for tabs component (#4453)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.9.x

#### What this PR does / why we need it:

Console 端的 Tabs 组件支持通过鼠标滚动选项卡。

![2023-08-21 16 15 46](https://github.com/halo-dev/halo/assets/21301288/8fa56d4d-04d3-47a5-8515-2caf54ac9258)

#### Which issue(s) this PR fixes:

Fixes #4353 

#### Special notes for your reviewer:

None

#### Does this PR introduce a user-facing change?

```release-note
Console 端的 Tabs 组件支持通过鼠标滚动选项卡。
```
2023-08-25 08:38:15 +00:00
guqing 5c115563e0
feat: add API to obtain the bundled js file for all enabled plugins (#3444)
#### What type of PR is this?
/kind feature
/milestone 2.3.x
/area core
#### What this PR does / why we need it:
提供 `/apis/api.console.halo.run/v1alpha1/plugins/bundle.js` 来获取已启用插件的捆绑后的 main.js 和 style.css 文件

#### Which issue(s) this PR fixes:
Fixes #3442

#### Does this PR introduce a user-facing change?

```release-note
优化已启用插件 jsbundle 文件的加载方式
```
2023-08-25 07:28:11 +00:00
Takagi ec0187d8aa
fix: the search for comments by username yields empty results (#4481)
#### What type of PR is this?

/kind bug
/area console
/milestone 2.9.x

#### What this PR does / why we need it:

Console 评论列表中,使用用户名查询时携带 kind

#### How to test it?

在 Console 端评论列表,选中右上角评论者,进行选择。

#### Which issue(s) this PR fixes:

Fixes #4465 

#### Does this PR introduce a user-facing change?
```release-note
解决评论列表根据评论者条件筛选时为空的问题
```
2023-08-25 06:32:11 +00:00
Hilary Liu 42ef7265c7
feat: store attachment view type to localStorage (#4477)
#### What type of PR is this?
/kind improvement
/kind console

#### What this PR does / why we need it:
修改附件显示模式后,保存状态
#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/4476

#### Does this PR introduce a user-facing change?


```release-note
Console 端附件管理的显示模式支持缓存到浏览器。
```
2023-08-24 14:38:14 +00:00
BugKing ab5c7da66b
docs: add ProductHunt badge in README.md (#4463)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind documentation
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:

Add ProductHunt badge in README.md.

```release-note
NONE
```
2023-08-23 06:28:14 +00:00
John Niang 67a101efeb
Fix the problem that it is always in deleting phase after deleting backups (#4462)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

Before this, if we deleted a backup without filename, the BackupReconciler would get stuck infinitely. And no further backups would be reconciled.

This PR fixes the problem that it is always in deleting phase after deleting backups.

#### Does this PR introduce a user-facing change?

```release-note
修复因备份数据状态不正常导致无法正常删除备份的问题。
```
2023-08-23 04:16:13 +00:00
guqing 3e5e50fea5
fix: incorrect started plugin records obtained from plugin manager (#4454)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.9.x

#### What this PR does / why we need it:
修复从插件管理器中获取已启动插件的记录不正确的问题

由于 PR #4403 优化了 plugin extension 的 status 与内存状态的同步方式,优先级改为以数据库为准但这样状态维护变得复杂,所以此 PR 还是以内存为准但不同的是:
1. 当状态不一致时在 reconciler 中先将数据库的和内存状态都统一为停止状态即调用 haloPluginManager.stopPlugin 然后将停止状态更新到 status 的 phase 上,在继续后续的逻辑
2. 如果在更新 status 失败时加上重试避免因乐观锁而容易导致插件启动或停止成功但 status 更新失败导致的不一致几率问题。

经过上述两点的双重保障,多次测试后暂没有发现状态不一致的场景

how to test it?
1. 多安装几个插件十个以上最好,测试启动后通过 HaloPluginManager 获取已启动插件名称是否与 Console 已启动插件列表一致
```java
haloPluginManager.getStartedPlugins()
```
2. 对于提供了 console 功能的插件不会出现启动成功但 status 的 entry 为空的情况

#### Does this PR introduce a user-facing change?

```release-note
None
```
2023-08-23 03:28:13 +00:00
Ryan Wang 6326ec1d86
refactor: improve plugin upgrade related code to resolve performance issue (#4410)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.9.x

#### What this PR does / why we need it:

优化插件升级相关代码,解决插件管理列表的潜在性能问题。

#### Which issue(s) this PR fixes:

Fixes #4409 

#### Special notes for your reviewer:

需要测试插件安装和升级功能

#### Does this PR introduce a user-facing change?

```release-note
优化 Console 端插件管理列表的性能
```
2023-08-22 08:12:12 +00:00
guqing b437756157
refactor: optimize plugin status updates in plugin reconciler (#4403)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.9.x

#### What this PR does / why we need it:
优化插件 Reconciler 中对 status 的更新

how to test it?
测试插件启动和停止没有问题即可,着重看一下 status 中是否会存在 stylesheet 和 entry 期望有值但却没有值的情况是否会发生

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-08-21 06:46:12 +00:00
XinKeng 8ea397da5c
perf: increasing the editor performance (#4445)
A function to debounce editor updates was added to the DefaultEditor.vue component. This change was necessary to prevent excessive event executions. Now, 'update:raw', 'update:content', and 'update' events will be emitted 250ms after the last update, reducing the number of redundant operations and increasing the editor's performance.

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind improvement

<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
目前默认编辑器在文章内容过多时,会出现输入延迟。
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #4389

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
增强默认编辑器在文章内容过大时的性能。
```
2023-08-20 17:14:12 +00:00
Ryan Wang 43e1e446b6
feat: add reveal button for password input (#4434)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.9.x

#### What this PR does / why we need it:

为 FormKit 的 password 类型输入框添加统一的显示/隐藏明文按钮。

<img width="541" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/2947cef2-258c-434d-9268-c8b5ad26a9f7">


#### Which issue(s) this PR fixes:

Fixes #4382 

#### Special notes for your reviewer:

测试密码输入框的显示隐藏明文按钮是否可以正常使用即可。

#### Does this PR introduce a user-facing change?

```release-note
为 FormKit 的 password 类型输入框添加统一的显示/隐藏明文按钮。
```
2023-08-16 06:38:11 +00:00
Ryan Wang 8678d614e2
chore: bump formkit version to 0.18.0 (#4428)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.9.x

#### What this PR does / why we need it:

升级 FormKit 依赖至 [0.18.0](https://formkit.com/changelog#_0180-beta-18)

修复[升级到 0.17.5](https://github.com/halo-dev/halo/pull/4411) 之后输入框失去焦点之后无法提交的问题。

see https://github.com/halo-dev/halo/issues/4424#issuecomment-1677331547

#### Which issue(s) this PR fixes:

Fixes #4424 

#### Special notes for your reviewer:

需要测试各个输入框是否正常工作。

#### Does this PR introduce a user-facing change?

```release-note
升级 FormKit 的依赖至 0.18.0
```
2023-08-16 03:30:12 +00:00
Ryan Wang 58679b2811
chore: bump vue related packages version (#4427)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.9.x

#### What this PR does / why we need it:

升级 Vue 至 3.3 以及相关的依赖。

see https://blog.vuejs.org/posts/vue-3-3

#### Which issue(s) this PR fixes:

Fixes #4425 

#### Does this PR introduce a user-facing change?

```release-note
升级 Vue 至 3.3 以及相关的依赖。
```
2023-08-16 02:16:25 +00:00
guqing bdb8d10ea0
fix: incorrect scope for haloCommentEnabled template variable (#4385)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.9.x

#### What this PR does / why we need it:
修复评论启用状态的主题模板变量名作用域不正确的问题

评论组件标签处理器只会在处理到 `<halo:comment/>` 自定义标签时被执行,而 haloCommentEnabled 状态是评论标签之前使用的那么此时值还没有被评论标签处理器填充所以取不到正确的值,目前的做法是在模板开始解析时填充 haloCommentEnabled 变量到 context,但这样存在的问题时无法判断页面是否使用了评论自定义标签即每个页面都会有这个变量,不过目前没有更好的办法去解决这样的问题。

how to test it?
在模板页面的任意位置使用 `${haloCommentEnabled}` 都能取到正确的值。

#### Which issue(s) this PR fixes:
Fixes #4378

#### Does this PR introduce a user-facing change?
```release-note
修复评论启用状态的主题模板变量名作用域不正确的问题
```
2023-08-15 10:04:12 +00:00
Takagi bce65c4947
fix: handle external exceptions when uploading files (#4431)
#### What type of PR is this?

/kind bug
/area console
/milestone 2.9.x

#### What this PR does / why we need it:

原先使用 uppy 上传文件时抛出异常时,处理了 Halo 系统内部异常,但并未处理外部抛出的异常,例如反向代理等,因而会导致上传文件时卡在 0% 或者 100%。
更改之后当上传抛出异常时,首先会尝试将异常信息转换为 JSON,如果转换失败,则代表为外部异常,此时会抛出异常信息,异常信息格式为 `status: statusText`。

<img width="1045" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/228a73aa-b22e-40f9-b69d-3180e2f78032">


#### How to test it?

在 Halo 上传接口前增加一层反向代理,并设置最大允许文件值,之后上传超过其值的文件进行尝试,若能够成功抛出异常即可。

#### Which issue(s) this PR fixes:

Fixes #4359 

#### Does this PR introduce a user-facing change?
```release-note
修复上传文件时由于外部异常而导致进度条不变的问题
```
2023-08-15 10:02:12 +00:00
Takagi 6282efbe70
fix: redirection fails after login (#4423)
#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:

对 console 跳转链接进行编码,用于解决跳转链接中如果携带非标准字符而导致的报错

#### How to test it?

本地开发环境:重定向地址无误且进行了 uri 编码即可。

生产环境:
在 console 后端未登录时,前往应用市场输入网站地址进行安装,之后进行登录,查看是否能够正确跳转。

#### Which issue(s) this PR fixes:

Fixes #4351

#### Does this PR introduce a user-facing change?
```release-note
对 console 重定向链接进行编码
```
2023-08-15 09:00:13 +00:00
Takagi 5779f01161
pref: allow annotations value to be empty (#4419)
#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

由于后端 annotation 的值可以为空,而前端则规定 annotation 值为必填项,因此去除前端必填属性。

#### Which issue(s) this PR fixes:

Fixes #4279 

#### Does this PR introduce a user-facing change?
```release-note
将元数据值更改为非必填
```
2023-08-14 14:08:13 +00:00
John Niang 8e3bd7f3d8
Support getting backup root path in plugin (#4422)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

We already support backup and restore feature in Halo 2.8.0, but we cannot obtain backup files through regular channels in the plugin. For example, we want to upload backup files to OSS in the plugin.

This PR is aimed at solving this problem.

#### Does this PR introduce a user-facing change?

```release-note
支持在插件中获取备份文件根目录。
```
2023-08-14 11:38:11 +00:00
Ryan Wang 905e867eb3
chore: bump formkit version to 0.17.5 (#4411)
#### What type of PR is this?

/area console
/kind cleanup
/milestone 2.9.x

#### What this PR does / why we need it:

升级 FormKit 的依赖至 0.17.5

see https://formkit.com/changelog

#### Does this PR introduce a user-facing change?

```release-note
升级 FormKit 的依赖至 0.17.5
```
2023-08-13 14:40:12 +00:00
John Niang c80c5e23c6
Refactor the transformation between data buffers and input stream (#4391)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

Before this, If we use a file with length less than 256KB for recovery, the process remains stagnant until we cancel the request.

This PR refactors the transformation between data buffers and input stream and resolve the issue above. We should avoid returning InputStream directly in reactive stream.

- DataBufferUtils before

    ```java
        public static InputStream toInputStream(Flux<DataBuffer> content) throws IOException {
            var pos = new PipedOutputStream();
            var pis = new PipedInputStream(pos);
            write(content, pos)
                .doOnComplete(() -> {
                    try {
                        pos.close();
                    } catch (IOException ignored) {
                        // Ignore the error
                    }
                })
                .subscribeOn(Schedulers.boundedElastic())
                .subscribe(releaseConsumer(), error -> {
                    if (error instanceof IOException) {
                        // Ignore the error
                        return;
                    }
                    log.error("Failed to write DataBuffer into OutputStream", error);
                });
            return pis;
    ```

- DataBufferUtils after

    ```java
        public static Mono<InputStream> toInputStream(Publisher<DataBuffer> content,
            Scheduler scheduler) {
            return Mono.create(sink -> {
                try {
                    var pos = new PipedOutputStream();
                    var pis = new PipedInputStream(pos);
                    var disposable = write(content, pos)
                        .subscribeOn(scheduler)
                        .subscribe(releaseConsumer(), sink::error, () -> FileUtils.closeQuietly(pos),
                            Context.of(sink.contextView()));
                    sink.onDispose(disposable);
                    sink.success(pis);
                } catch (IOException e) {
                    sink.error(e);
                }
            });
    ```

#### Special notes for your reviewer:

Please test for plugins, themes and migrations.

#### Does this PR introduce a user-facing change?

```release-note
解决备份恢复时因文件小于 256KB 而导致接口卡住的问题。
```
2023-08-12 09:14:11 +00:00
guqing 5690de3f24
refactor: improve the system initialization process (#4306)
* refactor: improve the system initialization process

* Sync api-client

Signed-off-by: Ryan Wang <i@ryanc.cc>

* feat: add initialized state to global info

* Refine setup page ui

Signed-off-by: Ryan Wang <i@ryanc.cc>

* refactor: improve the system initialization process

* Refine setup page ui

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Refine setup page ui

Signed-off-by: Ryan Wang <i@ryanc.cc>

* fix: update with initialize state

* Refactor setup

Signed-off-by: Ryan Wang <i@ryanc.cc>

* refactor: initialization state

* Refactor router guards

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Refine i18n

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Refactor init data

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Refactor init data

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Update console/src/views/system/Setup.vue

Co-authored-by: Takagi <mail@e.lixingyong.com>

* refactor: initialization interface

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: Takagi <mail@e.lixingyong.com>
2023-08-11 09:10:35 +08:00
John Niang 1172f4a98c
Support restarting Halo (#4361)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

Support restarting Halo and enable restart endpoint by default.

Restart endpoint detail:

request uri: `/actuator/restart`
request method: `POST`

Please note that memory usage may slightly increase after restarting Halo.

#### Does this PR introduce a user-facing change?

```release-note
支持在线重启 Halo。
```
2023-08-09 06:04:11 +00:00
John Niang b9b663e124
Move Backup extension into api module (#4392)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.9.x

#### What this PR does / why we need it:

Move Backup extension into api module to share the extension to plugins. 

After this PR is merged, I will publish Halo to maven repository (2.9.0-SNAPSHOT). This way, developers can use the Backup extension in the plugin.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2023-08-09 02:48:11 +00:00
Takagi 3ec409100b
fix: resolve the issue of ineffective duplicate key validation in AnnotationsForm (#4369)
#### What type of PR is this?

/kind bug
/area console

#### What this PR does / why we need it:

在 AnnotationsForm 新增 customAnnotationsDuplicateKey 校验规则,校验自定义元数据中是否具有重复的 key。

#### Which issue(s) this PR fixes:

Fixes #4367 

#### Special notes for your reviewer:

在任意一个使用 AnnotationsForm 的位置,例如`文章设置 - 元数据` 中,新增一个已经存在的 key,查看是否有重复 key 的校验。

#### Does this PR introduce a user-facing change?
```release-note
修复 AnnotationsForm 重复的 key 校验无效的问题。
```
2023-08-08 07:04:12 +00:00
John Niang 20df302ef5
Upgrade to SpringDoc 2.2.0 for OpenAPI 3.1 support (#4384)
#### What type of PR is this?

/kind cleanup

#### What this PR does / why we need it:

This PR upgrades SpringDoc to 2.2.0 for OpenAPI 3.1 support. Please see https://github.com/springdoc/springdoc-openapi/releases/tag/v2.2.0 for more.

#### Special notes for your reviewer:

- Start Halo by using following command:
    ```bash
    ./gradlew bootRun --args="--spring.profiles.active=dev --halo.plugin.runtime-mode=deployment"
    ```
- Try to request <http://localhost:8090/swagger-ui.html> and check if the OpenAPI version is 3.1

#### Does this PR introduce a user-facing change?

```release-note
升级 SpringDoc 至 2.2.0
```
2023-08-08 07:02:12 +00:00
Takagi 9774530abd
fix: add random uuid to resolve the issue of id conflicts (#4371)
#### What type of PR is this?

/kind bug
/area console

#### What this PR does / why we need it:

为 AnnotationsForm 的 formkit 表单 id 增加 uuid 前缀,防止由于一个页面具有多个 AnnotationsForm 时编号互相冲突。

#### Which issue(s) this PR fixes:

Fixes #4368 

#### Special notes for your reviewer:

检查使用 AnnotationsForm 的界面,例如文章、页面设置的元数据处没有出现问题即可。

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-08-04 03:11:48 +00:00
Takagi 9b8b4294e5
pref: scroll to the error location when form submission validation fails (#4358)
#### What type of PR is this?

/kind improvement
/area console

#### What this PR does / why we need it:

为 `Formkit` 添加自动滚动至错误的插件,当表单校验不通过时,如果错误处被隐藏,则会滚动至错误处。

#### Which issue(s) this PR fixes:

Fixes #4317 

#### Special notes for your reviewer:

找到表单中的必选项或其他校验项,尝试填写一个错误的选项。之后滚动表单直到隐藏当前项,此时点击提交,查看是否能够自动滚动至对应的错误项。

#### Does this PR introduce a user-facing change?
```release-note
当表单填写错误时,将会自动滚动至错误项。
```
2023-08-03 07:51:27 +00:00
dependabot[bot] 355fb860e5
chore(deps-dev): bump @antfu/utils from 0.7.2 to 0.7.5 in /console (#4363)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-03 15:37:16 +08:00
Takagi 2ee51b0c56
fix: resolve the issue of users being able to delete themselves. (#4355)
#### What type of PR is this?

/kind bug
/area console

#### What this PR does / why we need it:

在用户列表中,禁止用户选中自己,以解决用户能够进行视觉上自我删除的 bug。

<img width="1636" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/d95f7cf5-cfea-49fa-8f68-d13c46bc88c1">

#### Which issue(s) this PR fixes:

Fixes #4350 

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
在用户列表中禁用选中当前用户
```
2023-08-03 07:23:32 +00:00