Commit Graph

4287 Commits (release-2.6)

Author SHA1 Message Date
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
Ryan Wang 712df0e481 chore: release 2.3.0-rc.1 (halo-dev/console#888)
#### What type of PR is this?

/kind improvement
/milestone 2.3.x

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

发布 2.3.0-rc.1

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


```release-note
None
```
2023-02-24 10:12:13 +00:00
guqing adff2a7194
refactor: default is approved to reply to comments on the console-side (#3363)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
Console 端创建回复不再需要审核
但需要注意的是目前无法区分是否为管理员,所以如果具有评论管理权限的用户在主题端登录回复还是需要审核。

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

#### Special notes for your reviewer:
how to test it?
1. 在主题端创建评论和回复都需要审核
2. 在 console 端回复不需要审核

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
Console 端创建回复不再需要审核
```
2023-02-24 18:09:57 +08:00
guqing f1ec6ceeab
chore: add finalizer for ghost and anonymous users (#3386)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
为系统默认用户添加系统保护 finalizer,避免被删除

how to test it?
```shell
curl -u username:password --basic 'http://localhost:8090/api/v1alpha1/users/ghost'
curl -u username:password --basic 'http://localhost:8090/api/v1alpha1/users/anonymousUser'
```
将看到 
```json
"finalizers": [
  "...",
  "system-protection"
]
```
#### Which issue(s) this PR fixes:

Fixes #

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

```release-note
None
```
2023-02-24 10:04:17 +00:00
Li 3330ff8c3d
refactor: add version flag to plugin static assets (#3381)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
对插件的静态资源(js, css) 增加 version 版本号,用于解决插件静态资源缓存的问题。另外同时也对插件 Logo 增加了版本号标识。

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

#### Special notes for your reviewer:
验证 Console 端插件静态资源链接是否携带 `version={pluginVersion}` 。

特别的,对于 logo只会增加相对路径下的地址,绝对路径的地址将直接返回原始路径/值。

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

```release-note
为插件静态资源路径增加版本标识以解决缓存更新不及时的问题
```
2023-02-24 18:02:38 +08:00
Ryan Wang a7ddf37fb2 refactor: use tanstack query to refactor singlePage-related fetching (halo-dev/console#886)
#### 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-24 09:58:21 +00:00
Ryan Wang 27ee803263 fix: user filter list will fail to load the avatar after searching (halo-dev/console#885)
#### 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/3361

#### Screenshots:

<img width="455" alt="image" src="https://user-images.githubusercontent.com/21301288/221108789-291999ab-ee4f-478c-900b-4273e3780357.png">

#### Special notes for your reviewer:
 
测试方式:

1. 创建若干用户并设置头像。
2. 打开文章管理的用户筛选项,尝试输入关键词搜索,观察搜索出的用户头像是否加载正常。

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


```release-note
修复 Console 端用户筛选项,输入关键词搜索之后无法加载头像的问题。
```
2023-02-24 09:56:17 +00:00
Ryan Wang 77a5d531b6 perf: hide active button when theme is activated (halo-dev/console#877)
#### 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/3059

#### Screenshots:

<img width="1022" alt="image" src="https://user-images.githubusercontent.com/21301288/220517066-67ee2f25-1b64-47c0-8b4c-3bdd6b3cb9f1.png">

#### Special notes for your reviewer:

测试方式:

1. 在主题管理列表检查已启用主题是否还有启用按钮即可。

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

```release-note
Console 端主题管理列表隐藏已启用主题的启用按钮。
```
2023-02-24 09:54:21 +00:00
Ryan Wang f8ffcaa593 refactor: support configuring plugin when the plugin is stopped (halo-dev/console#875)
#### What type of PR is this?

/kind improvement

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

1. 插件停止时支持配置插件设置项。
2. 修改插件异常信息的获取方式。

适配:https://github.com/halo-dev/halo/pull/3355

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

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

#### Special notes for your reviewer:

测试方式:

1. Halo 需要切换到 https://github.com/halo-dev/halo/pull/3355 分支。
2. Console 需要 `pnpm build:packages`
3. 根据 https://github.com/halo-dev/halo/pull/3355 中的描述进行测试。

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

```release-note
None
```
2023-02-24 09:52:25 +00:00
Ryan Wang 68e667601c refactor: change the creation time field for comments and replies (halo-dev/console#874)
#### What type of PR is this?

/kind improvement

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

修改评论和回复的创建时间字段。适配:https://github.com/halo-dev/halo/pull/3341

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

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

#### Special notes for your reviewer:

None

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

```release-note
None
```
2023-02-24 09:50:28 +00:00
Ryan Wang 792c8cf944 perf: disable the editor from pasting excel tables as pictures (halo-dev/console#873)
#### What type of PR is this?

/kind improvement

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

禁止在编辑器粘贴 Excel 表格时,将表格转为图片的形式上传。

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

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

#### Screenshots:

before:

<img width="818" alt="image" src="https://user-images.githubusercontent.com/21301288/220243681-eb07502a-0fc5-4e69-9cd3-61c3b89cb542.png">

after:

<img width="815" alt="image" src="https://user-images.githubusercontent.com/21301288/220243630-ca7c2700-ff61-4893-a857-94860e4a899b.png">


#### Special notes for your reviewer:

测试方式:

1. 使用 Excel 或者 macOS 下的 Numbers 创建一个表格。
2. 复制整个表格或者某几个单元格,并粘贴到 Halo 的编辑器。
3. 观察是否有将内容转为图片并上传。

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

```release-note
Console 端禁止在编辑器粘贴 Excel 表格以图片的形式上传。
```
2023-02-24 09:48:20 +00:00
Ryan Wang e547540e3a feat: editor supports selecting attachments to be inserted as links (halo-dev/console#863)
#### What type of PR is this?

/kind feature

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

编辑器支持选择附件作为链接插入。目前在附件库选择附件时,如果非图片、视频、音频,那么就会作为链接插入。

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

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

#### Screenshots:

![2023-02-17 21 02 43](https://user-images.githubusercontent.com/21301288/219660123-b910a4d5-32e6-4606-813e-c081720556d5.gif)

#### Special notes for your reviewer:

测试方式:

1. 测试从附件库选择非图片、视频、音频的时候是否会作为链接插入即可。

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

```release-note
Console 端默认编辑器支持以链接的形式插入非图片、音视频的附件。
```
2023-02-24 09:46:21 +00:00
guqing c8f3229cd6
feat: add role information for user-related custom endpoint (#3372)
#### What type of PR is this?
/kind feature
/kind api-change
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
获取用户信息的 API 响应体包含关联角色信息

- 新增 API `/apis/api.console.halo.run/v1alpha1/users/{name}`
- 修改了 API 的返回值类型 `/apis/api.console.halo.run/v1alpha1/users/-`

由于 API 响应体结构的改变,需要 Console 适配
#### Which issue(s) this PR fixes:

Fixes #3342

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

```release-note
获取用户信息的 API 响应体包含关联角色信息
```
2023-02-24 17:39:34 +08:00
guqing 9fff768134
perf: cannot be accessed for a long time during startup (#3300)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x
#### What this PR does / why we need it:
能通过注册 pattern 作为路由的就直接注册 pattern 以避免 Reconciler 还没结束而无法注册路由导致的访问问题。
1. 文章、标签、分类的 permalink 规则会记录在对应 extension  的 annotations 中为  `content.halo.run/permalink-pattern: some-pattern` ,当系统设置中路由规则改变时会刷一遍这些资源的 `content.halo.run/permalink-pattern` annotation。
3. 自定义页面的访问是通过 SinglePageRoute 控制,它会在 single page 添加、更新、删除时维护 quickRouteMap 的集合,在路由到它时直接通过 request path 查找 map key,找到则直接返回 HandleFunction。
4. 除了自定义页面外其他都是通过 ThemeCompositeRouterFunction 作为路由管理器,系统启动时文章等的 RouterFunction 会被生成并缓存到 cachedRouters 的一个 List 集合中,当路由规则改变会清理它重新赋值。

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

Fixes #3254 

#### Special notes for your reviewer:
how  to test it?
1.  测试首页、文章、标签、分类、归档页、自定义页面和作者页等的访问。
6. 测试添加、删除资源和修改系统路由规则后上述资源的访问。
7. 测试分页路径如 /tags/slug/page/1 的访问。

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
 优化启动时页面长时间无法访问的问题
```
2023-02-24 17:38:44 +08:00
guqing ce80ed4283
fix: i18n unit test (#3388)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
修复 i18n 的单元测试,在中文或其他除了英语之外的系统语言的环境下断言无法通过
<img width="883" alt="image" src="https://user-images.githubusercontent.com/38999863/221122828-b3cb2139-21ff-4e44-8ee8-62326aa249bc.png">

可以将系统语言设置为其他来测试此 PR 不会出现上述问题即可

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-02-24 08:40:13 +00:00
John Niang 0d9ec4f197
Report test result using Jacoco plugin (#3385) 2023-02-24 15:51:21 +08:00
Ryan Wang 9ae08cdd9b fix: the issue that the useSlugify hook may cause the value to be undefined (halo-dev/console#884)
#### What type of PR is this?

/kind bug

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

修复新建分类和标签之后再次打开表单,别名显示为 undefined 的问题。

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

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

#### Special notes for your reviewer:

测试方式:

1. 新建分类或者标签,创建完成之后再次打开创建表单,检查别名是否还为 undefined。

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

```release-note
修复 Console 端新建分类和标签之后再次打开表单,别名显示为 undefined 的问题。
```
2023-02-24 07:10:12 +00:00
Ryan Wang 11d9cf669d perf: improve the conditions for categories and tags automatic refresh (halo-dev/console#883)
#### What type of PR is this?

/kind improvement

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

优化分类和标签管理页面自动刷新的条件,现在支持检测 `status.permalink` 是否已经生成完毕,如果没有会自动刷新列表。

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

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

#### Special notes for your reviewer:

测试方式:

1. 测试添加若干分类和标签,观测在没有生成 permalink 的情况下,是否会自动刷新列表。

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

```release-note
优化 Console 端分类和标签管理的自动刷新条件,支持检测固定链接是否已经生成。
```
2023-02-24 06:28:13 +00:00
guqing 7a0ba922af
refactor: APIs returns ghost users when user is deleted (#3373)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
用户被删除时关联到的用户返回 ghost 用户信息

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

Fixes #3356

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
用户被删除时关联到的用户返回 ghost 用户信息
```
2023-02-24 06:24:12 +00:00
Ryan Wang 6e5a78488c refactor: request api of user data (halo-dev/console#882)
#### What type of PR is this?

/kind improvement

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

重构获取用户信息的请求方式,无需再请求所有角色即可获取当前用户的角色信息,适配:https://github.com/halo-dev/halo/pull/3372

相关 PR:https://github.com/halo-dev/console/pull/847

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

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

#### Special notes for your reviewer:

测试方式:

1. Halo 需要切换到 https://github.com/halo-dev/halo/pull/3372 分支。
2. Console 需要 `pnpm install && pnpm build:packages`
3. 测试用户列表、登录、检查角色信息是否显示正确。

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

```release-note
优化 Console 端用户角色标识的显示名称。
```
2023-02-24 06:06:14 +00:00
Ryan Wang 7968ebe1a8 refactor: use tanstack query to refactor post-related fetching (halo-dev/console#879)
#### 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-24 04:10:13 +00:00
John Niang 937573e6b2
Upgrade to Spring Boot 3.0.3 (#3379)
#### What type of PR is this?

/kind cleanup
/area core

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

Upgrade to Spring Boot 3.0.3. See https://github.com/spring-projects/spring-boot/releases/tag/v3.0.3 for more.

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

```release-note
Upgrade to Spring Boot 3.0.3.
```
2023-02-24 03:20:12 +00:00
John Niang ce85b98539
Discard watch when extension status is changed only (#3362)
#### What type of PR is this?

/kind improvement
/area core

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

This PR mainly creates two things:

1. Create JsonExtension to represent any extension and make extension modification more convenient
2. Discard watch when we detect that the extension status is changed only. It's useful to prevent infinite loop of reconciler.

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

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

#### Special notes for your reviewer:

Try to install test plugin from [plugin-comment-widget.zip](https://github.com/halo-dev/halo/files/10799875/plugin-comment-widget.zip) before checking out this PR. You will get a infinite reconciliation loop.

Then, stop the process and checkout this PR and see the result.

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

```release-note
None
```
2023-02-23 10:24:12 +00:00
Ryan Wang b0e60f8b6d refactor: remove default cover from user profile page (halo-dev/console#881)
#### 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/2851

#### Screenshots:

<img width="1680" alt="image" src="https://user-images.githubusercontent.com/21301288/220852412-6732c965-ae43-441e-b99a-af3d6d978d4f.png">


#### Special notes for your reviewer:

None

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

```release-note
移除 Console 端个人资料页面的默认背景图片
```
2023-02-23 10:12:12 +00:00
guqing 3a1587bab5
refactor: add creationTime field for comment extension to resolve migration issue (#3341)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x
/kind api-change

#### What this PR does / why we need it:
1. spec 中新增 creationTime
2. 旧数据的 spec.creationTime 默认等于 approvedTime
3. 按照 metadata.creationTimestamp 排序的使用 spec.creationTime 代替

how to test it?
1. 使用迁移插件迁移看评论和回复的排序是否正确
2. 使用评论插件创建评论和回复看顺序是否正确
#### Which issue(s) this PR fixes:
Fixes #3330

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

```release-note
评论和回复新增创建时间以兼容迁移数据的排序
```
2023-02-23 10:06:12 +00:00
guqing 6c2064f1e0
feat: plugin supports configuration when not started (#3355)
#### What type of PR is this?
/kind feature
/milestone 2.3.x
/area core
/area plugin

#### What this PR does / why we need it:
顺便重构了一下插件 Reconciler ,否则经常容易出 bug,刚好一起测试一下免得反复整体测试这一块。
1. 插件 status 里的 message 和 reason 之前是直接放在 status 里的,现在改为一个 ConditionList, 最新的始终在 ConditionList 的第一个,这可以避免插件启动成功时还能在 message 上看到错误信息会很奇怪
2. 插件的 Setting 只会在卸载时删除,停止时不进行删除
3. 插件启动和停止状态的调和能从 CREATED、DISABLED、RESOLVED、STARTED、STOPPED、FAILED 这些状态之间进行循环过渡,如插件当前状态为 CREATED 期望达到 STARTED 则可能会经历 CREATED -> RESOLVED -> STARTED( -> FAILED) 这些过渡, 逻辑更清晰

Console 需要适配:
1. 需要去掉插件启动时才加载 Setting 的判断,让其在插件停用时也能加载
2. 需要修改发生错误时的字段取值,显示 conditons[0] 
#### Which issue(s) this PR fixes:

Fixes #3352

#### Special notes for your reviewer:
how to test it?
1. 测试在开发模式和生产模式下插件启用/设置/配置是否正常
2. 测试开发模式下插件启动失败后修复问题重启 halo 后能否正常启用
3. 测试插件卸载后 setting 是否被正确删除
4. 测试插件 logo 相对路径和 url 是否都能正常显示
5. 测试评论插件启动成功后主题端是否能显示评论列表(验证扩展点加载是否正常)
6. 测试插件配置了 settingName 但没有对应的 Setting 时的情况看 Reconciler 重试时间是否增长

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
允许插件在未启动时更改设置
```
2023-02-23 09:26:12 +00:00
Li 2dba8d0dbb fix: default value of formkit schema is not initialize in annotation form (halo-dev/console#880)
#### What type of PR is this?
/kind bug
/milestone 2.3.x
/area console

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

#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3357

#### Special notes for your reviewer:
测试使用主题/插件自定义的元数据信息,是否能够在 console 中显示默认值。

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

```release-note
使用主题/插件配置的元数据将能够展示默认值
```
2023-02-23 09:16:11 +00:00
Ryan Wang fbcd6bf037 refactor: use tanstack query to refactor attachments-related fetching (halo-dev/console#878)
#### 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-02-23 09:08:12 +00:00