Commit Graph

4652 Commits (694ad26c3f1f076c0f5621ae11f1f69f5df2fd87)

Author SHA1 Message Date
guqing 08fe1858cf
feat: add upvote and downvote tracker (#2566)
#### 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
```
2022-10-15 04:53:34 +00:00
Simple-Stark ef35205277 fix: `build:packages` script not running on Windows (halo-dev/console#642)
#### 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
```
2022-10-14 05:50:17 +00:00
John Niang d089ec63b4 Add Makefile for convenient operations (halo-dev/console#641)
#### 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
```
2022-10-13 10:00:16 +00:00
John Niang 83b40b6dad
Update README.md due to 2.0.0-alpha.2 released (#2546)
#### 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
```
2022-10-12 09:10:16 +00:00
Ryan Wang 823acdaaae
docs: remove changelog documentation (#2540)
#### 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
```
2022-10-12 08:20:15 +00:00
John Niang cc221d31c7
Continue extension updation if modification conflict occurs (#2536)
#### 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
修复系统默认数据无法正常更新的问题
```
2022-10-12 04:26:15 +00:00
Ryan Wang 5b12cf8ce4 refactor: set the root path of the development environment to /console (halo-dev/console#638)
#### 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
```
2022-10-11 15:32:14 +00:00
John Niang dbaa087936
Support proxying console in server side (#2535)
#### 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
```
2022-10-11 15:30:14 +00:00
Ryan Wang 64aa137bab refactor: logic of user login (halo-dev/console#636)
#### 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
优化用户登录的逻辑
```
2022-10-11 09:00:14 +00:00
John Niang af8860ffb6
Refine logic of form login and logout (#2528)
#### 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
优化系统登录和登出逻辑
```
2022-10-11 08:04:14 +00:00
Ryan Wang db39c3a1d7 perf: remove unused imports
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-11 15:35:49 +08:00
Ryan Wang 2ac0c525de feat: add support for selecting parent menu item when creating menu item
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-11 15:33:51 +08:00
Ryan Wang 2a12feccf1 perf: remove incorrect help text from menu form
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-11 14:26:37 +08:00
Ryan Wang fb6c3755ed
docs: provides Halo 2.0 online demo environment (#2527)
#### 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
```
2022-10-11 01:38:13 +00:00
Ryan Wang e8806cf8eb feat: add deleting plugin setting and configMap support
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 17:04:32 +08:00
Ryan Wang 7980639e91 perf: optimize reset theme settings config
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 16:55:25 +08:00
guqing 36e8ae1a15
refactor: system role templates (#2524)
#### 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
```
2022-10-10 08:04:10 +00:00
Ryan Wang 7d17e6e60e chore: bump dependencies
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 15:50:18 +08:00
Ryan Wang f761c64035 perf: refine ui permissions adapter
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 15:29:05 +08:00
Ryan Wang d2fbb8b98f chore: add pull request template and remove auto assign config file (halo-dev/console#635)
#### What type of PR is this?

/kind documentation

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

添加 PR 模板和删除 auto assign 的配置文件。 Ref https://github.com/halo-dev/console/pull/569

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

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

```release-note
None
```
2022-10-09 06:58:29 +00:00
Ryan Wang ff3c562ff2 refactor: rename admin to console (halo-dev/console#634)
#### What type of PR is this?

/kind improvement
/milestone 2.0

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

Ref https://github.com/halo-dev/halo/pull/2521 我们已经将 halo-admin 的命名改为了 console,所以相关命名需要同步修改。

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

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

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 需要 `pnpm install && pnpm build:packages`
2. 测试后台功能是否正常。

PS:将在此 PR 合并之后发布 `@halo-dev/console-shared` 包到 npm。

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

```release-note
None
```
2022-10-09 06:56:33 +00:00
Ryan Wang 3f2e30efca chore: bump dependencies
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-09 13:59:35 +08:00
guqing 04300308fe
refactor: the way of router function register for reverse proxy (#2522)
#### 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 #2520

#### Special notes for your reviewer:
How to test:
1. clone 项目 https://github.com/halo-sigs/plugin-comment-widget 后 build 一个 jar
2. 将该 jar 作为一个插件安装到系统并启用它
3. 访问插件提供的反向代理资源
    ```
    curl --location --request GET 'http://localhost:8090/assets/PluginCommentWidget/static/comment-widget.iife.js'
    ```
    期望得到结果
4. 停用插件,重复 Step 3,期望得到 404
5. 重复数次 Step 3-4 均与期望相同即可 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-09 03:42:30 +00:00
guqing a4609f68d1
fix: the exception of plugin context has been closed when plugin restart (#2518)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0

#### What this PR does / why we need it:
BasePlugin 持有了一个当前插件的 PluginApplicationContext 当插件停止后重新启用会获取到旧的 PluginApplicationContext,之前之所以这样写的目的只是插件的这个 BasePlugin 不支持依赖注入,目前已经支持所以不在这样解决问题

日志:

```
Caused by: java.lang.IllegalStateException: run.halo.app.plugin.PluginApplicationContext@6baf2671 has been closed already
	at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1125) ~[spring-context-6.0.0-M5.jar:6.0.0-M5]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1158) ~[spring-context-6.0.0-M5.jar:6.0.0-M5]
	at run.halo.app.plugin.SpringExtensionFactory.create(SpringExtensionFactory.java:102) ~[classes/:2.0.0-alpha.1]
	at org.pf4j.ExtensionWrapper.getExtension(ExtensionWrapper.java:37) ~[pf4j-3.7.0.jar:3.7.0]
	at org.pf4j.AbstractPluginManager.getExtensions(AbstractPluginManager.java:971) ~[pf4j-3.7.0.jar:3.7.0]
	at run.halo.app.plugin.HaloPluginManager.getExtensions(HaloPluginManager.java:118) ~[classes/:2.0.0-alpha.1]
	at run.halo.app.plugin.ExtensionComponentsFinder.getExtensions(ExtensionComponentsFinder.java:36) ~[classes/:2.0.0-alpha.1]
	at run.halo.app.theme.dialect.CommentElementTagProcessor.doProcess(CommentElementTagProcessor.java:49) ~[classes/:2.0.0-alpha.1]
	at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleStandaloneElement(ProcessorTemplateHandler.java:918) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.StandaloneElementTag.beHandled(StandaloneElementTag.java:228) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleStandaloneElement(ProcessorTemplateHandler.java:1204) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.StandaloneElementTag.beHandled(StandaloneElementTag.java:228) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1587) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:592) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1103) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1077) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at run.halo.app.theme.engine.SpringWebFluxTemplateEngine.lambda$createFullStream$0(SpringWebFluxTemplateEngine.java:202) ~[classes/:2.0.0-alpha.1]
	at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:58) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.publisher.Mono.subscribe(Mono.java:4321) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
	at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
```

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

Fixes #

#### Special notes for your reviewer:
how to test:
1. 安装一个插件
2. 启用它再停止它,如此反复,没有抛出异常即可

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

```release-note
None
```
2022-10-09 03:36:30 +00:00
Ryan Wang 18a3fc51a5
chore: rename the default location of the plugin's bundle resources to `console` (#2521)
#### What type of PR is this?

/kind api-change
/kind improvement
/milestone 2.0

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

Ref #2519 ,我们已经将 halo-admin 的命名改为了 console,所以相关命名需要同步修改。

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

Fixes #2519 

#### Special notes for your reviewer:

/hold 

等待插件的 PR。

测试方式:

1. 使用 plugin-links 插件的 https://github.com/halo-sigs/plugin-links/pull/3 PR 进行测试,需要 Clone 到本地。
2. 使用 `./graldew build` 的命令编译插件,得到 `build/libs/plugin-link-*.jar`。
3. Halo 的插件运行模式改为 deployment 模式。
4. 启动 Halo 之后,安装第二步得到的插件。
5. 检查浏览器控制台是否正常加载了 `/assets/PluginLinks/console/main.js` 和 `/assets/PluginLinks/admin/style.css`

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

```release-note
None
```
2022-10-09 03:30:30 +00:00
John Niang 543bdc45b5
Support running Halo with MySQL and MariaDB database (#2512)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

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

Add MySQL script to support running Halo with MySQL database due to https://github.com/jasync-sql/jasync-sql/issues/311 has been resolved.

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

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

#### Special notes for reviewers

Steps to test:

1. Start up MySQL. e.g.:

    ```yaml
    version: '3.1'
    
    services:
    
      db:
        image: mysql
        # NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
        # (this is just an example, not intended to be a production configuration)
        command: --default-authentication-plugin=mysql_native_password
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: openmysql
        ports:
          - 3306:3306
    
      adminer:
        image: adminer
        restart: always
        ports:
          - 8080:8080
    ```
    
    ```bash
    docker-compose -f mysql.yaml up
    ```

2. Start Halo with `mysql` profile. e.g.:

    ```bash
    ./gradlew bootRun --args="--spring.profiles.active=mysql"
    ```

3. Validate the functionality of Halo

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

```release-note
None
```
2022-10-09 02:32:30 +00:00
guqing 9725d63056
fix: tracker counter api does not need authentication for theme (#2517)
#### 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 #2507

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

```release-note
None
```
2022-10-08 09:06:28 +00:00
John Niang b23ed2efcc
Bump version of Spring Boot & SpringDoc (#2511)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.0

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

1. Upgrade Spring Boot to 3.0.0-M5. See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0.0-M5-Release-Notes for more.
2. Upgrade SpringDoc to 2.0.0-M6. The version is compatible to Spring Boot 3.0.0-M5. See https://github.com/springdoc/springdoc-openapi/issues/1865 for more.

#### Special notes for your reviewer:

Please check the API documentation endpoint: <http://localhost:8090/swagger-ui.html>.

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

```release-note
None
```
2022-10-08 02:04:27 +00:00
John Niang e23193cd73
Add Pull Request template for default branch (#2513)
#### What type of PR is this?

/kind documentation

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

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

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

```release-note
None
```
2022-10-06 11:00:25 +00:00
Ryan Wang a89d51e63f
docs: remove readme documentation about running with jar (#2501)
#### What type of PR is this?

/kind documentation
/milestone 2.0

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

因为目前暂时没有提供 JAR 包,所以移除 README 有关使用 JAR 包运行的文档。


#### Special notes for your reviewer:

/cc @halo-dev/sig-halo 

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

```release-note
None
```
2022-10-04 16:22:24 +00:00
John Niang cd2dc99898
Change condition of docker push (#2499) 2022-09-30 19:04:24 +08:00
Ryan Wang c46788c451 fix: ui permissions (halo-dev/console#633) 2022-09-30 19:03:38 +08:00
Ryan Wang d12ca4c14c docs: update readme for Halo 2.0 (halo-dev/console#630)
#### What type of PR is this?

/kind documentation
/milestone 2.0

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

更新 README

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

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


```release-note
None
```
2022-09-30 09:58:18 +00:00
Ryan Wang 541fd5cea6 feat: refine ui permissions (halo-dev/console#628)
#### What type of PR is this?

/kind feature
/kind improvement
/milestone 2.0

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

完善 UI 权限控制。适配 https://github.com/halo-dev/halo/pull/2488

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

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

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. Halo 需要使用 https://github.com/halo-dev/halo/issues/2342 PR 的分支。
2. 创建新的角色,并勾选需要测试的权限。
3. 创建新的用户并赋予新的角色。
4. 测试操作权限。


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

```release-note
完善 UI 权限控制
```
2022-09-30 09:48:19 +00:00
Ryan Wang 0e81366754 feat: add system setup support (halo-dev/console#632)
#### 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/2428

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 清空数据库。
2. 启动之后登录即可跳转到初始化界面。
3. 测试初始化的功能是否正常。

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

```release-note
None
```
2022-09-30 09:46:19 +00:00
guqing 708cd12d25
fix: total comment count for page and singlepage (#2498)
#### 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 #

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

```release-note
None
```
2022-09-30 09:44:19 +00:00
Ryan Wang 3b4703533e
docs: update readme for Halo 2.0 (#2492)
#### What type of PR is this?

/kind documentation
/milestone 2.0

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

更新 README。

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

#### Special notes for your reviewer:

/hold

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

```release-note
None
```
2022-09-30 09:42:24 +00:00
guqing 470696fff1
feat: add retry operation for post and single page when publish and update (#2497)
#### 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 #

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

```release-note
None
```
2022-09-30 09:40:23 +00:00
guqing 3995adba32
feat: add more role templates (#2488)
#### 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 #2342 https://github.com/halo-dev/halo/issues/2391

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

```release-note
None
```
2022-09-30 09:38:23 +00:00
guqing 7de944f61d
chore: degrade springboot version from 3.0.0-M5 to 3.0.0-M4 (#2496)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
将 spring boot 的版本从 3.0.0-M5 降级到 3.0.0-M5 以解决 swragger 无法使用的问题
#### 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
```
2022-09-30 08:52:19 +00:00
Ryan Wang 4b6096ce20 Merge remote-tracking branch 'origin/next' into next 2022-09-30 16:39:39 +08:00
Ryan Wang 737e65067a fix: failed to load side menus
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-09-30 16:38:13 +08:00
Ryan Wang bb62ebc89e perf: hide upload cover button of user detail page
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-09-30 16:36:35 +08:00
Ryan Wang 9c6bda84d3 feat: support for displaying site content statistics (halo-dev/console#624)
#### What type of PR is this?

/kind feature
/milestone 2.0

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

- 支持在文章和自定义页面的管理列表显示访问数和评论数。
- 仪表盘支持显示整站的访问数。

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

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

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

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. Halo 需要 https://github.com/halo-dev/halo/pull/2476 PR 中的分支。
2. 需要执行 `pnpm install && pnpm build:packages`
3. 随机访问前台文章或者自定义页面,以及添加评论。
4. 查看后台是否正确统计文章浏览数和评论数。

TODO list:

- [ ] 更新 `@halo-dev/api-client`

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

```release-note
支持在文章和自定义页面的管理列表显示访问数和评论数
```
2022-09-30 08:06:18 +00:00
John Niang ba41c481bb
Fix the problem of granting role not taking effect (#2495)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.0

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

Fix the problem of granting role not taking effect.

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

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

#### Special notes for your reviewer:

Steps to test:

1. Create an user
2. Grant a role for the user
3. Check the user list

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

```release-note
None
```
2022-09-30 08:04:20 +00:00
guqing eaa18573f0
feat: add post and single page statistics (#2476)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
/kind api-change

#### What this PR does / why we need it:
新增文章和自定义页面统计功能:
1. 浏览量统计,通过在指定模板页面插入 tracker js 上报浏览量数据并写日志到文件同时通过 Metrics 暴露数据
2. 浏览量日志异步写文件
3. 文章列表和自定义页面列表数据增加 stats 属性
4. 主题文章列表及详情、自定义页面详情增加 stats 属性
5. 新增仪表盘统计数据展示, endpoint: `/apis/api.console.halo.run/v1alpha1/stats`
```java
private Integer visits;
private Integer comments;
private Integer approvedComments;
private Integer upvotes;
private Integer users;
```

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

Fixes #2430

#### Special notes for your reviewer:
how to test it?
1. 使用一个主题,创建几篇文章和一些自定义页面,访问他们,并在详情页面的 head 总看到一个 `halo-tracker.js` 的 script 标签
![telegram-cloud-document-5-6167924618783885123](https://user-images.githubusercontent.com/38999863/192552428-b5635607-9810-4be3-b1fe-8a54ed3407c5.jpg)
2. 访问10次以上可以看到 halo work下有一个 `logs/visits.log`,里面有访问记录,它是10条为一批异步刷新到磁盘
3. 主题端文章列表及详情和自定义页面的详情可以取到一个stats字段
4.  `/apis/api.console.halo.run/v1alpha1/stats` 此 endpoint 可以得到总的访问量和评论量,这些数据也是异步的会有一分钟延迟

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

```release-note
None
```
2022-09-30 07:58:19 +00:00
Ryan Wang 5d4613dd42 perf: improve attachment upload modal
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-09-30 13:03:31 +08:00
Ryan Wang 010288ec10 feat: add plugin filters support (halo-dev/console#629)
#### What type of PR is this?

/kind feature
/kind improvement
/milestone 2.0

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

添加插件管理筛选的支持。适配 https://github.com/halo-dev/halo/pull/2489

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

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

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo 
/cc @halo-dev/sig-halo-console 

测试方式:

1. Halo 需要切换到 https://github.com/halo-dev/halo/pull/2489 PR 的分支。
2. Console 需要 `pnpm install`
3. 安装若干插件,测试筛选和排序。

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

```release-note
插件管理支持筛选
```
2022-09-30 03:12:18 +00:00
guqing a3aba94102
refactor: comment hidden default is false (#2482)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
创建评论时 hidden 字段默认为 false
#### 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
```
2022-09-30 02:22:19 +00:00
John Niang 79bd55424d
Fix the problem of changing password not exist before (#2493)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.0

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

Fix the problem of changing password not exist before.

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

Partial Fixes https://github.com/halo-dev/halo/issues/2427

#### Special notes for your reviewer:

Steps to test:

1. Create an user and change his/her password
2. Login with the user and the password

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

```release-note
None
```
2022-09-30 02:18:20 +00:00