#### What type of PR is this?
/kind bug
#### What this PR does / why we need it:
To fix that default earth theme file not found in system initialization.
#### Which issue(s) this PR fixes:
Fixes#2910
#### Special notes for your reviewer:
#### Does this PR introduce a user-facing change?
```release-note
NONE
```
#### What type of PR is this?
/kind feature
/kind api-change
/area core
#### What this PR does / why we need it:
为主题和插件提供重置设置项 API
此 PR 会重新读取配置对应的 Setting 资源,从其中读取默认值后更新到现有的 ConfigMap 中替换其 data
see #2789 for more details
#### Which issue(s) this PR fixes:
Fixes#2789
#### Special notes for your reviewer:
how to test it?
1. 在主题设置或插件设置配置一些设置项后保存
2. 执行重置配置
3. 配置恢复为了 Setting 中指定的默认值
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
为主题和插件提供重置设置项 API
```
#### What type of PR is this?
/kind improvement
#### What this PR does / why we need it:
通过在模板引擎管理器里添加clearCache方法,在升级主题后进行缓存刷新,让新模板内容生效。
#### Which issue(s) this PR fixes:
Fixes#2953
#### Special notes for your reviewer:
#### Does this PR introduce a user-facing change?
```release-note
NONE
```
#### What type of PR is this?
/kind improvement
#### What this PR does / why we need it:
/kind api-change
#### Which issue(s) this PR fixes:
Fixes#2591
#### Special notes for your reviewer:
#### 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:
This PR separates security configuration of RESTful APIs and portal pages to configure specific headers for portal pages, such as `Referrer-Policy` and `X-Frame-Options`.
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2900
#### Special notes for your reviewer:
You can see the response headers of index page:
```diff
HTTP/1.1 200 OK
Content-Type: text/html
Content-Language: en-US
+ X-Content-Type-Options: nosniff
+ X-Frame-Options: SAMEORIGIN
+ X-XSS-Protection: 0
+ Referrer-Policy: strict-origin-when-cross-origin
content-encoding: gzip
content-length: 4285
```
and request headers with `Referer`:
```diff
GET / HTTP/1.1
Host: localhost:8090
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
+ Referer: http://localhost:8090/archives/12341234
Connection: keep-alive
Cookie: _ga_Z907HJBP8W=GS1.1.1670164888.1.1.1670165603.0.0.0; _ga=GA1.1.807839437.1670164889; SESSION=539e060e-c11e-4b6d-a749-882905b30a88; XSRF-TOKEN=4b692b55-638c-4497-8a4b-be00986eda90
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
```
#### Does this PR introduce a user-facing change?
```release-note
解决访问分析工具无法显示 referer 的问题
```
#### What type of PR is this?
/kind improvement
#### What this PR does / why we need it:
升级 `@halo-dev/richtext-editor` 版本,解决以下问题:
1. 修复嵌入网页不会回显的问题。 c8cfe8f7b1
2. 添加 HTML 语法的代码块高亮。 8d27ae81ee
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2924
Fixes https://github.com/halo-dev/halo/issues/2913
#### Special notes for your reviewer:
测试方式:
1. 需要 `pnpm install`
2. 插件编辑器的代码块是否有 HTML 语言选项。
3. 插入一个嵌入网页的编辑块,保存文章之后再次进入编辑页面,检查加载是否正常。
#### Does this PR introduce a user-facing change?
```release-note
None
```
<!-- Thanks for sending a pull request! Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->
#### What type of PR is this?
/kind improvement
<!--
添加其中一个类别:
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement
适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->
#### What this PR does / why we need it:
优化归档页面数据排序,按月份降序
#### Which issue(s) this PR fixes:
<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.
用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes#2958
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### 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
归档数据按月降序
```
<!-- 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
<!--
添加其中一个类别:
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:
/kind api-change
#### 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#2951
#### Special notes for your reviewer:
#### Does this PR introduce a user-facing change?
<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->
```release-note
修复开启评论审核的情况下无法显示评论回复的问题
```
#### What type of PR is this?
/kind feature
/area core
#### What this PR does / why we need it:
主题端支持异常模板页面
异常模板必须放在主题目录的 `templates/error` 目录下:
- 支持按照 response status 名称模板页面,例如 404.html ,当发生 404 错误时会使用 404.html
- 支持 4xx.html、5xx.html,例如当发生 403 错误时,如果存在 403.html 则使用此页面,否则使用 4xx.html
error 模板中具有 model 示例:
```json
{
"error": {
"type": "about:blank",
"title": "Not Found",
"status": 404,
"detail": "Extension run.halo.app.core.extension.Plugin with name amet ut magn not found",
"instance": "/apis/plugin.halo.run/v1alpha1/plugins/amet%20ut%20magn"
}
}
```
#### Which issue(s) this PR fixes:
Fixes#2690
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
主题端支持异常模板页面
```
#### What type of PR is this?
/kind improvement
/area core
#### What this PR does / why we need it:
HaloPluginManager 移除 getRootApplicationContext 方法
#### Which issue(s) this PR fixes:
Fixes#2943
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
HaloPluginManager 移除 getRootApplicationContext 方法
```
#### What type of PR is this?
/kind improvement
/area core
#### What this PR does / why we need it:
Now, we can pass command-line arguments while using Docker. Please refer to <https://github.com/halo-dev/halo/issues/2902>.
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2902
#### Special notes for your reviewer:
Steps to test:
1. Run Halo with command-line arguments:
```bash
docker run --rm -it -p6666:6666 johnniang/halo:support-command-line-args --server.port=6666
```
1. Request <http://localhost:6666>
```bash
curl -v http://localhost:6666
```
#### 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
支持命令行参数启动 Halo
```
#### What type of PR is this?
/kind feature
/area core
#### What this PR does / why we need it:
为主题端新增作者页面
see #2837 for more detail
#### Which issue(s) this PR fixes:
Fixes#2837
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
主题端支持作者页面
```
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.1.x
#### What this PR does / why we need it:
Force to add environment variables `HALO_WORK_DIR` and `SPRING_CONFIG_LOCATION` into Dockerfile. After that, we can configure `application.yaml` in working directory as we want.
Please note that we can not configure Halo working directory in `/root/.halo2/application.yaml` directly. Use environment variable `HALO_WORK_DIR` instead.
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2812
#### Special notes for your reviewer:
Steps to test:
1. Prepare custom configuration
```bash
mkdir -p halo2
cat <<EOF > halo2/application.yaml
server:
port: 12345
EOF
```
2. Start up Halo using Docker
```bash
docker run -it --rm -p12345:12345 -v `pwd`/halo2:/root/.halo2 johnniang/halo:configure-halo-in-work-dir
```
3. Request http://localhost:12345
```bash
curl -v localhost:12345
```
#### Does this PR introduce a user-facing change?
```release-note
支持在工作目录添加自定义配置
```
#### What type of PR is this?
/kind bug
/area core
#### What this PR does / why we need it:
修复插件 logo 为相对路径时先启用再停后就无法加载 logo 的问题
原因是 reverse proxy reconciler 资源被删除要取消注册路由时没有确切指定名称,logo 这样的 ReverseProxy 是插件安装时初始化的这条初始化的规则要跟随插件的生命周期,只有插件卸载时才会被删除,而在此之前插件被停止时就被误取消注册了
see #2937 for more detail
#### Which issue(s) this PR fixes:
Fixes#2937
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
修复插件 logo 为相对路径时先启用再停后就无法加载 logo 的问题
```
#### What type of PR is this?
/kind bug
/area core
#### What this PR does / why we need it:
修复插件开发模式下后续增加的 fixedPluginPath 项无法被加载的问题
- 目前启动时会加载 pluginRepository 的所有 path,fixedPluginPath 被 DefaultDevelopmentPluginRepository 管理,所以在遍历 fixedPluginPath 加载时可能已经被加载过,需要判断是否被加载过,但即使被加载过也不能跳过而要继续执行创建/更新 plugin.yaml 资源的逻辑
- 创建/更新 plugin.yaml 时需要使用重试机制防止因为乐观锁冲突导致 Halo 无法启动
see #2939 for more detail
#### Which issue(s) this PR fixes:
Fixes#2939
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
修复插件开发模式下后续增加的 fixedPluginPath 项无法被加载的问题
```
#### What type of PR is this?
/kind improvement
#### What this PR does / why we need it:
将 http 请求体的最大字节数改为 10m。
Ref https://github.com/halo-dev/halo/issues/2861#issuecomment-1339526589
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2861
#### Special notes for your reviewer:
测试方式:
1. 在 Console 端新建文章,保存大量文本内容(最快方式是截图或者复制图片到编辑器,这时候因为会转为 base64,所以内容会很大)
2. 保存文章,检查是否成功。
#### Does this PR introduce a user-facing change?
```release-note
修改 HTTP 请求体最大字节数的限制,修复保存大内容文章异常的问题。
```
#### What type of PR is this?
/kind improvement
#### What this PR does / why we need it:
优化创建 commit 前的 prettier 和 ESLint 流程,使用 [lint-staged](https://www.npmjs.com/package/lint-staged),可以仅处理在 Git 缓存区的文件。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2928
#### Screenshots:
#### Special notes for your reviewer:
#### 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:
重构访问量统计逻辑
1. 去掉了访问量总数存储在 Meter Counter 中的逻辑,因为迁移时是直接像 Counter 自定义模型创建数据,而文章被访问时是存储在 Meter Counter 后定时同步到数据库,这就存在双向同步问题且都有新数据无法知道该如何合并数据。
2. 目前访问时会发送一个事件,当得到事件后会缓存在队列中,每隔一分钟将增量更新到数据库中
3. 评论统计也去掉了 Meter Counter 改为事件队列处理
4. 如果后续要暴露 Metrics 应该使用 Gauge 监控 Counter 自定义模型
5. Counter 自定义模型的查询优化后续可以使用 Indexer 或者加缓存来实现而非将 Meter Counter 当作缓存
#### Which issue(s) this PR fixes:
Fixes#2820
#### Special notes for your reviewer:
1. 测试迁移导入看文章访问量是否正确
2. 创建评论及回复观察未读回复数量、评论回复数、最新回复时间是否正确
3. 多创建一些回复然后删除评论,看是否正确删除
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
重构访问量统计逻辑,修复文章visits无法迁移的问题
```
#### What type of PR is this?
/kind improvement
/milestone 2.1.x
#### What this PR does / why we need it:
移除与表单相关的组件,比如 `VInput`、`VSelect` 等,以后均使用 FormKit 提供的表单元素
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2905
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### What type of PR is this?
/kind bug
/area core
#### What this PR does / why we need it:
Shutdown AsyncLogWriter on VM exit.
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2901
#### Does this PR introduce a user-facing change?
```release-note
None
```
#### 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/2906
#### Special notes for your reviewer:
测试方式:
1. 进入新建文章页面。
2. 点击右上角发布按钮,填写必要的标题和别名,然后点击保存。
3. 点击右上角设置按钮,切换到高级设置,再次点击保存。
4. 观察是否正常保存。
#### Does this PR introduce a user-facing change?
```release-note
修复 Console 端文章设置中的发布时间为空字符串时,无法保存的问题。
```
#### What type of PR is this?
/kind bug
/area core
#### What this PR does / why we need it:
修复自定义页面没有统计访问量的问题
#### Which issue(s) this PR fixes:
Fixes#2912
#### Special notes for your reviewer:
how to test it?
创建自定义页面并到主题端访问,可以看到访问量增加
/cc @halo-dev/sig-halo
#### Does this PR introduce a user-facing change?
```release-note
修复自定义页面没有统计访问量的问题
```
#### What type of PR is this?
/kind improvement
/area core
#### What this PR does / why we need it:
在插件开发模式下加载插件失败时不抛出异常改为静默提示
#### Which issue(s) this PR fixes:
A part of #2901
#### Special notes for your reviewer:
how to test it?
1. 配置 `halo.plugin.fixed-plugin-path` 为一些不合法的插件项目路径不影响 Halo 正常启动,且有错误提示
2. 配置合法路径,插件能正确启动
#### Does this PR introduce a user-facing change?
```release-note
插件开发模式下无法被加载时改为静默提示不抛出异常
```
#### What type of PR is this?
/kind documentation
#### What this PR does / why we need it:
更新 Readme 中快速开始的命令,提供初始管理员账号和外部访问链接的环境变量设置。
```release-note
None
```
#### What type of PR is this?
/kind documentation
#### What this PR does / why we need it:
为 Halo 2.0 正式版更新 Readme。
#### 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:
Bump halo version to 2.1.0-SNAPSHOT for next release.
#### Which issue(s) this PR fixes:
```release-note
None
```
#### What type of PR is this?
/kind bug
/milestone 2.0.1
#### What this PR does / why we need it:
修复插件停止时,仍然获取设置选项导致提示失败的问题。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2866
#### Special notes for your reviewer:
测试方式:
1. 安装一个插件,将其停止之后检查是否有获取 setting 的请求以及页面上是否有提示。
#### Does this PR introduce a user-facing change?
```release-note
修复在 Console 端停止插件时,仍然获取设置选项导致显示失败提示的问题。
```
#### What type of PR is this?
/kind improvement
#### What this PR does / why we need it:
优化主题和插件详情页面切换 tab 时的页面闪动问题。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2856
#### Special notes for your reviewer:
测试方式:检查在主题和插件详情页面是否还存在 https://github.com/halo-dev/halo/issues/2856 中提到的问题。
#### Does this PR introduce a user-facing change?
```release-note
优化 Console 端的主题和插件详情页面切换选项卡时的页面闪动问题。
```
#### What type of PR is this?
/kind bug
/milestone 2.0.1
#### What this PR does / why we need it:
修复在生产环境,激活主题之后,界面数据没有更新的问题。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2850
#### Special notes for your reviewer:
测试方式:
1. 使用 `pnpm build` 构建此 PR。
2. 在 Halo 配置 `halo.console.location` 为 Console 项目的 dist 目录,比如:`file:/Users/ryanwang/Workspace/github/ruibaby/halo-console/dist/`
3. 安装若干主题,激活其中一个,检查页面 UI 元素是否更新。
#### Does this PR introduce a user-facing change?
```release-note
修复 Console 端激活主题之后页面没有更新数据的问题。
```
#### What type of PR is this?
/kind bug
/area core
#### What this PR does / why we need it:
Add forgotten label `rbac.authorization.halo.run/system-reserved` for system-reserved roles. See the screenshot below:

#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2844
#### Special notes for your reviewer:
For @halo-dev/sig-halo-console : We have to determine whether the role is system-reserved by checking if label `rbac.authorization.halo.run/system-reserved` is equal to `true`.
#### 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 bug
#### What this PR does / why we need it:
修改主题升级文案
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2857
#### Does this PR introduce a user-facing change?
```release-note
None
```