Commit Graph

2355 Commits (5980b5b4bef8b72a3a7e69cf211fca63091f7a49)

Author SHA1 Message Date
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
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
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
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
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
John Niang e8d00e56f4
Support filtering and sorting plugins (#2489)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

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

Support filtering and sorting plugins. e.g.:

```bash
http://localhost:8090/api/api.console.halo.run/v1alpha1/plugins?keyword=xyz&enabled=true&sort=creationTimestamp,desc
```

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

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

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

```release-note
None
```
2022-09-30 01:30:19 +00:00
guqing 98829f0a3e
feat: add more query params and sorter for single page (#2481)
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core
/kind api-change

#### What this PR does / why we need it:
自定义页面增加排序和筛选:
筛选:
关键词
状态
可见性
作者

排序:
发布时间
创建时间
#### Which issue(s) this PR fixes:

Fixes #2469

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

```release-note
None
```
2022-09-28 15:50:17 +00:00
guqing 27e151a574
feat: add location for theme (#2484)
#### 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 #2461

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

```release-note
None
```
2022-09-28 15:46:17 +00:00
guqing fe3860a8b2
refactor: reload theme.yaml when theme reload (#2486)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
主题 reload endpoint 增加对 theme.yaml 的 reload 操作
#### 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-28 15:28:18 +00:00
guqing 2d87a95193
refactor: do not serialize compact post for tag and category (#2483)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
标签和分类的 status 中的 posts 字段不序列化,只提供文章 postCount 代替
#### 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-28 14:10:17 +00:00
John Niang 565c8340e9
Fix the problem of not being able to request SinglePage with slug name containing special characters (#2479)
#### What type of PR is this?

/kind bug
/kind api-change
/area core
/milestone 2.0

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

Support setting special characters on slug name of SinglePage.

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

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

#### Special notes for your reviewer:

Steps to test:

1. Create single pags with slug name `中文`, `/a/b/c/d` or `a / b`
2. Request it with permalink generated by Halo

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

```release-note
None
```
2022-09-28 07:48:21 +00:00
Ryan Wang e954af88ec
perf: change the default sort order of articles (#2480)
#### What type of PR is this?

/kind improvement
/milestone 2.0
/area core

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

修改文章列表的默认排序规则,之前是按照创建时间(createTime)升序,现在改为降序。即最新创建的文章在前面。

#### Special notes for your reviewer:

测试方式:

连续创建多篇文章,检查前后台的文章排序是否是最新的在最前面。

/cc @halo-dev/sig-halo 

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

```release-note
None
```
2022-09-28 06:52:16 +00:00
Ryan Wang 91793a7e03
perf: refine the extension definition for system setting (#2477)
#### 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
完善系统设置表单的资源定义
```
2022-09-28 03:34:16 +00:00
John Niang 11d91712f6
Fix empty listing of single page (#2474)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.0

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

Fix empty listing of single page while using PostgreSQL.

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

```release-note
None
```
2022-09-27 09:46:15 +00:00
John Niang 1fc37673f7
Support running Halo with PostgreSQL (#2472)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

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

Add PostgreSQL script to support running Halo with PostgreSQL database. BTW, there was a weird issue (emty posts even if there are some posts created) while listing Post, and I fixed it in this PR.

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

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

#### Special notes for reviewers

Steps to test:

1. Start up PostgreSQL. e.g.:

    ```yaml
    version: '3.1'
    
    services:
    
      db:
        image: postgres
        restart: always
        environment:
          POSTGRES_PASSWORD: openpostgresql
        ports:
          - 5432:5432
    
      adminer:
        image: adminer
        restart: always
        ports:
          - 8080:8080
    ```
    
    ```bash
    docker-compose -f postgresql.yaml up
    ```

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

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

3. Validate the functionality of Halo

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

```release-note
None
```
2022-09-27 02:24:15 +00:00
guqing 264a4330c3
feat: add error log when permalink exists (#2460)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
注册 permalink 到 Permalinker 时校验 permalink 是否已经存在,如果存在则记录错误日志且不向 PermalinkIndexer 添加记录

TODO:
- [ ] 后续增加事件功能后检查到 permalink 重复则发送记录事件的 event 来代替日志记录
#### Which issue(s) this PR fixes:

A part of #2454

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

```release-note
None
```
2022-09-27 02:16:15 +00:00
guqing 721cddff5d
fix: post excerptare generated using only published content that is in use (#2457)
#### 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 #2452

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

```release-note
None
```
2022-09-26 08:28:19 +00:00
guqing ed8dddbafa
feat: add comment list APIs for theme-side (#2433)
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core
/kind api-change

#### What this PR does / why we need it:
- 新增主题端评论列表功能
- 新增 `<halo:comment />` html tag 用于扩展评论组件
- 插件可以实现 `CommentWidget` 扩展点来渲染评论组件 html 块,以替换 `<halo:comment />` 标签
#### Which issue(s) this PR fixes:

Fixes #2432

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

```release-note
新增主题端评论列表功能
```
2022-09-26 08:26:13 +00:00
John Niang 73c66289e0
Bump version of dependencies (#2466)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.0

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

This PR mainly upgrades version of dependencies and removes unused dependencies.

See the following references for more:

- https://github.com/spring-projects/spring-boot/releases/tag/v3.0.0-M5
- https://github.com/jhy/jsoup/releases/tag/jsoup-1.15.3
- https://github.com/spring-projects/spring-security/issues/6613

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

```release-note
None
```
2022-09-25 11:22:14 +00:00
John Niang 1da89f04e2
Fix the problem of generating permalink due to special filename (#2462)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.0

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

Encode path of attachment permalink instead of using URI#resolve methods directly.

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

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

#### Special notes for reviewers

Steps to test:

1. Create a file with special name, e.g.: `hello world.txt`
2. Upload the file and see the permalink

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

```release-note
None
```
2022-09-24 04:50:15 +00:00
guqing 02cc2fa7be
feat: add theme setting reload API (#2456)
#### 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,调用此 API 会从主题文件中重新加载 settings.yaml 复盖原有记录,便于主题开发和测试
插件不需要此功能,配置了 `fixedPluginPath` 后每次重启都会加载新的配置项
#### Which issue(s) this PR fixes:

Fixes #2426

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

```release-note
None
```
2022-09-23 09:38:13 +00:00
guqing f0892b2f4d
feat: add theme link expression dialect (#2438)
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core

#### What this PR does / why we need it:
允许主题模板在 HTML 或 JavaScript 片段中使用表达式对象获得链接:
- `${#theme.assets('/js/main.js'))}`
- `${#theme.route('/categories')}`

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

Fixes #2435

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

```release-note
None
```
2022-09-23 03:12:13 +00:00
John Niang d40626b07b
Support configuring console location to access console (#2453)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

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

Support configuring console location to access console. By default, `classpath:/console/` location will be used. If anyone want to debug locally, you can configure the console properties as following:

```yaml
halo:
  console:
    location: file:/home/xxx/path/to/halo-admin/dist/ # The trailing slash is required or it will be treated with a file instead of a folder.
```

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

```release-note
None
```
2022-09-22 14:22:13 +00:00
guqing 95b7a273f8
feat: create a configmap based on the setting definition when installing a theme (#2440)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
#### What this PR does / why we need it:
- 安装主题后通过读取主题 Setting 模型中的默认值初始化一个 ConfigMap
- 修改了 Setting 模型的 spec  结构(多了一层 forms 嵌套),配置示例如下:
```yaml
apiVersion: v1alpha1
kind: Setting
metadata:
  name: theme-anatole-setting
spec:
  forms:
    - group: basic
      label: 基本设置
      formSchema:
        - $formkit: select
          name: sidebar_width
          label: 侧边栏宽度
          options:
            "20%": 20%
            "30%": 30%
            "40%": 40%
            "50%": 50%
          value: "40%"
```

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

Fixes #2414

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

```release-note
None
```
2022-09-22 08:26:13 +00:00
guqing cda6402780
feat: any user who accesses the system has the anonymous role (#2443)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
- 未认证用户在系统中被定义为匿名用户(username=anonymousUser),它在授权系统中具有 principle=anonymousUser 且 role=anonymous,key=[secure randomly generated key]
- 未认证用户和已认证用户都将被赋予一个匿名用户角色

参考:
- [Spring security#ServerHttpSecurity.AnonymousSpec](70460ca009/config/src/main/java/org/springframework/security/config/web/server/ServerHttpSecurity.java (L4387))
- [Spring security reactive AnonymousAuthenticationWebFilter](70460ca009/web/src/main/java/org/springframework/security/web/server/authentication/AnonymousAuthenticationWebFilter.java (L46))


#### 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-22 06:58:12 +00:00
guqing bfbc4ec70a
feat: add more query predicates for post list (#2436)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
文章列表新增更过的查询条件
- publishPhase 状态
- visible 可见性
- keyword 关键词
新增排序(sort)(可逆序 sortOrder)
- 创建时间(默认创建时间逆序)
- 发布时间

关键词过滤暂不管文章内容,否则需要查询所有文章内容判断是否包含字符串
排序暂无法支持评论数量和阅读量,这两个属性属于文章统计需要 #2430 的支撑
#### Which issue(s) this PR fixes:

Fixes #2424

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

```release-note
None
```
2022-09-22 06:14:12 +00:00
guqing eee81e78f1
fix: category and tag query parameters in post query (#2441)
#### What type of PR is this?
/kind api-change
/kind improvement
/area core
/milestone 2.0
#### What this PR does / why we need it:
修复文章列表的分类、标签查询参数方法名和取值不一致导致无效问题
#### Which issue(s) this PR fixes:

Fixes #2439

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

```release-note
None
```
2022-09-21 13:58:12 +00:00
guqing ac8dd74211
feat: the ConfigMap named system to store user-defined configurations (#2415)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
将原来系统默认的系统配置 system 改名为 system-default, 并使用名为 system 的 ConfigMap 来存储用户自定义的系统配置。系统最终配置为用户自定义系统配置 Merge Patch 系统默认配置的结果。
see also #2304
#### Which issue(s) this PR fixes:

Fixes #2304

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

```release-note
None
```
2022-09-21 04:06:10 +00:00
John Niang 1714f8edb2
Refactor CustomEndpoint for customizing GroupVersion (#2429)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.0.0

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

Refactor CustomEndpoint for customizing GroupVersion.

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

```release-note
None
```
2022-09-20 06:38:09 +00:00
guqing a39cf2645e
refactor: rename api group for custom api (#2419)
#### What type of PR is this?
/kind improvement
/kind api-change
/area core
/milestone 2.0

#### What this PR does / why we need it:
- 修改管理后台使用的自定义 API 的 group 为 `api.console.halo.run`
- 面向三方应用的自定义 API 的 group 为 `api.halo.run`
- 插件的自定义 API 的 group 为 `api.plugin.halo.run`

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

Fixes #2418

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

```release-note
None
```
2022-09-19 16:24:35 +00:00
guqing 9fdc9c1bb7
feat: add comment custom endpoint for list view (#2412)
#### 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,支持过滤和排序条件
- 新增评论 Reconciler 以支持:
  -  是否有新回复
  - 最新回复时间
  - 上次查看回复时间
  - 未读回复数量
- 新增评论主体信息获取扩展点 `CommentSubject` 用于获取评论的 subject 信息 ,默认实现 `Post` 模型和 `SinglePage`
#### Which issue(s) this PR fixes:
Fixes #2409

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
新增评论列表自定义 API (包括回复)并支持过滤和排序条件
新增发表评论和回复的自定义 API
支持是否有新回复及未读回复数量
```
2022-09-19 08:38:13 +00:00
guqing 510f155e05
feat: count the number of posts under categories and tags (#2402)
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core

#### What this PR does / why we need it:
统计分类和标签下的文章
#### Which issue(s) this PR fixes:
Fixes #2401

#### Special notes for your reviewer:
how to test it?
1. 创建一个多层级的分类及若干文章,查看分类的 status.posts 是否包含当前及其子分类下的文章
2. 创建标签,并将其分配给若干文章,查看标签的 status.posts 是否正确
3. 在主题端查看分类和标签包含的文章数量是否正确,需要注意的是主题端显示的文章数量只包含已发布且 visiable 为 public 且未删除的

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

```release-note
None
```
2022-09-19 02:22:12 +00:00
guqing a0d55c58f6
feat: theme side provides variables for theme and some system settings (#2406)
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core

#### What this PR does / why we need it:
提供当前使用主题(预览或激活)的 configMap 变量和部分系统设置等变量。

提供了以下变量:
- `${theme}` 当前主题的信息,theme.yaml 
- `${theme.config}` 获取当前主题的设置项
- ~`${siteSetting}`~ `${site}` 提供必要系统变量

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

#### Special notes for your reviewer:
how to test it?
再任意主题模板上使用表达式获取例如:`${theme}`,`${theme.config.sns?.email}`

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

```release-note
None
```
2022-09-15 06:52:13 +00:00
guqing 069ff04c84
refactor: theme route pattern and permalink indexer (#2397)
#### What type of PR is this?
/kind improvement
/milestone 2.0
/area core

#### What this PR does / why we need it:
使用正则细化主题端路由并优化

如何测试:
1. 在 admin 系统设置中修改文章文章详情页访问规则
2. 根据规则访问文章详情页,如规则为:`/{year:\d{4}}/{month:\d{2}}/{slug}` 而存在文章 slug 为 fake-slug 且发布日期为 2022-09-08 则 /2022/09/fake-slug 能访问, /2022/9/fake-slug 则不能访问
使用规则 `/{year:\d{4}}/{month:\d{2}}/{day:\d{2}}/{slug}`时 /2022/09/08/fake-slug 能访问 /2022/09/8/fake-slug ,则不能访问
#### Which issue(s) this PR fixes:
Fixes #2396

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
None
```
2022-09-13 03:58:10 +00:00
guqing 9dc7bc1729
refactor: the structure of finders vo (#2400)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
统一主题端 VO 的结构 
#### Which issue(s) this PR fixes:
Fixes #2394

#### Special notes for your reviewer:
how to test it?
通过主题端调用 finder 方法来验证

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

```release-note
None
```
2022-09-09 09:44:11 +00:00
guqing 1d73228b1f
feat: theme template route filling necessary data to request model (#2393)
* feat: add archives data

* refactor: route strategy to populate necessary data

* refactor: next page url does not exceed the total number of pages
2022-09-09 14:43:02 +08:00