#### What type of PR is this?
/kind documentation
#### What this PR does / why we need it:
更新 [Repobeats analytics](https://repobeats.axiom.co/) 的图片源,之前因为修改仓库名,导致 Repobeats analytics 的统计失效。
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0
#### What this PR does / why we need it:
当删除文章或自定义页面时级联删除内容快照和评论及计数器
see also #2602
#### Which issue(s) this PR fixes:
Fixes#2599
#### Special notes for your reviewer:
how to test it?
1. 新建一篇文章并创建一些评论(需要安装评论插件 [plugin-comment-widget](https://github.com/halo-sigs/plugin-comment-widget))
2. 逻辑删除文章时评论不会被删除,真实删除则会
3. 新建一个文章,再删除它,然后查询 snaphost 模型看关联文章的数据有没有被删除
4. 自定义页面同上
5. 删除文章或自定义页面时会删除对应的 Counter 记录(`GET /apis/metrics.halo.run/v1alpha1/counters`)
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
修复删除文章或自定义页面时没有级联删除内容快照和评论的问题
```
#### What type of PR is this?
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
移除在 Git Commit 之前运行单元测试和类型检查的步骤。因为目前 main 分支处于保护分支,无法直接推送代码。所以仅在 PR 中的 Action 来运行这两个步骤即可。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
插件和主题管理的 Logo 改为使用 `Avatar` 组件。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:检查主题和插件相关的管理页面是否正常加载 Logo。
#### Does this PR introduce a user-facing change?
```release-note
插件和主题管理的 Logo 改为使用 `Avatar` 组件。
```
#### What type of PR is this?
/kind feature
/milestone 2.0
#### What this PR does / why we need it:
为部分功能数据列表添加刷新按钮。
#### Screenshots:
<img width="1664" alt="image" src="https://user-images.githubusercontent.com/21301288/197397277-353befe4-8c43-4326-9ad5-64d2888dc4a3.png">
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:
1. 需要 `pnpm build:packages`
2. 测试点击刷新按钮是否可以正常请求接口。
#### Does this PR introduce a user-facing change?
```release-note
为部分功能数据列表添加刷新按钮。
```
#### What type of PR is this?
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
发布 `@halo-dev/components` `@halo-dev/console-shared` 版本。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0
#### What this PR does / why we need it:
Use CopyOnWriteArrayList on SchemeManager to prevent concurrent modification when link plugin is installed.
#### How to test?
1. Install link plugin
2. Restart Halo
3. Delete any extensions
4. Check the result
#### Does this PR introduce a user-facing change?
```release-note
修复数据一直处于删除中的错误
```
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
#### What this PR does / why we need it:
提供主题端站点统计信息查询器
#### Which issue(s) this PR fixes:
Fixes #
#### Special notes for your reviewer:
how to test it?
在任意主题页面使用如下语法
```
<p th:text="${siteStatsFinder.getStats()}"></p>
```
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
提供主题端站点统计信息查询器
```
#### What type of PR is this?
/kind api-change
/kind bug
#### What this PR does / why we need it:
更新 `@halo-dev/api-client` 以修复文章访问数据不正确的问题。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
#### Does this PR introduce a user-facing change?
```release-note
更新 `@halo-dev/api-client` 以修复文章访问数据不正确的问题。
```
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
#### What this PR does / why we need it:
修改仪表盘统计返回类型的名称避类名相同时 swagger api 的 schema 被覆盖
#### 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
```
#### What type of PR is this?
/kind improvement
/area core
#### What this PR does / why we need it:
Remove custom schema validation and make field metadata.name of extension required. So that the API client generated by `openapi-gen` will be more consistent than before.
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0
#### What this PR does / why we need it:
修复分类树查询
#### Which issue(s) this PR fixes:
Fixes#2532
#### Special notes for your reviewer:
how to test it?
1. 新建分类并,并拖动构建一个树形
2. 在主题端通过 `categoryFinder.listAsTree()` 查看结果是否正确
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
修复分类树状数据查询
```
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0
#### What this PR does / why we need it:
修复主题列表数据类型转换问题
#### Which issue(s) this PR fixes:
Fixes #
#### Special notes for your reviewer:
how to test it?
访问如下 API 不报错即可
```
curl http://localhost:8090/apis/api.console.halo.run/v1alpha1/themes?uninstalled=false
```
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
#### What this PR does / why we need it:
See https://github.com/halo-dev/halo/issues/2309 for more.
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2309
#### Special notes for your reviewer:
#### Does this PR introduce a user-facing change?
```release-note
新增 generateName 字段用于自动生成自定义模型名称
```
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core
/kind api-change
#### What this PR does / why we need it:
新增 API 用于查询未安装的主题
#### Which issue(s) this PR fixes:
Fixes#2554
#### Special notes for your reviewer:
how to test it?
1. 安装几个主题
2. 直接解压几个主题到 work dir 的 themes 目录
3. 使用以下 endpoint 查询未安装的主题,期望获得所有未安装主题的 themes.yaml 信息
```
/apis/api.console.halo.run/v1alpha1/themes?uninstalled=true
```
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
支持扫描主题目录下未安装的主题
```
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core
#### What this PR does / why we need it:
允许插件通过实现 TemplateHeadProcessor 接口来修改主题模板的 head 标签
#### Which issue(s) this PR fixes:
how to test it?
1. 克隆 https://github.com/halo-sigs/plugin-umami
2. build 一个 jar 包作为插件使用
3. 配置 plugin-umami 后能在主题页的 head 标签看到一个用于 umami 统计的 script 标签
Fixes #
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
#### What this PR does / why we need it:
优化主题端菜单项查询
#### Which issue(s) this PR fixes:
Fixes#2564
#### Special notes for your reviewer:
how to test it?
使用 menuFinder.getDefault() 方法测试多级菜单项的排序及新增
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
修复主题端菜单查询数据错误问题
```
#### What type of PR is this?
/kind feature
/milestone 2.0
#### What this PR does / why we need it:
Ref https://github.com/halo-dev/halo/issues/2526#issuecomment-1273094868
FormKit 文档:https://formkit.com/advanced/custom-inputs
通过扩展 FormKit 的自定义 Input,提供系统常用资源的选择组件。
目前提供如下类型:
- menuCheckbox
- menuRadio
- menuItemSelect
- postSelect
- categorySelect
- tagSelect
- singlePageSelect
- categoryCheckbox
- tagCheckbox
FormKit 组件的使用方式:
```vue
<FormKit
placeholder="请选择文章"
label="文章"
type="postSelect"
validation="required"
/>
```
FormKit Schema 的使用方式:
```yaml
- $formkit: menuRadio
name: menus
label: 底部菜单组
```
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2526
#### Screenshots:
<!--
如果此 PR 有 UI 的改动,最好截图说明这个 PR 的改动。
If there are UI changes to this PR, it is best to take a screenshot to illustrate the changes to this PR.
eg.
Before:

After:

-->
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:
1. 检查后台文章设置弹框的选择分类和标签功能是否正常。
2. 检查后台添加菜单项的功能是否正常。
3. 使用主题或者插件定义 settings.yaml,使用上述任意 input 类型,检查得到的效果和值是否正常。
#### Does this PR introduce a user-facing change?
```release-note
通过扩展 FormKit 的自定义 Input,提供系统常用资源的选择组件。
```
#### What type of PR is this?
/kind feature
/milestone 2.0
#### What this PR does / why we need it:
为登录操作和加载插件资源添加异常提示。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2534
#### Screenshots:
<img width="650" alt="image" src="https://user-images.githubusercontent.com/21301288/196105634-ece58153-d9e0-450d-8068-8cda1bed8bcc.png">
<img width="634" alt="image" src="https://user-images.githubusercontent.com/21301288/196105704-e3a59808-8a33-456d-b668-13e891512353.png">
#### Special notes for your reviewer:
目前还没有处理全局的接口请求异常,需要后端修改异常返回结构。
/cc @halo-dev/sig-halo-console
#### 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
为登录操作和加载插件资源添加异常提示。
```
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
#### What this PR does / why we need it:
模板渲染自动填充 Favicon 到 head 标签
#### Which issue(s) this PR fixes:
Fixes#2581
#### Special notes for your reviewer:
how to test it?
在 console 系统设置 -> 基础设置 填写 Favicon 后,到主题端能到看它
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
支持设置 Favicon
```
#### What type of PR is this?
/kind api-change
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
重构 Dialog 组件使用 API 的调用方式,改为与 Toast 组件一致。https://github.com/halo-dev/console/pull/644
同样的,使用此方式调用 Dialog 组件不限制在 Vue 组件。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
需要测试后台各个操作的会话框是否正常。
#### Does this PR introduce a user-facing change?
```release-note
重构 Dialog 组件使用 API 的调用方式。
```
#### What type of PR is this?
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
升级 `@halo-dev/api-client` 版本以适配 Attachment 资源的自定义 Endpoint。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:
1. 需要 `pnpm install`。
2. 测试附件列表和上传的功能。
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0
/kind api-change
#### What this PR does / why we need it:
1. Disable CSRF token check for RESTful APIs but login and logout APIs.
2. Enable CORS check for login and logout APIs
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2571
#### How to test?
1. Install a valid theme and create a sample post
2. View the post at theme end
3. Check the response of counter API
#### Does this PR introduce a user-facing change?
```release-note
禁用对 RESTful API 的 CSRF 检查
```
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
#### What this PR does / why we need it:
对反向代理规则注册增加重复注册检查
场景:
ReverseProxyRouterFunctionRegistry 中有一个 pluginIdReverseProxyMap 记录了 插件名称和插件的 ReverseProxy 名称对应关系
当重复 fake-plugin -> test-reverse-proxy 时,pluginIdReverseProxyMap 的 value 不会去重,因此需要增加重复注册检查
#### Which issue(s) this PR fixes:
Fixes #
#### Special notes for your reviewer:
how to test it?
本 PR 不需要测试,已经对上述场景添加了单元测试
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
/kind api-change
#### What this PR does / why we need it:
重构插件 JsBundle 文件加载方式及路由规则
- 将插件静态资源的访问路由规则从 /assets/{plugin-name}/** 改为 /plugins/{plugin-name}/assets/** 与主题静态资源规则结构一致
- 默认在 Halo 中提供 /plugins/{plugin-name}/assets/console/** 路由以确保插件都能加载到最基础的 JsBundle 文件
#### Which issue(s) this PR fixes:
Fixes#2555
#### Special notes for your reviewer:
how to test it?
1. 安装并启用一个插件能访问到 `/plugins/{plugin-name}/assets/console/main.js` 和 `/plugins/{plugin-name}/assets/console/style.css` 即为功能正确
2. 在插件的 extensions 目录创建一个 reverse proxy 的自定义模型 yaml 资源,并使用此插件,插件反向代理规则能正确访问到文件即为功能正确
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
重构插件 JsBundle 文件加载方式及路由规则
```
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
/kind api-change
#### What this PR does / why we need it:
新增文章和评论等资源的点赞和踩 API
#### Which issue(s) this PR fixes:
Fixes#2565
#### Special notes for your reviewer:
how to test it?
1. 创建并发布一篇文章 替换下面的 `your-post-name` 然后执行它
```curl
curl --location --request POST 'http://localhost:8090/apis/api.halo.run/v1alpha1/trackers/upvote' \
--header 'Content-Type: application/json' \
--data-raw '{
"group": "content.halo.run",
"plural": "posts",
"name": your-post-name
}
```
2. 请求成功并得到 response 为点赞数
3. 踩的 API 为 `http://localhost:8090/apis/api.halo.run/v1alpha1/trackers/downvote` 请求体与步骤1相同的测试方法
4. 重启 Halo 后 Counter 数据应该依然存在并且正确
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
新增文章和评论等资源的点赞和踩 API
```
#### What type of PR is this?
/kind documentation
#### What this PR does / why we need it:
修复在 Windows 平台下无法正常运行 `build:packages` 等脚本的问题。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2568
#### Does this PR introduce a user-facing change?
```release-note
NONE
```
#### What type of PR is this?
/kind feature
/area console
#### What this PR does / why we need it:
```bash
╰─❯ make help
all lint and test code
install install dependencies
build build console
lint lint code
test run tests
help print this help
```
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind documentation
#### What this PR does / why we need it:
The README.md is out of date due to [2.0.0-alpha.2](https://github.com/halo-dev/halo/releases/tag/v2.0.0-alpha.2) released.
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind documentation
#### What this PR does / why we need it:
目前 Halo 处于多版本同时并存发行的现状,所以在各个分支(main、release-1.5、release-1.6)维护 CHANGELOG.md 会变得比较麻烦。所以考虑移除掉仓库内的 CHANGELOG.md 文件,后续以 [releases](https://github.com/halo-dev/halo/releases) 页面提供。
Ref https://github.com/halo-dev/halo/issues/2538
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2538
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0
#### What this PR does / why we need it:
When we initialize default extensions at Halo startup, updation of one extension is very likely to be failed due to modification conflict. Then, remaining extensions won't be updated anymore.
Therefore, this PR resolve this problem by retrying updation with 3 times with interval 100ms and continue extension updation if modification conflict occurs.
#### How to test
1. Fully initialize system(e.g.: Clear `~/halo-next` before starting Halo)
2. Update Role `authenticated` as you wish via Extension API
3. Restart Halo and check it again
4. Retry multiple times
#### Does this PR introduce a user-facing change?
```release-note
修复系统默认数据无法正常更新的问题
```
#### What type of PR is this?
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
将开发环境的访问根路径改为 `/console`,即 `http://localhost:3000/console`,方便后续 Halo 对此地址进行反向代理,保证同源。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:启动之后访问 <http://localhost:3000/console>,检查控制台是否有资源加载异常。
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
#### What this PR does / why we need it:
Support proxying console in server side. We just need to configure the properties as following:
```yaml
halo:
console:
proxy:
endpoint: http://localhost:3000/
enabled: true
```
Before starting Halo server, please start the console first at port 3000 by checkouting https://github.com/halo-dev/console/pull/638.
Now we can have a try to access console via <http://localhost:8090/console/>.
Please note that this feature should be only for development environment instead of production environment.
#### Todos
- [ ] Proxy WebSocket for hmr of Vite
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2530
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
优化用户登录的逻辑。 适配:https://github.com/halo-dev/halo/pull/2528
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2506
#### Special notes for your reviewer:
#### Does this PR introduce a user-facing change?
```release-note
优化用户登录的逻辑
```
#### What type of PR is this?
/kind improvement
/kind api-change
/area core
/milestone 2.0
#### What this PR does / why we need it:
Please see b092b390b7/docs/authentication/README.md
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2506
#### Special notes for your reviewer:
#### Does this PR introduce a user-facing change?
```release-note
优化系统登录和登出逻辑
```
#### What type of PR is this?
/kind documentation
/milestone 2.0
#### What this PR does / why we need it:
更新 README,提供 Halo 2.0 的演示环境信息。
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
#### What this PR does / why we need it:
优化系统角色模板配置
- 认证用户仅具有名为 system-states 的 ConfigMap 查看权限而非所有 ConfigMap查看权限
- 主题和插件的管理权限目前需要单独勾选 ConfigMap 和 Setting 的权限才可以看到表单和值
#### Which issue(s) this PR fixes:
Fixes#2523
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
None
```