Commit Graph

2410 Commits (release-2.1)

Author SHA1 Message Date
John Niang 53c16b5924
Correct console ref while building on branch release-2.1 (#3493)
#### What type of PR is this?

/kind cleanup
/area core

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

Correct console ref while building on branch release-2.1. After that, we can build Halo and console on same branch(release-2.1) instead of main branch of console.

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

```release-note
None
```
2023-03-08 15:02:13 +00:00
John Niang 6c86ecb9e4
Bump up checkout and setup-java actions for release-2.1 branch (#3439)
#### What type of PR is this?

/kind cleanup

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

I have to manually make those changes due to <https://github.com/halo-dev/halo/pull/3368#issuecomment-1449292283>.

See https://github.com/halo-dev/halo/pull/3368 for more.

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

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

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

```release-note
None
```
2023-03-01 15:46:19 +00:00
John Niang 0bee8834df
Update halo-next-docker-build action to release-2.1 (#3430)
#### What type of PR is this?

/kind cleanup
/area core

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

For a stable workflow.

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

```release-note
None
```
2023-03-01 03:42:24 +00:00
Halo Dev Bot 4c59ebe004
[release-2.1] docs: fix command of docker run (#3417)
This is an automated cherry-pick of #3415

/assign JohnNiang

```release-note
None
```
2023-02-27 15:16:18 +00:00
Halo Dev Bot 2e491e025f
[release-2.1] Fix the problem of slug name with percent sign when publishing post (#3183)
This is an automated cherry-pick of #3179

/assign ruibaby

```release-note
修复因别名包含百分号导致无法正常访问的问题
```
2023-01-30 05:58:11 +00:00
Halo Dev Bot 6dfc2f46e0
[release-2.1] Refine docker-run command in README.md (#3099)
This is an automated cherry-pick of #3098

/assign JohnNiang

```release-note
None
```
2023-01-03 07:40:35 +00:00
John Niang 6fc27c0b8c
Bump version to 2.1.1-SNAPSHOT for next iteration (#3086)
#### What type of PR is this?

/kind cleanup
/area core

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

Bump version to 2.1.1-SNAPSHOT for next iteration.

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

```release-note
None
```
2022-12-30 04:52:38 +00:00
Ryan Wang 9245e8e7c9
chore: bump theme-earth to 1.1.1 (#3082)
#### What type of PR is this?

/kind improvement

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

将 theme-earth 默认主题升级到 1.1.1

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


```release-note
None
```
2022-12-30 02:36:34 +00:00
guqing cc891d6655
feat: add annotations expression object for thymeleaf (#3076)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.1.x
#### What this PR does / why we need it:
新增操作 annotations 的表达式对象
在 thymeleaf 模板中使用示例:
```html
<p th:text="${#annotations.get(user, 'background')}"></p>
<p th:text="${#annotations.getOrDefault(user, 'background', 'default-value')}"></p>
<p th:text="${#annotations.contains(user, 'background')}"></p>
```
#### Which issue(s) this PR fixes:

Fixes #3073

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
新增 Annotations 表达式对象用于在 thymeleaf 中操作自定义模型的 annotations
```
2022-12-29 13:30:34 +00:00
John Niang 77dd5b24dd
Cache static resources, including plugin, theme, console, attachment (#3074)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.1.x

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

Add cache control and last modified headers for responses of static resources.

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

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

#### Special notes for your reviewer:

We can check the response header of statis resources to know if the cache control is working correctly.

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

```release-note
完善静态资源的缓存策略
```
2022-12-29 10:14:32 +00:00
guqing 9d0ad5de26
refactor: remove finalizer when resources deleted completely (#3065)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
主题卸载时等待删除关联资源后再清除 Finalizer
see #2967 for more detail.
https://github.com/halo-dev/halo/issues/2967#issuecomment-1354384978

#### Which issue(s) this PR fixes:
how to test it?
- 在主题中多添加一个 AnnotationSetting 资源 yaml,测试主题删除是否正常。
- 对包 `org.springframework.retry` 开启 debug 日志后能在删除主题时看到类似如下日志:
```
16:33:02.822 [Test worker] DEBUG org.springframework.retry.support.RetryTemplate - Retry: count=0
16:33:03.128 [Test worker] DEBUG org.springframework.retry.support.RetryTemplate - Checking for rethrow: count=1
```
Fixes #2967
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
主题卸载时等待删除关联资源后再清除 Finalizer
```
2022-12-29 10:12:36 +00:00
Ryan Wang b667e988df
feat: add target attribute for menu item (#3072)
#### What type of PR is this?

/kind feature

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

为 MenuItem 模型添加 a 标签的 target 属性设置。

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

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

#### Special notes for your reviewer:

测试方式请看:https://github.com/halo-dev/console/pull/805

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

```release-note
菜单项支持设置打开方式
```
2022-12-29 10:10:33 +00:00
guqing 5dbd5a06ed
Avoid NPE problems when querying the list of posts in the console (#3068)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.1.x

#### What this PR does / why we need it:
迁移后文章过多,当文章的 Reconciler 还没有执行完时访问 Console 端文章列表会因为 post.status  为 Null 出现 NPE 问题
使用文章的 status 时需要对其进行判空

/cherry-pick release-2.0
#### Which issue(s) this PR fixes:

Fixes #3066

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

```release-note
None
```
2022-12-29 09:42:33 +00:00
John Niang 313605d52c
Provide an endpoint to update user profile (#3067)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.1.x

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

Provide an endpoint to update current user profile instead of whole user data.

##### Request example

```bash
curl -X 'PUT' \
  'http://localhost:8090/apis/api.console.halo.run/v1alpha1/users/-' \
  -H 'accept: */*' \
  -H 'Content-Type: */*' \
  -d '{
  "spec": {
    "displayName": "JohnNiang",
    "email": "johnniang@halo.run",
    "password": "xxx",
    "registeredAt": "2022-12-19T03:46:54.809770900Z",
    "twoFactorAuthEnabled": false,
    "disabled": false
  },
  "status": {
    "permalink": "http://localhost:8090/authors/admin"
  },
  "apiVersion": "v1alpha1",
  "kind": "User",
  "metadata": {
    "finalizers": [
      "user-protection"
    ],
    "name": "admin",
    "annotations": {
      "rbac.authorization.halo.run/role-names": "[\"super-role\"]"
    },
    "version": 3,
    "creationTimestamp": "2022-12-19T03:46:54.911951800Z"
  }
}'
```

##### Response example

```json
{
  "spec": {
    "displayName": "JohnNiang",
    "email": "johnniang@halo.run",
    "password": "{bcrypt}$2a$10$IBV8/q7Q6Fj78Ls5AG1eBO0bCQ.rM6vli5pAVexf/gqu.hNfjJxaq",
    "registeredAt": "2022-12-19T03:46:54.809770900Z",
    "twoFactorAuthEnabled": false,
    "disabled": false
  },
  "status": {
    "permalink": "http://localhost:8090/authors/admin"
  },
  "apiVersion": "v1alpha1",
  "kind": "User",
  "metadata": {
    "finalizers": [
      "user-protection"
    ],
    "name": "admin",
    "annotations": {
      "rbac.authorization.halo.run/role-names": "[\"super-role\"]"
    },
    "version": 5,
    "creationTimestamp": "2022-12-19T03:46:54.911951800Z"
  }
}
```

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

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

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

```release-note
提供更新当前登录用户信息功能
```
2022-12-29 03:16:33 +00:00
John Niang da55532777
Refine exception detail with i18n (#3042)
#### What type of PR is this?

/kind feature
/kind api-change
/area core
/milestone 2.1.x

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

- Configuring message source location and name enables i18n message resolution.
- Simple global error handler.
- Refactor some exceptions with `ResponseStatusException` to control what HTTP status and problem detail need to be returned.

**TODO**

- [x] Add more UTs.
#### Which issue(s) this PR fixes:

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

#### Special notes for your reviewer:

Steps to test:

1. Try to refine `src/main/resources/config/i18n/messages_zh.properties` and switch Browser language with Chinese.
2. Delibrately make a mistake as you wish and see the error tips in console.
3. Try to access one page which doesn't exist and see the rendered result.

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

```release-note
完成系统异常的国际化
```
2022-12-26 14:10:31 +00:00
Ryan Wang 3a1c264afb
chore: update default theme package (#3051)
#### What type of PR is this?

/kind improvement

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

更新默认主题。 https://github.com/halo-dev/theme-earth/releases/tag/v1.1.0

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

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

#### Special notes for your reviewer:

None

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

```release-note
更新默认主题的版本
```
2022-12-26 13:56:31 +00:00
guqing ddf47f6600
feat: add annotation setting extension (#3028)
#### What type of PR is this?
/kind feature
/milestone 2.1.x
/area core

#### What this PR does / why we need it:
新增 AnnotationSetting 自定义模型以扩展自定义元数据设置表单

主题安装/更新/重载时都会重新加载与 theme.yaml 同层级的其他 yaml,但只会保存 kind 为 Setting 和 AnnotationSetting的,主题卸载时会删除这些 yaml 资源

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

Fixes #3005

#### Special notes for your reviewer:
how to test it?
- 修改影响到了主题安装、更新、重载和删除,需要检查这些功能是否正确加载了 Setting 和 AnnotationSetting
- 插件启动时初始化的 AnnotationSetting 在插件停止时会被删除
- 主题添加了 annotation setting 资源,使用非超级管理员也可以获取

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

```release-note
新增 AnnotationSetting 以扩展自定义元数据设置表单
```
2022-12-26 13:54:36 +00:00
John Niang 9b9a57b427
Fix invalid attachment role templates (#3024)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.1.x

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

- Add missing resources `"policies", "policytemplates", "groups"` in policy rules in attachment role templates.
- Correct `nonResourceURLs` and `verbs`

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

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

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

#### Special notes for your reviewer:

Steps to test:

1. Start Halo and login with `admin`
2. Create a Role with `Attachment Manage` permission only
3. Create an user and assign the role to the user
4. Set password for the user
5. Log out current user and log in as the user created just now
6. Try to do various operations in attachment tab
    - Create and list policy
    - Create and list group
    - Upload and list attachments

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

```release-note
修复附件权限定义的错误
```
2022-12-26 06:26:32 +00:00
codychau fcfc7113f5
Support MariaDB Native Driver (#2787)
#### What type of PR is this?
/kind improvement


#### What this PR does / why we need it:
引入对R2DBC的MariaDB的支持,增加例子配置

#### Special notes for your reviewer:
现在,Halo可以使用MariaDB数据库原生驱动了,摆脱MySQL驱动带来的连接问题。

- [x] 支持首次启动执行SQL脚本创建表

#### 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
支持 MariaDB 数据库连接
```
2022-12-26 04:02:31 +00:00
will 3601acfa0a
Upgrade to spring boot 3.0.1 (#3031)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
Upgrade to spring boot 3.0.1

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

Fixes #3030 

#### Special notes for your reviewer:

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

```release-note
NONE
```
2022-12-23 03:14:30 +00:00
chengfeiyue a7da2c0d76
Support querying sub-categories of any level (#2995)
What type of PR is this?

/kind feature
/kind api-change

What this PR does / why we need it:

添加一个方法可以根据分类树的任意一层级的名称查询子树

Which issue(s) this PR fixes:

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

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?

```release-note
CategoryFinder 添加根据分类查询子分类树结构的方法
```
2022-12-22 03:56:29 +00:00
John Niang 77da761a13
Persist and archive historical logs (#3021)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.1.x

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

Provide a default configuration for logging system. Default log filename is `${halo.work-dir}/logs/halo.log`.

References:
- https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.logging.file-output
- https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.logging.file-rotation

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

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

#### Special notes for your reviewer:

Start Halo and check the log file `${halo.work-dir}/logs/halo.log`.

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

```release-note
持久化并归档历史日志
```
2022-12-21 09:56:29 +00:00
John Niang 082aa309f8
Clean up unnecessary code in GlobalErrorWebExceptionHandler (#3012)
#### What type of PR is this?

/kind cleanup
/area core

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

Because these code has already defined in [here](28f9f20d39/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java (L310-L339)). Printing error twice in development mode is completely unnecessary.

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

```release-note
None
```
2022-12-21 02:18:30 +00:00
guqing 9d6bcdf072
fix: page stats does not subscribe in finder (#3003)
#### What type of PR is this?
/kind bug
/area core
#### What this PR does / why we need it:
修复自定义页面 Finder 中 getByName 方法没有返回访问量的问题
此问题为重构 #2918 时引入。

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

Fixes #2992

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
None
```
2022-12-20 14:56:29 +00:00
will dee496b349
fix: default theme cannot be initialized in the jar distribution (#2991)
#### 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
```
2022-12-19 15:00:16 +00:00
guqing 27775c9ac9
feat: add reset config API for theme and plugin (#2964)
#### 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
```
2022-12-19 02:28:10 +00:00
will efc940df99
fix: not clearing the template engine cache after upgrading the theme (#2970)
#### 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
```
2022-12-19 02:24:10 +00:00
will 64550d235f
Change log level to warn for optimistic locking failure error (#2957)
#### 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
```
2022-12-16 07:09:49 +00:00
Ryan Wang c90f19211f
chore: add @minliacom to reviewer list (#2956)
#### What type of PR is this?

/kind improvement

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

将 @minliacom 添加到 Reviewer 列表。

他的贡献列表:

- https://github.com/halo-dev/halo/pulls?q=is%3Apr+author%3Aminliacom+
- https://github.com/halo-dev/halo/issues?q=+is%3Aissue+author%3Aminliacom+
- https://github.com/halo-sigs/awesome-halo/pulls?q=+is%3Apr+author%3Aminliacom+

欢迎 @minliacom 加入。

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


```release-note
None
```
2022-12-16 05:48:36 +00:00
John Niang 09d4b40da8
Apply specific headers for portal endpoints (#2972)
#### 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 的问题
```
2022-12-16 03:32:35 +00:00
Ryan Wang 090b28b399
docs: update github workflow badge (#2974)
#### What type of PR is this?

/kind improvement

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

<img width="367" alt="image" src="https://user-images.githubusercontent.com/21301288/208009227-6c67b9c3-3455-4796-9c9e-59804d6d1c38.png">

see https://github.com/badges/shields/issues/8671


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

```release-note
None
```
2022-12-16 03:12:12 +00:00
Kent Liao 2a9a394c9b
feat: archives in descending order by month (#2959)
<!--  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
归档数据按月降序
```
2022-12-16 02:38:11 +00:00
will 037e14d4ad
Fixed the problem that comment reply cannot be displayed in the front end (#2954)
<!--  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
修复开启评论审核的情况下无法显示评论回复的问题
```
2022-12-15 07:45:09 +00:00
Halo Dev Bot c6a1a86d84
[main] chore: update reviewers for OWNERS file (#2955)
This is an automated cherry-pick of #2319

/assign ruibaby

```release-note
none
```
2022-12-15 04:00:12 +00:00
guqing 686aece485
feat: supports exception page template for theme-side (#2925)
#### 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
主题端支持异常模板页面
```
2022-12-15 02:44:10 +00:00
guqing d5eb7b71cf
refactor: remove get root application context method from halo plugin manager (#2949)
#### 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 方法
```
2022-12-15 02:40:10 +00:00
John Niang 843dcc0e4a
Support command-line arguments running with Docker (#2942)
#### 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
```
2022-12-14 15:12:22 +00:00
guqing 7a2f5d0a99
feat: add author pages for theme-side (#2923)
#### 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
主题端支持作者页面
```
2022-12-14 09:32:18 +00:00
John Niang 3033ceb1ec
Support configuring Halo in working directory (#2935)
#### 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
支持在工作目录添加自定义配置
```
2022-12-14 09:16:18 +00:00
guqing 925dec476f
fix: plugin logo cannot be loaded when it is not enabled (#2940)
#### 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  的问题
```
2022-12-14 08:51:24 +00:00
guqing 07f5b0dbcd
fix: failed to load plugin when add fixedPluginPath dynamically in development mode (#2941)
#### 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 项无法被加载的问题
```
2022-12-14 07:49:23 +00:00
Ryan Wang df0e6cff49
perf: change the maximum limit of request body to 10MB (#2936)
#### 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 请求体最大字节数的限制,修复保存大内容文章异常的问题。
```
2022-12-13 15:38:48 +00:00
guqing a9a65dd408
refactor: metrics to fix post visits cannot be migrated (#2870)
#### 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无法迁移的问题
```
2022-12-13 03:42:44 +00:00
John Niang cfb66b0faa
Fix the problem of getting stuck on VM exit (#2919)
#### 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
```
2022-12-12 08:06:42 +00:00
guqing 52906f21c1
fix: single page does not count visits (#2918)
#### 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
修复自定义页面没有统计访问量的问题
```
2022-12-12 03:48:22 +00:00
will d06078893e
Silent prompt when plugins fail to load in development mode (#2907)
#### 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
插件开发模式下无法被加载时改为静默提示不抛出异常
```
2022-12-12 02:24:22 +00:00
Ryan Wang 86e5366797
feat: improve the quick start section of the readme (#2899)
#### What type of PR is this?

/kind documentation

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

更新 Readme 中快速开始的命令,提供初始管理员账号和外部访问链接的环境变量设置。

```release-note
None
```
2022-12-09 03:28:15 +00:00
John Niang 8f21880683
Enable CI on release branches (#2876) 2022-12-08 10:46:26 +08:00
John Niang f40ba48aa3
Update Halo version to 2.0.1 (#2879) 2022-12-08 10:45:51 +08:00
John Niang cd5cc74714
Set docker image name properly when releasing (#2872) 2022-12-07 15:56:03 +08:00