Commit Graph

4597 Commits (f37fcb18fa893d23f35b0f8b39a0a12960e92a29)

Author SHA1 Message Date
Ryan Wang ebe77ad697
chore: bump console version to prepare release 2.8 (#4341)
#### What type of PR is this?

/kind cleanup

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

修改 Console 以及其下 packages 的版本号,发布 Halo 2.8

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

```release-note
None
```
2023-08-01 02:48:16 +00:00
Ryan Wang 370b44f9b5
fix: not reset permission after cloning a role (#4333)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

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

修复创建角色时,如果基于某个角色创建,实际权限可能不会更新的问题。

#### Special notes for your reviewer:

需要测试:

1. 基于超级管理员创建新角色。
2. 取消勾选一些角色模板。
3. 测试此角色是否存在取消了勾选的角色模板。

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

```release-note
修复创建角色时,如果基于某个角色创建,实际权限可能不会更新的问题。
```
2023-08-01 02:46:20 +00:00
知雨 81e985f2af
chore: update zh-tw translation for refresh search engine operation (#4335)
#### What type of PR is this?

/kind improvement
/area console
/milestone 2.8.x

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

优化刷新搜索引擎索引的文案。

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


```release-note
优化刷新搜索引擎索引的文案。
```
2023-08-01 02:32:17 +00:00
知雨 181420be7a
chore: update zh-cn translation for refresh search engine operation (#4334)
#### What type of PR is this?

/kind improvement
/area console
/milestone 2.8.x

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

优化刷新搜索引擎索引的文案。

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


```release-note
优化刷新搜索引擎索引的文案。
```
2023-08-01 02:30:19 +00:00
Erzbir 897b603ea9
fix: page does not refresh or get wrong page when turn page (#4331)
#### What type of PR is this?

/kind bug
/area console

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

在预览附件时点击 "下一个" 或者 "上一个", 如果这时翻页, 预览页面可能不会刷新, 也可能刷新到其他非预料中的页面

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

Fixes #4330

#### Special notes for your reviewer:
1. 准备附件测试翻页
2. 在第一页的最后一个附件预览中点击 "next", 观察是否正常
3. 在第二页的第一个附件预览中点击 "pre", 观察是否正常

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

```release-note
预览附件点击 "下一个" 或者 "上一个" 翻页后, 预览页面不正常刷新
```
2023-07-31 03:42:40 +00:00
Erzbir 8e0538e0d0
fix: click "next" on the last attachment will get null (#4328)
#### What type of PR is this?

/kind bug
/area console
/milestone 2.8.x

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

修复在最后一个附件点击 "下一个" 时, 附件库内容全部消失或得到一个 "空" 附件, 且不能 "往前"

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

Fixes #4326

#### Special notes for your reviewer:
1. 上传附件
2. 一直点击 "下一个" 直到最后一张
3. 在最后一张再点击下一个, 观察页面是否出现异常, 正常情况下会停在最后一个附件上且页面不会有刷新

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

```release-note
修复 Console 端在最后一个附件点击下一项按钮时得到空结果的问题。
```
2023-07-29 09:12:18 +00:00
John Niang 5a18adcdd0
Prepare for releasing 2.8.0-rc.2 (#4323)
#### What type of PR is this?

/kind cleanup

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

Bump version of console to 2.8.0-rc.2.

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

```release-note
None
```
2023-07-28 07:17:18 +00:00
Ryan Wang 38664d45ef
refactor: remove the duplicate button to create a backup (#4322)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

移除备份列表空状态的创建备份按钮,防止出现多个创建的按钮。

<img width="1669" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/2f79c05e-090d-4318-bd91-07680bb881be">

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

```release-note
None 
```
2023-07-28 03:33:09 +00:00
Ryan Wang 02c47f552a
refactor: refactor pagination component to support display total items (#4303)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

重构 Console 的分页组件,以支持显示数据总条数。

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

Fixes #4268 

#### Special notes for your reviewer:

需要测试:

- 测试各个页面的分页功能是否正常

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

```release-note
重构 Console 的分页组件,以支持显示数据总条数。
```
2023-07-28 03:15:08 +00:00
Ryan Wang 4733008e16
fix: content cache was not cleaned up after the new post was saved (#4316)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

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

修复新建文章发布或者保存之后,浏览器中的内容缓存没有清空的问题。

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

Fixes #4310 

#### Special notes for your reviewer:

需要测试:

1. 新建一篇文章,测试未保存到服务器时,刷新浏览器,观察内容是否还存在。
2. 保存之后,再次新建文章,观察编辑器是否没有内容。

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

```release-note
修复新建文章发布或者保存之后,浏览器中的内容缓存没有清空的问题。
```
2023-07-28 03:09:09 +00:00
John Niang 54925efdd4
Remove route when single pages become unpublished (#4318)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.8.x

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

- Remove route when single pages become unpublished
- Add some unit tests against the change.

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

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

#### Special notes for your reviewer:

1. Create a single page with slug name `about.html` and publish it.
2. Create a static file `about.html` into static folder`${halo.work-dir}/static/`.
3. Try to request <http://localhost:8090/about.html> and check the result.
4. Unpublish the single page and then do the step 3 again.

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

```release-note
修复页面取消发布后访问仍然出现页面未找到错误。
```
2023-07-28 03:05:09 +00:00
John Niang 576a3763fd
Add error prompt when downloading backup files that do not exist (#4298)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.8.x

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

Currently, we have not process the deletion of backup files when downloading theme. This PR will handle the situation.

Please see the example result:

```bash
curl -s -u admin:admin -H "Accept-Language: zh" http://localhost:8090/apis/api.console.migration.halo.run/v1alpha1/backups/backup-waELO/files/20230725225726-backup-waELO.zip | jq .
{
  "type": "about:blank",
  "title": "资源不存在",
  "status": 404,
  "detail": "备份文件不存在或已删除。",
  "instance": "http://localhost:8090/apis/api.console.migration.halo.run/v1alpha1/backups/backup-waELO/files/20230725225726-backup-waELO.zip",
  "requestId": "8654fdc6-1478",
  "timestamp": "2023-07-25T15:26:56.771260Z"
}
```

```bash
curl -s -u admin:admin -H "Accept-Language: en" http://localhost:8090/apis/api.console.migration.halo.run/v1alpha1/backups/backup-waELO/files/20230725225726-backup-waELO.zip | jq .
{
  "type": "about:blank",
  "title": "Resource Not Found",
  "status": 404,
  "detail": "The backup file does not exist or has been deleted.",
  "instance": "http://localhost:8090/apis/api.console.migration.halo.run/v1alpha1/backups/backup-waELO/files/20230725225726-backup-waELO.zip",
  "requestId": "4f58e158-1480",
  "timestamp": "2023-07-25T15:27:18.451308Z"
}
```

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

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

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

```release-note
None
```
2023-07-28 03:03:09 +00:00
Ryan Wang e0d79cc2b2
fix: user detail page switching does not take effect (#4321)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

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

修复用户详情页面切换用户之后,数据不更新的问题。操作路径:

1. 进入任意一个用户的资料页面。
2. 点击左下角当前登录用户的个人资料。

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

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

#### Special notes for your reviewer:

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

```release-note
修复用户详情页面切换用户之后,数据不更新的问题。
```
2023-07-28 02:57:10 +00:00
Ryan Wang eced9365a2
fix: unable to expand the replies list of the comment (#4305)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

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

修复评论有新回复时,无法展开回复列表的问题。

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

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

#### Special notes for your reviewer:

需要测试:

1. 选中任意一个评论,尝试进行回复。
2. 点击回复按钮打开回复列表,观察是否能够正常打开。

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

```release-note
修复 Console 的评论有新回复时,无法展开回复列表的问题。
```
2023-07-28 02:35:09 +00:00
Ryan Wang 57ec43bedc
feat: add download tips in plugin and theme installation modal (#4314)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

在安装主题和插件的界面中添加下载源的提示。

<img width="631" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/f28d0f24-8c65-4589-a5c0-32fea3a2bd2b">

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

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

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

```release-note
在安装主题和插件的界面中添加下载源的提示。
```
2023-07-28 02:21:09 +00:00
John Niang 150e9975ba
Suppress compilation warnings and remove deprecated method and classes (#4308)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.8.x

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

- Suppress compilation warnings.
- Remove deprecated methods and classes.
- Remove unused methods.

- Before
    ```bash
    ❯ ./gradlew compileJava compileTestJava
    
    > Task :application:compileJava
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/core/extension/reconciler/ThemeReconciler.java:48: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
        private final ThemePathPolicy themePathPolicy;
                      ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/core/extension/reconciler/ThemeReconciler.java:48: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
        private final ThemePathPolicy themePathPolicy;
                      ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/core/extension/reconciler/ThemeReconciler.java:48: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
        private final ThemePathPolicy themePathPolicy;
                      ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/core/extension/reconciler/ThemeReconciler.java:48: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
        private final ThemePathPolicy themePathPolicy;
                      ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/core/extension/reconciler/ThemeReconciler.java:48: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
        private final ThemePathPolicy themePathPolicy;
                      ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/core/extension/reconciler/ThemeReconciler.java:60: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
            themePathPolicy = new ThemePathPolicy(haloProperties.getWorkDir());
                                  ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/config/WebServerSecurityConfig.java:64: warning: [removal] authorizeExchange() in ServerHttpSecurity has been deprecated and marked for removal
                .authorizeExchange().anyExchange()
                ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/config/WebServerSecurityConfig.java:65: warning: [removal] and() in ServerHttpSecurity.AuthorizeExchangeSpec has been deprecated and marked for removal
                .access(new RequestInfoAuthorizationManager(roleService)).and()
                                                                         ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/config/WebServerSecurityConfig.java:88: warning: [removal] authorizeExchange() in ServerHttpSecurity has been deprecated and marked for removal
                .authorizeExchange().anyExchange().permitAll().and()
                ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/config/WebServerSecurityConfig.java:88: warning: [removal] and() in ServerHttpSecurity.AuthorizeExchangeSpec has been deprecated and marked for removal
                .authorizeExchange().anyExchange().permitAll().and()
                                                              ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/config/WebServerSecurityConfig.java:90: warning: [removal] headers() in ServerHttpSecurity has been deprecated and marked for removal
                .headers()
                ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/config/WebServerSecurityConfig.java💯 warning: [removal] cache() in ServerHttpSecurity.HeaderSpec has been deprecated and marked for removal
                .cache().disable().and()
                ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/config/WebServerSecurityConfig.java💯 warning: [removal] and() in ServerHttpSecurity.HeaderSpec has been deprecated and marked for removal
                .cache().disable().and()
                                  ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/security/CsrfConfigurer.java:24: warning: [removal] csrf() in ServerHttpSecurity has been deprecated and marked for removal
            http.csrf().csrfTokenRepository(CookieServerCsrfTokenRepository.withHttpOnlyFalse())
                ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/security/authorization/DefaultRuleResolver.java:58: warning: [removal] visitRulesFor(UserDetails,RuleAccumulator) in AuthorizationRuleResolver has been deprecated and marked for removal
        public void visitRulesFor(UserDetails user, RuleAccumulator visitor) {
                    ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/security/authorization/DefaultRuleResolver.java:43: warning: [removal] rulesFor(UserDetails) in AuthorizationRuleResolver has been deprecated and marked for removal
        public PolicyRuleList rulesFor(UserDetails user) {
                              ^
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/extension/ReactiveExtensionClientImpl.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    16 warnings
    
    > Task :application:compileTestJava
    /Users/johnniang/workspaces/halo-dev/halo/application/src/test/java/run/halo/app/core/extension/reconciler/ThemeReconcilerTest.java:90: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
            final ThemePathPolicy themePathPolicy = new ThemePathPolicy(testWorkDir);
                  ^
    /Users/johnniang/workspaces/halo-dev/halo/application/src/test/java/run/halo/app/core/extension/reconciler/ThemeReconcilerTest.java:90: warning: [removal] ThemePathPolicy in run.halo.app.theme has been deprecated and marked for removal
            final ThemePathPolicy themePathPolicy = new ThemePathPolicy(testWorkDir);
                                                        ^
    Note: /Users/johnniang/workspaces/halo-dev/halo/application/src/test/java/run/halo/app/security/authorization/RequestInfoResolverTest.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: /Users/johnniang/workspaces/halo-dev/halo/application/src/test/java/run/halo/app/migration/BackupReconcilerTest.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 warnings
    ```
- After

    ```bash
    ❯ ./gradlew clean compileJava compileTestJava
    
    > Task :api:compileJava
    /Users/johnniang/workspaces/halo-dev/halo/api/src/main/java/run/halo/app/extension/Unstructured.java:69: warning: This field does not exist, or would have been excluded anyway.
        @EqualsAndHashCode(exclude = "version")
                                     ^
    Note: /Users/johnniang/workspaces/halo-dev/halo/api/src/main/java/run/halo/app/extension/Unstructured.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 warning
    
    > Task :application:compileJava
    Note: /Users/johnniang/workspaces/halo-dev/halo/application/src/main/java/run/halo/app/plugin/SpringExtensionFactory.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    
    > Task :api:compileTestJava
    Note: /Users/johnniang/workspaces/halo-dev/halo/api/src/test/java/run/halo/app/infra/utils/JsonUtilsTest.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    
    BUILD SUCCESSFUL in 7s
    22 actionable tasks: 15 executed, 7 up-to-date
    ```

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

```release-note
None
```
2023-07-27 08:59:19 +00:00
Ryan Wang f3d7e856ac
feat: add a link back to the site on the login page (#4262)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.8.0

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

在登录页面添加返回到前台的链接。


<img width="506" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/31c6311d-7153-4028-b2dd-78d89e018bf3">



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

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

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

```release-note
在 Console 的登录页面添加返回到前台的链接。
```
2023-07-27 04:34:12 +00:00
Takagi 4f1537b68f
pref: internationalize the avatar processing toolbar (#4313)
#### What type of PR is this?

/kind improvement

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

对头像处理组件的 toolbar 进行国际化处理。

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

Fixes #4296 

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-07-27 04:12:13 +00:00
Takagi a5bace37ee
fix: resolve the issue of missing old avatar (#4293)
#### What type of PR is this?

/kind bug
/area core

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

解决 #4253  所导致的用户旧头像被删除的问题。

#### Special notes for your reviewer:

1. 使用 2.7.x 之前的 Halo 版本,新建用户并设置其头像。
2. 升级 Halo 至 2.8.0-rc.1 
3. 头像还存在即可。
4. 测试头像上传、移除功能是否正常可用。

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

```release-note
None
```
2023-07-27 03:48:13 +00:00
Ryan Wang cf9a9e8a6d
feat: refine restore completed tips i18n (#4301)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

完善备份恢复界面的 i18n。

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

```release-note
None
```
2023-07-26 08:00:19 +00:00
Ryan Wang a617ea164c
feat: require confirmation before restoring backup (#4300)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

在恢复备份的界面,改为需要先点击开始恢复按钮再显示上传区域。

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

Fixes #4295 

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

```release-note
None 
```
2023-07-26 06:44:23 +00:00
Ryan Wang 25725e520e
feat: add showCancel prop for dialog component (#4302)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

为 Dialog 组件添加 showCancel 属性用于控制是否显示取消按钮,某些场景下 Dialog 只是用于提示切必须点击确定。

此外,还对以下位置做了对应修改:

1. 进入文章编辑时检查编辑器是否存在的弹框,只允许点击确定并返回。
2. 备份恢复完成之后点击确定关闭 Halo。

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

```release-note
Console 端的 Dialog 组件添加 showCancel 属性用于控制是否显示取消按钮。
```
2023-07-26 06:42:19 +00:00
Ryan Wang cfe77c5ded
chore: release 2.8.0-rc.1 (#4290)
#### What this PR does / why we need it:

修改版本号,发布 2.8.0-rc.1

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

```release-note
None
```
2023-07-24 12:48:15 +00:00
Ryan Wang f56de041b4
chore: bump default editor version to 27 (#4288)
#### What type of PR is this?

/area console
/area editor
/milestone 2.8.x
/kind feature

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

升级默认编辑器以支持:

1. 重构 Block 操作区域逻辑,防止误操作。 Fixes https://github.com/halo-dev/halo/issues/4164
2. 支持设置文字背景颜色和字体颜色。
3. iframe block 支持主动刷新页面。 https://github.com/halo-dev/halo/issues/4227
4. 在顶部工具栏的区域添加工具箱。
5. 支持设置字体大小。

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

```release-note
升级默认编辑器版本,支持设置字体颜色、大小等功能,优化使用体验。
```
2023-07-24 12:46:14 +00:00
Ryan Wang 6fa442de98
chore: bump default theme version to 1.5.0 (#4289)
#### What type of PR is this?

/area theme
/milestone 2.8.x

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

升级默认主题版本至 1.5.0

https://github.com/halo-dev/theme-earth/releases/tag/v1.5.0

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

```release-note
None
```
2023-07-24 10:18:15 +00:00
guqing bf1be64959
refactor: conditionally render comment for theme (#4271)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.8.x
/area theme

#### What this PR does / why we need it:
按条件渲染评论组件以简化主题端对评论组件是否显示的条件控制

使用了评论标签的模板页面都能直接使用 `${haloCommentEnabled}` 取值能得到评论组件是否可见的结果为`true/false` 用于在需要级联条件渲染的组件上使用,如:

```html
<!-- 评论组件不可见时不渲染标题 -->
<p th:if="${haloCommentEnabled}">评论</p>
<halo:comment />
```

how to test it?
在主题端未加渲染条件时:
1. 测试全局评论组件是否开启的设置是否有效
2. 测试文章和自定义页面是否开启评论的设置是否有效
3. 测试评论组件启用和停止时评论组件的渲染是否正确
4. 测试 `${haloCommentEnabled}` 结果是否正确

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

#### Does this PR introduce a user-facing change?
```release-note
按条件渲染评论组件以简化主题端对评论组件是否显示的条件控制
```
2023-07-24 09:38:14 +00:00
John Niang 4505fcfd16
Support extending username password authentication (#4265)
#### What type of PR is this?

/kind feature
/area core
/area plugin

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

Plugin developers are able to define own UsernamePasswordAuthenticationManager to take charge of username password authentication. 

1. If the manager fails to handle, the default authentication manager will be used.
2. If the manager returns `Mono.empty()`, the default authentication manager will be used.

For example:

```java
@Component
public class LdapAuthenticationManager
    extends UserDetailsRepositoryReactiveAuthenticationManager
    implements UsernamePasswordAuthenticationManager {

    public LdapAuthenticationManager(ReactiveUserDetailsService userDetailsService) {
        super(userDetailsService);
    }

    @Override
    protected Mono<UserDetails> retrieveUser(String username) {
        return super.retrieveUser(username);
    }
}
```

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

See https://github.com/halo-dev/halo/issues/4207#issuecomment-1643042348 for more.

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

```release-note
提供用户名密码认证扩展
```
2023-07-24 09:26:14 +00:00
John Niang 0d19ccdb8a
Delete file already wrote partially into attachment folder when content is terminated with an error (#4286)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.8.x

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

If content is terminated with an error, the file already wrote partially into attachment folder won't be cleaned.

Imagine a scenario where we check that the content size is not larger than 2MB when we write content to the attachments folder. Once the limit is reached, files that have been partially written should be cleaned instead of being kept.

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

```release-note
None
```
2023-07-24 09:22:15 +00:00
John Niang 15dd7826dc
Bump plugin preset (#4287)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.8.x

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

Bump plugin preset. See https://github.com/halo-sigs/plugin-comment-widget/releases/tag/v1.7.0 for more.

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

```release-note
None
```
2023-07-24 09:08:14 +00:00
John Niang bd912c36b9
Support backup and restore (#4206)
#### What type of PR is this?

/kind feature
/area core

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

See 9921deb076/docs/backup-and-restore.md for more.

<img width="1906" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/41531186-d305-44fd-8bdc-30df9b71af43">
<img width="1909" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/3d7af1b9-37ad-4a40-9b81-f15ed0f1f6e8">


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

Fixes https://github.com/halo-dev/halo/issues/4059
Fixes https://github.com/halo-dev/halo/issues/3274

#### Special notes for your reviewer:

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

```release-note
支持备份和恢复功能。
```
2023-07-24 08:26:16 +00:00
John Niang 5ce47190fa
Support resolving static resources at halo work directory (#4285)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.8.x

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

Support resolving static resources at halo work directory `${halo.work-dir}/static/`.

Please note that we only support adding static resources at hand by logging in the server.

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

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

#### Special notes for your reviewer:

1. Create a file `index.html` at `${halo.work-dir}/static`
2. Edit the file with any content
3. Browse with `http://localhost:8090/index.html`

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

```release-note
支持静态资源映射
```
2023-07-24 08:24:34 +00:00
guqing 9bea5ef1c9
fix: inconsistency status occurred during plugin startup due to optimistic locking conflict (#4275)
#### What type of PR is this?
/kind improvement
/area core
/area plugin
/milestone 2.7.x

#### What this PR does / why we need it:
修复插件启动成功但更新数据失败而导致插件状态不符合预期的问题

how to test it?
1. 安装一个带 console 页面的插件并停用它
2. 使用 IDEA 在 doStart 方法最后更新数据的地方也就是 834e37cf13/application/src/main/java/run/halo/app/core/extension/reconciler/PluginReconciler.java (L447) 处打断点,suspend 勾选为 Thread
	<img width="404" alt="image" src="https://github.com/halo-dev/halo/assets/38999863/ead0ad2c-65a9-41aa-b2b1-f4fdbc2d2edf">
3. 启用插件,会执行到断点处
4. 使用如下命令更新数据将 status 删除以模拟乐观锁冲突并清除 status 状态排除干扰
```shell
curl -u admin:admin -X PUT http://localhost:8090/apis/plugin.halo.run/v1alpha1/plugins/{name} --data '替换为 plugin 的 json '
```
5. 放行端点

根据上述步骤先在 main 分支浮现然后在切换到此 PR 对比结果,期望插件的状态为启动成功且 status 数据示例如下:
conditions 有两条会因为乐观锁更新失败一次且entry和stylesheet都有值
```json
{
        "phase": "STARTED",
        "conditions": [
            {
                "type": "STARTED",
                "status": "TRUE",
                "lastTransitionTime": "2023-07-21T07:46:01.274211Z",
                "message": "Started successfully",
                "reason": "STARTED"
            },
            {
                "type": "FAILED",
                "status": "FALSE",
                "lastTransitionTime": "2023-07-21T07:46:01.248001Z",
                "message": "Failed to update table [extensions]; Version does not match for row with Id [/registry/plugin.halo.run/plugins/PluginBytemd]",
                "reason": "UnexpectedState"
            }
        ],
        "lastStartTime": "2023-07-21T07:46:01.273625Z",
        "entry": "/plugins/PluginBytemd/assets/console/main.js?version=1.1.0-SNAPSHOT",
        "stylesheet": "/plugins/PluginBytemd/assets/console/style.css?version=1.1.0-SNAPSHOT",
        "logo": "/plugins/PluginBytemd/assets/logo.png?version=1.1.0-SNAPSHOT",
        "loadLocation": "file:///Users/guqing/Development/halo-sigs/plugin-bytemd/"
    }
```

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

#### Does this PR introduce a user-facing change?
```release-note
修复插件启动成功但更新数据失败而导致插件状态不符合预期的问题
```
2023-07-24 08:22:42 +00:00
Takagi 84093d8db0
feat: add support for user avatar upload (#4253)
#### What type of PR is this?

/kind improvement
/area console
/area core

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

此 PR 对用户头像上传的方式进行了重构,移除了原有的头像链接及上传至附件库的方案。允许具有用户管理权限的用户对其他用户的头像进行修改和移除。

Core: 
新增了 `/apis/api.console.halo.run/v1alpha1/users/-/avatar` 的 `POST` 以及 `DELETE` 接口,用来上传用户的头像及删除当前用户的头像。

Console:
新增对用户头像进行裁剪的功能,并调用上传接口保存用户头像。

需等待 #4247 合并

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

Fixes #2688 

See #4251 
See #4247 

#### Special notes for your reviewer:

1. 测试上传、删除头像接口是否能够正常执行。
2. 查看当前用户的头像是否能够设置成功。
3. 查看附件库中,当前用户的头像文件是否为 0 或 1 个。

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

```release-note
支持裁剪、上传和删除用户头像。
```
2023-07-24 08:08:04 +00:00
John Niang fdfaa53614
Support sort parameter when listing extensions (#4274)
#### What type of PR is this?

/kind feature
/area core

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

Currently, we cannot pass a sort parameter into extensions' list API, so the result of the API is unsortable.

This PR add the support for that API. e.g.:

```bash
curl -X 'GET' \
  'http://localhost:8090/api/v1alpha1/annotationsettings?sort=metadata.name,desc' \
  -H 'accept: */*'
```

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

```release-note
Extension 查询接口支持排序参数。
```
2023-07-24 07:02:23 +00:00
John Niang e98aec32ca
Upgrade Spring Boot 3.1.2 (#4284)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.8.x

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

Upgrade Spring Boot 3.1.2. See https://github.com/spring-projects/spring-boot/releases/tag/v3.1.2 for more.

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

```release-note
升级 Spring Boot 至 3.1.2。
```
2023-07-24 03:20:14 +00:00
Ryan Wang 617d05f3bc
refactor: remove username input validation rule in user editing form (#4276)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

移除用户编辑表单中用户名的校验规则,在这个表单中,用户名本身就是不能修改的,所以不需要验证。移除之后还能够解决旧版本 Halo 升级之后无法修改资料的问题。(旧版本没有用户名校验)

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

Fixes #4269 

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

```release-note
移除 Console 端用户编辑表单中用户名的校验规则,防止旧版本 Halo 升级之后无法修改资料。
```
2023-07-21 09:04:14 +00:00
Ryan Wang 834e37cf13
feat: record the attachment query conditions in the route query parameters (#4210)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.8.x

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

在附件数据管理列表页面路由中记录查询条件,包括分页信息、筛选信息等。可以保证在刷新浏览器窗口或者从编辑页面返回时保留之前的查询状态。

<img width="1714" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/cd3ab1da-ac5c-48c7-a8f2-83f2f86a47bc">

#### Special notes for your reviewer:

需要测试:

1. 附件管理列表的所有筛选项是否可以正常工作。
2. 尝试设置部分筛选,然后刷新页面,观察筛选条件是否正常保留。

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

```release-note
Console 端的附件管理列表支持在地址栏记录筛选条件。
```
2023-07-21 03:50:14 +00:00
guqing 3b03ed9570
refactor: add read-write lock to ExtensionContextRegistry (#4245)
#### What type of PR is this?
/kind improvement
/area core
/area plugin
/milestone 2.8.x

#### What this PR does / why we need it:
修复由于多线程环境下导致的插件卸载时的路由异常问题

改动描述:
为了确保在多线程环境下访问 ExtensionContextRegistry 类的注册表时的线程安全。通过添加读写锁,可以保证在读取和写入PluginApplicationContext 时只有一个线程可以访问,从而避免了多个线程同时访问注册表时可能出现的竞态条件和数据不一致的问题。同时,更新了 register、remove、getByPluginId、containsContext 和 getPluginApplicationContexts 方法,以在访问注册表时获取和释放适当的锁,从而确保了线程安全。

问题原因:
当插件卸载时,卸载动作在 Reconciler 线程中执行而路由访问是在 reactor 的 NonBlockingThread 线程执行,当 PluginCompositeRouterFunction 的 routerFunctions() 方法从 ExtensionContextRegistry 中获取所有 PluginApplicationContext 并持有还未处理完成时由于 PluginReconciler 中执行了卸载插件逻辑而将某个 PluginApplicationContext 关闭从而让 PluginCompositeRouterFunction 中持有到的对象引用发生变化出现数据不一致问题导致出现 `PluginApplicationContext@14971c8e has been closed already` 异常。

解决方案:
所以此修改让读取和写入PluginApplicationContext 时只有一个线程可以访问来解决此问题

how to test it?
测试开发模式下卸载插件时是否会出现如 #4242 中所描述的异常信息
#### Which issue(s) this PR fixes:
Fixes #4242

#### Does this PR introduce a user-facing change?
```release-note
修复由于多线程环境下导致的插件卸载时的路由异常问题
```
2023-07-21 03:38:14 +00:00
guqing 832c86071a
fix: plugin delete lifecycle method will not be triggered when the plugin is uninstalled (#4241)
#### What type of PR is this?
/kind bug
/kind improvement
/area core
/milestone 2.8.x

#### What this PR does / why we need it:
修复插件被卸载时 delete 生命周期方法不会被触发的问题

how to test it?
1. 测试开发模式下卸载插件,delete 生命周期方法被触发且不会误删项目目录
2. 测试生产模式下插件卸载,文件正确被删除且触发 delete 生命生命周期方法

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

#### Does this PR introduce a user-facing change?
```release-note
修复插件被卸载时 delete 生命周期方法不会被触发的问题
```
2023-07-21 03:36:14 +00:00
dependabot[bot] dc18d287e7
chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /console (#4270)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 11:22:28 +08:00
Ryan Wang 51848d8563
fix: search input component cannot be rendered normally under a non-secure domain name (#4260)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

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

修复在非安全域名下,SearchInput 组件无法正常渲染的问题,因为使用了 crypto 接口来随机生成表单的 id。但 crypto 在非安全域名下无法被调用,参考:https://developer.mozilla.org/en-US/docs/Web/API/Crypto

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

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

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

```release-note
None
```
2023-07-21 02:34:17 +00:00
Ryan Wang 7ee6e050a2
feat: record the comment query conditions in the route query parameters (#4209)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.8.x

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

在评论数据管理列表页面路由中记录查询条件,包括分页信息、筛选信息等。可以保证在刷新浏览器窗口或者从其他页面返回的时候不丢失筛选条件。

<img width="1544" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/39573c8d-f664-40d1-8248-90443179ac73">

#### Special notes for your reviewer:

需要测试:

1. 评论管理列表的所有筛选项是否可以正常工作。
2. 尝试设置部分筛选,然后刷新页面,观察筛选条件是否正常保留。

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

```release-note
Console 端的评论管理列表支持在地址栏记录筛选条件。
```
2023-07-21 02:28:13 +00:00
guqing 133e54106d
refactor: optimize the usage of comment widget extension point (#4249)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.8.x

#### What this PR does / why we need it:
优化评论扩展点的使用方式

how to test it?
测试评论插件是否正常可用

#### Does this PR introduce a user-facing change?
```release-note
优化评论扩展点的使用方式
```
2023-07-20 08:59:56 +00:00
guqing 5eb9b68209
refactor: optimizing regex pettern for html meta matching (#4235)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.8.x

#### What this PR does / why we need it:
优化去除 Html Meta 重复标签的正则表达式

see #4234 for more details.

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

Fixes #4234

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

```release-note
优化去除 Html Meta 重复标签的正则表达式
```
2023-07-20 08:55:56 +00:00
Ryan Wang 6b70296956
refactor: code structure of the post data list (#4219)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

重构 Console 端文章管理列表的代码结构,封装列表项为单个组件。

#### Special notes for your reviewer:

需要测试文章管理的功能是否正常。

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

```release-note
None
```
2023-07-20 08:10:18 +00:00
Ryan Wang ea792f511b
refactor: code structure of the single page data list (#4220)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

重构 Console 端页面管理列表的代码结构,封装列表项为单个组件。

#### Special notes for your reviewer:

需要测试页面管理的功能是否正常。

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

```release-note
None
```
2023-07-20 07:40:18 +00:00
Ryan Wang ad1ec3641c
chore: bump @halo-dev/richtext-editor to fix image size was abnormally modified (#4264)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

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

升级编辑器以修复图片被自动修改尺寸的问题,see https://github.com/halo-sigs/richtext-editor/pull/22

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

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

#### Special notes for your reviewer:

测试方法可以参考:https://github.com/halo-sigs/richtext-editor/pull/22

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

```release-note
修复编辑文章时,原来的图片尺寸被自动修改的问题。
```
2023-07-20 07:30:18 +00:00
Takagi 5a7e794fea
feat: allow attachment library to filter certain groups and their attachments (#4255)
#### What type of PR is this?

/kind feature
/area core

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

为附件库增加过滤条件,过滤 labels 中包含 `halo.run/hidden` 的分组及其附件。

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

Fixes #4251 

#### Special notes for your reviewer:

保证默认情况下附件能够正常访问即可。
或者为分组增加 `halo.run/hidden` label,之后查看接口中是否不包含具有目标分组及其附件。

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

```release-note
None
```
2023-07-20 07:28:17 +00:00
Ryan Wang d21472dc0f
fix: post status filter item cannot be displayed when the page is refreshed (#4263)
#### What type of PR is this?

/kind bug
/area console
/milestone 2.8.x

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

修复文章状态筛选在刷新页面之后无法回显的问题。

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

see https://github.com/halo-dev/halo/pull/4219#issuecomment-1641310000

#### Special notes for your reviewer:

需要测试:

1. 在文章管理页面选择某个状态筛序项,观察数据是否正常。
2. 刷新页面,观察筛选项是否回显。

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

```release-note
None
```
2023-07-20 07:24:18 +00:00
Ryan Wang ec2ab632fc
feat: refine validation for password field (#4257)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.8.x

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

在 Console 端关于用户密码输入的部分添加基本的验证,目前的规则是:

1. 必填,且不能全为空格符
2. 长度为 5-100
3. 字符串前后不能有空格

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

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

#### Special notes for your reviewer:

按照以上规则测试即可。

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

```release-note
Console 端关于用户密码输入的部分添加基本的验证
```
2023-07-19 11:48:12 +00:00