Commit Graph

4114 Commits (4ce5d0c2cfa05b310ea4de59636c5de392692525)

Author SHA1 Message Date
Ryan Wang 4ce5d0c2cf
refactor: use tanstack query to refactor user-related fetching (#3548)
#### What type of PR is this?

/kind improvement

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

使用 [TanStack Query](https://github.com/TanStack/query) 重构用户相关数据请求的相关逻辑。

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

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

#### Special notes for your reviewer:

测试方式:

1. 测试用户管理列表的数据请求 + 条件筛选是否正常。
2. 测试修改当前登录用户和其他用户的信息和密码是否正常。

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

```release-note
None
```
2023-03-23 13:44:34 +00:00
Ryan Wang 0503c5ff2e
perf: disable browser's autocomplete feature for password input field (#3550)
#### What type of PR is this?

/kind improvement
/area console

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

默认禁用 password 输入框的浏览器自动填充,实现方式为默认给 type 为 password 的 input 添加 `autocomplete="new-passwrod"` 属性。如果需要自动填充,手动为组件添加 `autocomplete` 属性即可。

此改动主要是针对非登录表单场景的密码输入框来做优化,在这些场景下,浏览器如果自动填充用户保存的用户名密码,会带来一定的干扰。

<img width="1103" alt="image" src="https://user-images.githubusercontent.com/21301288/226558568-bf617be7-0cd8-44db-a123-f230a2b88181.png">

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

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

#### Special notes for your reviewer:

1. 登录 Console,并将用户名和密码保存在浏览器的密码管理器。
2. 然后进入任意使用了密码输入框的页面,检查是否自动填充了密码。推荐使用 https://github.com/halo-sigs/plugin-s3 测试。

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

```release-note
禁用非登录场景下,密码输入框的浏览器自动填充
```
2023-03-23 13:42:35 +00:00
Ryan Wang b63d2b882c
feat: add i18n supports for console (#3506)
#### What type of PR is this?

/kind feature

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

为 Console 端添加多语言的支持,并默认提供简体中文和英文的语言包。

todolist:

- [x] 完善 Console 的文字语言包翻译。
- [ ] ~~为后端提供的部分数据支持翻译,比如系统设置的表单定义。(实现方式待讨论,这个 PR 先不支持)~~
- [x] 提供语言设置。

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

Fixes #3346 

#### Special notes for your reviewer:

测试方式:

1. 检查各个页面的文字显示是否正常。
2. 测试中英文环境中是否使用了对应的语言包。

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

```release-note
Console 端支持多语言界面
```
2023-03-23 08:54:33 +00:00
John Niang c400c85922
Refactor project structure for a better development (#3552)
#### What type of PR is this?

/kind cleanup
/area core

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

This PR totally refactor project structure for a better plugin development. Now we can maintain and publish api and platform modules at Halo application side, which will be references by plugins.

Currently, we can execute command `./gradlew clean publish` to publish api and platform modules into **local** Maven repository, so that we can refer these dependencies (`run.halo.tools.platform:plugin:2.4.0-SNAPSHOT` and `run.halo.app:api:2.4.0-SNAPSHOT`) in plugin projects. 

I will make another pull request to publish api library and platforms into Maven central repository.

**Modules explanation**:
- API module contains common classes which might be used by plugins.
- Plugin Platform module contains dependency declarations of other plugin API modules.
- Application Platform module contains dependency declarations application module might uses.

If we want to build application only(exclude check and jar), we have to execute the command below:

```bash
./gradlew clean :application:build -x :application:check -x :application:jar
```

The executable Jar will be generated at folder `application/build/libs/`.

If we want to build a Docker image, we could execute the command below:

```bash
docker build -t johnniang/halo:project-structure .

# Test the Docker image
docker run -it --rm -p8090:8090 johnniang/halo:project-structure
```

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

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

#### Special notes for your reviewer:

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

```release-note
重构项目结构
```
2023-03-23 08:02:33 +00:00
guqing 7ca5270238
feat: support the expansion of other authentication methods (#3520)
#### What type of PR is this?
/kind feature
/milestone 2.4.0
/area core

#### What this PR does / why we need it:
支持扩展其他登录方式:
1. 增加 AdditionalWebFilter 扩展点,插件只需要实现此扩展点完成 Filter 逻辑
2. 增加 DynamicMatcherSecurityWebFilterChain 用于将 `apiFilterChain` 的 `SecurityWebFilterChain` 委托给此类,需要认证的请求都会 DynamicMatcherSecurityWebFilterChain 的过滤器进行处理,所以 `AdditionalWebFilter` 可以通过 order 将扩展的过滤器放到这条链上的任何位置。
3. 将表单登录改为实现扩展点的实现
4. 增加 ExtensionPointDefinition 和 ExtensionDefinition 自定义模型用于对扩展点和扩展进行描述
5. 提供 AuthProvider 自定义模型用于记录支持的登录方式提供商
6. 提供 UserConnection 自定义模型用于将第三方登录账号信息与当前系统账户进行绑定

how to test it?
1. 测试表单登录功能是否正常
2. 测试插件的 plugin-oauth-github 的 PR https://github.com/halo-sigs/plugin-oauth-github/pull/3 功能是否正常

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

Fixes #3423

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

```release-note
支持扩展其他的认证方式
```
2023-03-21 03:54:28 +00:00
John Niang f7eb0cd522
Upgrade to Gradle 8.0.2 (#3543)
#### What type of PR is this?

/kind cleanup
/area core

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

Upgrade to Gradle 8.0.2 by using command `./gradlew wrapper --gradle-version 8.0.2 --distribution-type bin`.

Recently, we have a plan to restructure our project via Gradle 8, so I upgrade to Gradle 8.0.2 now.

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

```release-note
None
```
2023-03-21 02:44:27 +00:00
Ryan Wang e6d2607516
fix: search issue of post tag selection component (#3540)
#### What type of PR is this?

/kind bug
/area console

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

修复 FormKit 的文章标签搜索组件无法使用搜索功能的问题。

<img width="720" alt="image" src="https://user-images.githubusercontent.com/21301288/226311996-8f31bc6c-784e-4bf0-93da-cdc6db935822.png">

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

Fixed https://github.com/halo-dev/halo/issues/3536

#### Special notes for your reviewer:

测试方式:

1. 在文章设置中,测试标签选择输入框的搜索功能是否正常即可。

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

```release-note
修复文章设置中的标签选择组件无法正常搜索的问题。
```
2023-03-20 11:46:26 +00:00
guqing 5bc4a63e59
refactor: plugin development initializer (#3539)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.4.x

#### What this PR does / why we need it:
去掉开发模式初始化器中加载插件的逻辑,以解决开发模式下启动插件时会遇到的问题
1. 重启插件/Halo启动时 PluginApplicationContext#hash has been closed already.
2. 卸载插件时 NullPointerException at pluginWrapper.getPlugin().stop() becuase 'pluginWrapper' is null
3. Halo 启动时 `Most likely this exception is thrown because the called constructor (xxx) cannot handle 'null' parameters. Original message was:  ...`
4. 以及启动插件后插件的 bean 没有被创建等
```shell
2023-03-20T13:28:02.811+08:00 ERROR 59170 --- [nReconciler-t-1] r.h.a.e.controller.DefaultController     : Reconciler in run.halo.app.core.extension.reconciler.PluginReconciler-worker-1 aborted with an error, re-enqueuing...

java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
	at java.base/java.util.ArrayList.fastRemove(ArrayList.java:642) ~[na:na]
	at java.base/java.util.ArrayList.remove(ArrayList.java:629) ~[na:na]
	at org.pf4j.AbstractPluginManager.resolvePlugins(AbstractPluginManager.java:797) ~[pf4j-3.9.0.jar:3.9.0]
	at org.pf4j.AbstractPluginManager.loadPlugin(AbstractPluginManager.java:204) ~[pf4j-3.9.0.jar:3.9.0]
	at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$ensurePluginLoaded$17(PluginReconciler.java:495) ~[main/:na]
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.ensurePluginLoaded(PluginReconciler.java:493) ~[main/:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.getPluginWrapper(PluginReconciler.java:322) ~[main/:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$readinessDetection$1(PluginReconciler.java:117) ~[main/:na]
	at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.readinessDetection(PluginReconciler.java:107) ~[main/:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:95) ~[main/:na]
	at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:87) ~[main/:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:70) ~[main/:na]
	at run.halo.app.extension.controller.DefaultController$Worker.run(DefaultController.java:163) ~[main/:na]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
```
这些异常信息都是因为原先的 PluginManager 实现不是线程安全的,在 webflux 下使用并且有 Reconciler 的情况下非常容易复现。
所以除了在 Reconciler 调用以外尽量保证 PluginManager 的调用是单线程的,以避免 PluginManager 出现线程安全问题。

how to test it?
在开发模式下配置插件的 fixedPath 来检查差价启用功能是否正常。

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

```release-note
None
```
2023-03-20 10:06:26 +00:00
guqing e5bbf48360
refactor: the acquisition method of role rules and no longer obtain aggregated by reconciler (#3425)
#### What type of PR is this?
/kind improvement
/area core
#### What this PR does / why we need it:
修复角色模板规则改动后用户权限不更新的问题
- 权限校验的地方由原来的从角色 annotations 获取聚合 rules 改为根据角色名称查询所有依赖角色再判断
- console 端获取 UI 权限的地方由获取聚合的 ui-permissions annotation 改为根据角色名称查询所有依赖角色组合后再返回

see #3325 for more detail.
问题描述:
1. 创建一个角色比如叫 test-role 将其分配给一个新用户
2. 安装插件 [plugin-links-1.1.0.jar.zip](https://github.com/halo-dev/halo/files/10856628/plugin-links-1.1.0.jar.zip),该插件提供了一个角色模板配置了 links 但没有配置 groups,当将此插件的查看权限分配给 test-role 后,test-role 会提示 groups 403无权限
3. 使用[plugin-links-1.1.0-after.jar.zip](https://github.com/halo-dev/halo/files/10856695/plugin-links-1.1.0-after.jar.zip) 升级插件后写了,插件已经修复了 gorups 的权限模板配置,期望 test-role 到链接管理菜单不会报 groups 403,但实际得到了 403 就是因为 test-role 角色依赖了一些其他角色但其他角色权限的改动没有办法通知到 test-role 去更新 test-role 中聚合的 dependency-rules annotation
4. 综上所述改为了直接查询

how to test it?
1. 根据上述问题描述中的步骤来测试,期望升级插件后能正确查看链接
2. 测试为一些角色分配权限后,拥有此角色的用户能正确访问那些资源不会出现403
3. 用户访问没有权限的资源会 403

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

#### Does this PR introduce a user-facing change?
```release-note
修复角色模板规则改动后用户权限不更新的问题
```
2023-03-20 06:26:10 +00:00
Ryan Wang 2c3f9ef7dc
chore: remove unused vars and imports to fix eslint warning (#3526)
#### What type of PR is this?

/kind improvement
/area console

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

移除 Console 未使用的变量和导入,解决 ESLint 的警告。

<img width="854" alt="image" src="https://user-images.githubusercontent.com/21301288/225866000-f9448643-064a-4d2b-b023-387f81f0ca8e.png">
<img width="877" alt="image" src="https://user-images.githubusercontent.com/21301288/225866074-ead93a6c-f37f-4711-941c-4bdbbfe0fbe7.png">

```release-note
None
```
2023-03-18 04:34:31 +00:00
Ryan Wang 69f7b18aad
chore: bump formkit version to 0.16.2 (#3527)
#### What type of PR is this?

/kind improvement
/area console

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

升级 FormKit 的版本到 0.16.2。

- https://formkit.com/changelog#0160-beta-16

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

```release-note
升级 Console 端的 FormKit 的版本到 0.16.2。
```
2023-03-18 02:38:33 +00:00
yang b7702efbed
fix: the rawType of Content was not updated when switching editors (#3516)
#### What type of PR is this?

/kind bug


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

修复在新建文章时,首次切换编辑器后没有设置内容 rawType 资源为对应编辑器类型的问题。

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

Fixes #3512 

#### Special notes for your reviewer:

测试方式:

1. 安装任意一个编辑器插件,比如:https://github.com/halo-sigs/plugin-stackedit
1. 新建文章,选择安装的编辑器。
1. 发布文章。
1. 卸载或者停止编辑器。
1. 重新编辑刚刚创建的文章,如果提示 `未找到符合 markdown 格式的编辑器,请检查是否已安装编辑器插件` 则代表正常。

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

```release-note
修复在新建文章时,首次切换编辑器后没有设置内容 rawType 资源为对应编辑器类型的问题。
```
2023-03-15 03:12:26 +00:00
longjuan f43888bc2c
fix: RSA key cannot be saved normally in the Windows environment (#3510)
<!--  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 core
<!--
添加其中一个类别:
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:
修复Windows下开发环境不能正常保存Rsa密钥
#### 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/3497

#### Special notes for your reviewer:
windows不支持posix标准,也无法精细控制用户访问权限,因此在不支持posix的系统直接不设置权限。
https://stackoverflow.com/questions/21541455/how-to-check-if-the-os-is-posix-compliant
#### 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-03-14 02:58:17 +00:00
Ryan Wang 86ee91a92e
chore: remove issues triage action config files (#3503)
#### What type of PR is this?

/kind improvement

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

移除在 https://github.com/halo-dev/halo/pull/1416 中引入的通过 GitHub Actions 来实现 ChatOps 的配置文件,目前已经使用了 Prow 代替。

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

```release-note
None
```
2023-03-13 11:58:17 +00:00
Ryan Wang 684961023b
perf: add supports for force updating of post and single page settings (#3498)
#### What type of PR is this?

/kind improvement

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

支持强制保存文章和单页面的设置,绕开后端 version 锁的机制,因为目前发现在后端 Reconcile 处理文章较慢时会影响文章的保存。

需要注意的是,这是一个不太合理的处理方式,但目前别无选择。

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

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

#### Special notes for your reviewer:

测试方式:

1. 同时打开多个同文章的编辑页面的窗口。
2. 编辑任意一个窗口的文章设置。
3. 然后再去其他窗口保存,观察是否有异常。

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

```release-note
支持强制保存文章和页面的设置,避免因为 Version 锁的机制导致保存失败。
```
2023-03-12 10:42:15 +00:00
longjuan 0384ed7df5
Make login page use custom favicon (#3484)
<!--  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
/area console
/area core
<!--
添加其中一个类别:
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:
console 端登陆页使用自定义favicon
#### 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/3285

#### Special notes for your reviewer:
在`/actuator/globalinfo`暴露favicon信息,异步获取favicon信息,未获取到数据时浏览器短暂使用默认的`/console/favicon.ico`。
#### 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
console 端登陆页使用自定义favicon
```
2023-03-09 08:18:12 +00:00
John Niang d192b8c956
Support logging in with encrypted password (#3480)
#### What type of PR is this?

/kind feature
/kind api-change
/area core
/area console
#### What this PR does / why we need it:

This PR creates AuthenticationWebFilter by ourselves instead of using FormLoginSpec directly. Because we have no chance to customize `org.springframework.security.web.server.authentication.ServerAuthenticationConverter` currently.

Meanwhile, we provide CryptoService(RSA) to generate key pair, get public key and decrypt message encrypted by public key.

There is a new endpoint to get public key which is used by console:

```bash
❯ curl localhost:8090/login/public-key -s | jq .
{
  "base64Format": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAouDtdDS751U8NcWfAAQ53ijEtkLnIHh1Thqkq5QHGslq2hBmWnNsIZFnc/bwVp00ImKLV2NtLgOuv5RRNS5iO+oqRvfOGdXLdW2nzqU2towtaMkYTEMJrsNMZp5BUNCGI7Z2xpPBZzvys0d1BvcpNFobX/LkOtcTyfB1DRp9ZAhxRYOZkTkCzaKo+6X11lnMexTsB3exzaXk9rRZ8XoJ+dWT5G0URs/PF2cDkgxuMdOFJzqDsb9HQYGI/etajdCcKs7mZsjmDgse9Cw9/3mgoTNnEGx9Wl89S0P+FJ7T5DALGt3/nSAlzmKdXJNBLf6Q44ogFpTWdq27JpJD3SKicQIDAQAB"
}
```

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

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

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

```release-note
支持登录时密码加密传输
```
2023-03-08 09:52:12 +00:00
John Niang df2300144e
Fix the problem of failure to create and publish post (#3441)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.3.x

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

Refactor retry logic of publishing, unpublishing and recycling post. Because the logic was misused before.

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

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

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

```release-note
解决文章创建和发布经常失败的问题
```
2023-03-08 09:42:11 +00:00
Ryan Wang 4ba3cfb64d
feat: add support for refreshing search engine indexes (#3475)
#### What type of PR is this?

/kind feature

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

在 Console 端仪表盘的快捷访问中添加刷新搜索引擎索引的入口。

![2023-03-07 13 48 52](https://user-images.githubusercontent.com/21301288/223332020-6d4e143e-e024-46ce-a84c-96ea3813cec0.gif)

#### Special notes for your reviewer:

1. 测试仪表盘快捷访问中的刷新搜索引擎操作是否可以正常调用接口即可。
2. 分配一个不包含文章管理权限的角色给某个用户,检查是否可以看到这个刷新的入口。

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

```release-note
Console 端仪表盘的快捷访问中添加刷新搜索引擎索引的入口。
```
2023-03-08 09:32:11 +00:00
Ryan Wang 80a3fa803f
chore: bump uppy version to fix crash on chrome browser (#3481)
#### What type of PR is this?

/kind bug

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

修复在非安全情况下(非 HTTPS 环境或本地环境),在 [Chromium](https://www.chromium.org/) 内核的浏览器下拖拽文件上传出现浏览器崩溃的问题。

修复来源:

- https://github.com/transloadit/uppy/releases/tag/uppy%403.6.0
- https://github.com/transloadit/uppy/pull/4310

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

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

#### Screenshots:

before:

![2023-03-08 10 59 02](https://user-images.githubusercontent.com/21301288/223609341-222f62d2-630a-4ee8-ba8f-2fb3c78fcca7.gif)

after:

![2023-03-08 11 00 06](https://user-images.githubusercontent.com/21301288/223609353-857f6559-cc9c-482f-9b46-713430621bb6.gif)

#### Special notes for your reviewer:

测试方式:

1. 需要先执行 `make -C console install` 以更新 Console 的依赖。
2. 使用非 localhost 或者 127.0.0.1 访问 Halo 后台,本地环境可以使用 192.168.x.x 访问。
3. 在 Console 的附件管理测试拖拽文件上传,观察浏览器是否崩溃。

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

```release-note
修复非 HTTPS 环境下,在 Chromium 内核浏览器拖拽上传文件时出现浏览器崩溃的问题。
```
2023-03-08 09:30:13 +00:00
guqing ce9c33c816
fix: posts and pages cannot be counted for visits (#3471)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
修复文章和自定义页面缺失 name 模型属性导致的访问量无法计数问题
此为 2.3.0 引入的问题 see #3300

how to test it?
1. 切换文章的路由为不带 name 的规则
2. 访问文章看 `/apis/api.halo.run/v1alpha1/trackers/counter` API 是否有如下参数,且 name 值正确
```json
{
    "group": "content.halo.run",
    "plural": "posts",
    "name": "335",
    "hostname": "localhost",
    "screen": "1920x1080",
    "language": "zh-CN",
    "url": "/?p=halo-150-released",
    "referrer": "http://localhost:8090/?p=how-to-development-a-halo-plugin"
}
```
3. 观察文章访问量是否有增加
4. 重复上述 2、3 步骤检查自定义页面的访问量功能是否正确

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

Fixes #3448

#### Does this PR introduce a user-facing change?
```release-note
修复文章和自定义页面缺失属性导致的访问量无法计数问题
```
2023-03-08 09:22:11 +00:00
guqing 633c489503
fix: sorting problem using email comments (#3458)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
修复使用邮箱评论时 `spec.creationTime` 没有填充导致排序不正确

how to test it?
1. 迁移数据,看是否 `spec.creationTime` 与 `spec.approvedTime` 相等
2. 使用邮箱评论看是否在 Console 评论列表排在第一位

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

#### Does this PR introduce a user-facing change?
```release-note
修复使用邮箱评论时的排序问题
```
2023-03-08 09:04:12 +00:00
wzrove 6ace36289b
fix: the issue of blank content when opening a saved post in StackEdit editor plugin for editing (#3468)
#### What type of PR is this?
/kind bug

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

在编辑器初始化前赋值,可以保证缓存的历史数据附在StackEdit的url上。

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

Fixes (https://github.com/halo-dev/halo/issues/3105)

#### Screenshots:
![test](https://user-images.githubusercontent.com/88016243/222957520-b7980ff9-aeeb-4e98-9dde-50eb307f02eb.gif)

#### Special notes for your reviewer:

+ 新建文章,切换为 StackEdit 编辑器
+ 输入一些内容保存/发布文章
+ 回到文章列表,重新点进刚才的文章
+ 重复步骤3,输入的内容还在

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


```release-note
修复 Console 端在使用三方编辑器插件编辑文章时可能出现无法加载内容的问题。
```
2023-03-08 02:50:11 +00:00
Ryan Wang bc186a4225
chore: solving the issue of generating API client causing unnecessary diffs (#3465)
#### What type of PR is this?

/kind improvement

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

为 springdoc 添加 `writer-with-order-by-keys` 参数以固定 OpenAPI 中接口的参数顺序,防止重新生成 `api-client` 时因为参数顺序不同而造成不必要的 diff。

#### Special notes for your reviewer:

测试方式:

1. 反复执行 `make -C console api-client-gen`
2. 观察是否有产生 diff

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

```release-note
None
```
2023-03-07 14:14:14 +00:00
John Niang 16a83b9e0e
Improve the quality of full-text searching result (#3457)
#### What type of PR is this?

/kind improvement
/area core

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

This PR uses QueryParser to build Query instead of FuzzyQuery to improve the searching result quality.

<img width="930" alt="image" src="https://user-images.githubusercontent.com/16865714/223012862-1decfde8-be81-48d1-a3a9-6601b5fd299a.png">

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

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

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

```release-note
优化搜索查询结果
```
2023-03-07 03:48:13 +00:00
John Niang 062af6fcad
Update Spring Boot to 3.0.4 (#3451)
#### What type of PR is this?

/kind improvement
/area core

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

See https://github.com/halo-dev/halo/issues/3450 for more.

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

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

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

```release-note
升级 Spring Boot 至 3.0.4
```
2023-03-06 03:44:11 +00:00
John Niang c43a81058a
Refactor workflow for new console project (#3445)
Signed-off-by: johnniang <johnniang@fastmail.com>
2023-03-02 18:07:23 +08:00
johnniang 5956931e41 Move console repository into halo with histories 2023-03-02 16:23:09 +08:00
johnniang 64919f9a1b Move root to console
Signed-off-by: johnniang <johnniang@fastmail.com>
2023-03-02 15:49:22 +08:00
John Niang df70de671f
Update Halo version to 2.4.0-SNAPSHOT (#3434)
#### What type of PR is this?

/kind cleanup
/area core

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

Update Halo version to 2.4.0-SNAPSHOT for next development.

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

```release-note
None
```
2023-03-01 11:06:19 +00:00
Ryan Wang ff9081cccc perf: mute the start plugin request in setup page (halo-dev/console#897)
#### What type of PR is this?

/kind improvement

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

隐藏在初始化页面启用插件时的错误提示,因为会重试三次,所以不需要提示。

```release-note
None
```
2023-03-01 04:08:18 +00:00
John Niang 01306b0b5a
Add downloadPluginPresets task (#3427)
#### What type of PR is this?

/kind feature
/area core

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

Add downloadPluginPresets task to download plugin presets from GitHub release.

```bash
> Task :downloadPluginPresets
Download https://github.com/halo-sigs/plugin-comment-widget/releases/download/v1.2.0/plugin-comment-widget-1.2.0.jar
Download https://github.com/halo-sigs/plugin-sitemap/releases/download/v1.0.1/plugin-sitemap-1.0.1.jar
Download https://github.com/halo-sigs/plugin-feed/releases/download/v1.1.0-beta.1/plugin-feed-1.1.0-beta.1.jar
Download https://github.com/halo-sigs/plugin-search-widget/releases/download/v1.0.0/plugin-search-widget-1.0.0.jar

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
10:47:59 AM: Execution finished 'downloadPluginPresets'.
```

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

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

#### Special notes for your reviewer:

Try to download plugin presets and check theme by using following commands:

```bash
./gradlew downloadPluginPresets

ls -lah src/main/resources/presets/plugins 
```

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

```release-note
None
```
2023-03-01 03:48:18 +00:00
guqing af07b42b42
feat: add indexer implementation to solve the slow tag stats (#3420)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
修复标签关联文章数量统计不正确的问题
1. 实现简要的 Indexer 可以通过 IndexFunc 来提取需要构建 indacates 的信息,比如对文章的标签和 labels 建立 indacates
2. Indexer 通过 Watch 文章数据来维护 Indicates 使其与数据库一致
3. TagReconciler 一分钟 requeue 一次,但直接通过 Indexer 获取文章名称来统计数量,无需 list 文章数据

how to test it?
1. 创建文章并绑定标签
2. 测试文章关联标签,关联多个标签、解除旧标签绑定等操作是否会在一分钟后在标签处正确显示文章数量
4. 查看主题端标签下文章数量统计是否正确
5. 重复上述操作多次

#### Which issue(s) this PR fixes:
Fixes #3311, #3312

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

```release-note
修复标签关联文章数量统计不正确的问题,优化标签数量多时耗时长的问题
```
2023-03-01 03:44:25 +00:00
Ryan Wang bd9c4dabf7 refactor: use tanstack query to refactor comment-related fetching (halo-dev/console#892)
#### What type of PR is this?

/kind improvement

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

使用 [TanStack Query](https://github.com/TanStack/query) 重构评论管理相关数据请求的相关逻辑。

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

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

#### Special notes for your reviewer:

测试方式:

1. 测试评论管理列表的数据请求 + 条件筛选无异常即可。

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

```release-note
None
```
2023-02-28 15:46:18 +00:00
guqing aba151f54c
refactor: add retry operation to single page publishing (#3422)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x
#### What this PR does / why we need it:
修复初始化时自定义页面会发布失败的问题

#### Which issue(s) this PR fixes:
Fixes #3279
#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-02-28 15:30:18 +00:00
Ryan Wang 9646d411da chore: release 2.3.0 (halo-dev/console#896)
#### What type of PR is this?

/kind improvement
/milestone 2.3.0

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

发布 2.3.0。

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


```release-note
None
```
2023-02-28 15:28:18 +00:00
Ryan Wang 7b04b81f35 perf: hide anonymousUser in user filter dropdown list (halo-dev/console#891)
#### What type of PR is this?

/kind improvement

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

在用户条件筛选框中隐藏匿名用户。

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

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

#### Screenshots:

<img width="864" alt="image" src="https://user-images.githubusercontent.com/21301288/221490795-eaf9c515-e487-4d76-87dd-f0010415360e.png">

#### Special notes for your reviewer:

None

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

```release-note
None
```
2023-02-28 14:54:18 +00:00
Ryan Wang ca0c0b8140 fix: get the wrong link after selecting an attachment (halo-dev/console#893)
#### What type of PR is this?

/kind bug

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

修复默认编辑器从附件库选择非图片、音视频的附件,以链接的形式插入之后得到的链接不正确的问题。

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

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

#### Screenshots:

before:

<img width="995" alt="image" src="https://user-images.githubusercontent.com/21301288/221510856-76eaa125-c13e-472a-8073-7f9f58bb4bd2.png">

after:

<img width="924" alt="image" src="https://user-images.githubusercontent.com/21301288/221510749-c27fc083-3978-4139-959a-426499016d12.png">


#### Special notes for your reviewer:

测试方式:

1. 上传若干 zip 格式附件。
2. 在编辑器中选择这些附件并插入,检查链接是否正确。

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

```release-note
None
```
2023-02-28 14:42:18 +00:00
Ryan Wang 7dbca3cfb7 perf: add success toast for saving plugin and theme settings (halo-dev/console#895)
#### What type of PR is this?

/kind improvement

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

保存主题和插件设置时,添加保存成功的反馈提示。

#### Screenshots:

<img width="803" alt="image" src="https://user-images.githubusercontent.com/21301288/221805091-60f3f20c-5524-4dea-9858-6c521cb1dfbc.png">

#### Special notes for your reviewer:

None

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


```release-note
None
```
2023-02-28 14:36:28 +00:00
Ryan Wang 3d9ca22852 fix: incorrect default pagination number of attachment list (halo-dev/console#890)
#### What type of PR is this?

/kind bug

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

修复附件管理默认分页条数不正确的问题,应该是在 https://github.com/halo-dev/console/pull/878 中测试分页之后没有改回原来的值导致的。

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

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

#### Special notes for your reviewer:

测试附件管理页面默认分页条数是否为 60 即可。

<img width="1423" alt="image" src="https://user-images.githubusercontent.com/21301288/221489138-be0ecfb1-2bc0-4732-8554-afdfc5bf2dfe.png">

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

```release-note
None
```
2023-02-28 14:30:18 +00:00
Ryan Wang a935592d5e feat: add supports for initialize preset plugins (halo-dev/console#894)
#### What type of PR is this?

/kind feature

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

支持在初始化页面安装预设插件。适配:https://github.com/halo-dev/halo/pull/3394

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

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

#### Special notes for your reviewer:

测试方式:

1. Halo 需要切换到 https://github.com/halo-dev/halo/pull/3394
2. Console 需要 `pnpm build:packages`
3. 根据 https://github.com/halo-dev/halo/pull/3394 中的提示,将需要预设的插件放置到 `src/main/resources/presets/plugins`
4. 使用全新的环境进行初始化,完成之后进入插件管理检查是否正常安装了预设插件

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

```release-note
Console 端支持在初始化页面安装预设插件。
```
2023-02-28 14:26:18 +00:00
guqing 3146589d25
fix: theme status phase is always FAILED even if version of Halo is satisfied (#3390)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
修复主题 requires 版本匹配后依然显示 FAILED 状态的问题

how to test it?
1. 安装一个主题后更新主题的 requires 为不匹配系统版本号,此时主题 status 会提示版本号不匹配的错误
2. 再更新 requires 为正确的,phase 会从 FAILED 变为 READY

#### Which issue(s) this PR fixes:
Fixes #3326
#### Does this PR introduce a user-facing change?
```release-note
修复主题状态显示不正确的问题
```
2023-02-28 14:10:18 +00:00
guqing 166a440df1
chore: disable the visit log writer (#3421)
#### What type of PR is this?
/kind cleanup
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
移除 VisitLogWriter 的使用,不再记录访问日志,后续由 httptrace 去暴露指标

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-02-28 13:18:18 +00:00
Li 1a9e2f046a
feat: add stats to the user-sdie comments api (#3366)
#### What type of PR is this?
/milestone 2.3.x
/kind feature

#### What this PR does / why we need it:
为访客端的评论和回复接口 聚合点赞数

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

#### Special notes for your reviewer:
同步修改了 finder API 及 console 位置的接口

如何测试:
1. 调用接口 `/apis/api.halo.run/v1alpha1/trackers/upvote` 增加点赞数。
2. 使用 console 接口 `/apis/api.halo.run/v1alpha1/comments/{name}` 查看目标评论是否增加点赞数。

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

```release-note
访客端评论及回复列表支持返回点赞数据
```
2023-02-28 10:48:17 +00:00
John Niang 848857fbfd
Provide an endpoint to get plugin presets (#3394)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.3.x

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

This PR provide a new endpoint to get plugins presets. Please see the result:

```bash
❯ curl -s -u admin:admin 'http://127.0.0.1:8090/apis/api.console.halo.run/v1alpha1/plugin-presets'
```
```json
[
  {
    "spec": {
      "displayName": "评论组件",
      "version": "1.2.0",
      "author": {
        "name": "Halo OSS Team",
        "website": "https://github.com/halo-dev"
      },
      "logo": "https://halo.run/logo",
      "pluginDependencies": {},
      "homepage": "https://github.com/halo-sigs/plugin-comment-widget",
      "description": "为用户前台提供完整的评论解决方案",
      "license": [
        {
          "name": "MIT"
        }
      ],
      "requires": ">=2.2.0",
      "enabled": true
    },
    "status": {
      "phase": "RESOLVED"
    },
    "apiVersion": "plugin.halo.run/v1alpha1",
    "kind": "Plugin",
    "metadata": {
      "name": "PluginCommentWidget"
    }
  },
  {
    "spec": {
      "displayName": "搜索组件",
      "version": "1.0.0",
      "author": {
        "name": "Halo OSS Team",
        "website": "https://github.com/halo-dev"
      },
      "logo": "https://halo.run/logo",
      "pluginDependencies": {},
      "homepage": "https://github.com/halo-sigs/plugin-search-widget",
      "description": "为 Halo 2.0 提供统一的搜索组件,方便主题端使用。",
      "license": [
        {
          "name": "MIT"
        }
      ],
      "requires": ">=2.0.0",
      "enabled": true
    },
    "status": {
      "phase": "RESOLVED"
    },
    "apiVersion": "plugin.halo.run/v1alpha1",
    "kind": "Plugin",
    "metadata": {
      "name": "PluginSearchWidget"
    }
  }
]
```

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

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

#### Special notes for your reviewer:

1. Try to download some plugins from <https://github.com/halo-sigs/awesome-halo>.
2. Put those jars into folder `src/main/resources/presets/plugins/`.
3. Get all plugins presets using the command below:
    
    ```bash
    # You might change your own username and password by yourself.
    curl -s -u admin:admin 'http://127.0.0.1:8090/apis/api.console.halo.run/v1alpha1/plugin-presets'
    ```

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

```release-note
提供预设插件功能
```
2023-02-28 10:26:18 +00:00
guqing 039d3f508d
fix: post page size configuration not work (#3413)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.3.x
#### What this PR does / why we need it:
修复文章列表分页配置取值错误的问题
此问题为 #3300 PR 引入,由于改动较大遗漏了这点没测试到。

how to test it?
修改文章设置中的大小,查看主题端分页是否符合预期:
包括首页,归档页,标签文章页,分类文章页。
<img width="575" alt="image" src="https://user-images.githubusercontent.com/38999863/221574440-eeec9c27-57ab-46d1-823f-7cc076fb2b54.png">

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

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2023-02-28 09:30:16 +00:00
guqing 79e705123e
fix: template rendering missing template_id model data (#3414)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
修复文章模板渲染丢失 template_id 参数导致无法代码注入的问题

how to test it?
测试 [plugin-highlightjs](https://github.com/halo-sigs/plugin-highlightjs) 插件功能是否正常,期望在 html head 插入 `/plugins/PluginHighlightJS/assets/static/highlight.min.js`

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

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-02-28 03:34:16 +00:00
Ryan Wang cbd2f8b2ed
docs: fix command of docker run (#3415)
#### What type of PR is this?

/kind documentation

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

修复 Docker 快速运行的 `halo.security.initializer.superadminusername` 参数。

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


```release-note
None
```
2023-02-27 14:46:15 +00:00
171d4761e6
fix: exclude ghost and anonymous user when counting users (#3370)
#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:
后台进行用户数量统计时,排除ghost和anonymousUser

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

Fixes #3349 

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

```release-note
修复仪表盘用户数显示错误问题
```
2023-02-25 22:18:16 +08:00
Ryan Wang 060df2b302 fix: pages using tanstack query cannot be loaded in production build (halo-dev/console#889) 2023-02-24 19:01:47 +08:00