Commit Graph

22 Commits (2d56aaeb93d84aab8c147f5d5a366361c1d787d1)

Author SHA1 Message Date
Ryan Wang bb2b1bcae2
perf: change the default role in user settings to select input type (#3643)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.4.0

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

将系统设置中的用户注册的默认角色输入框改为选择框。

<img width="575" alt="image" src="https://user-images.githubusercontent.com/21301288/228888394-8355b71e-7d18-46bf-b177-569fa7b311d6.png">

#### Special notes for your reviewer:

测试 `系统设置 -> 用户设置` 中的默认角色是否可以正常设置即可。

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

```release-note
None
```
2023-03-30 15:42:15 +00:00
guqing 7b43d21866
refactor: delete dependent userconnection resources when an user is deleted (#3640)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.4.0

#### What this PR does / why we need it:
当用户被删除时关联删除用户的绑定账号信息

how to test it?
1. 创建用户
2. 绑定账号
3. 使用管理员删除此用户并查看关联的 UserConnection 是否被删除
```shell
curl -u 'your-username:your-password' http://127.0.0.1:8090/apis/auth.halo.run/v1alpha1/userconnections | jq  -r '.'
```
#### Which issue(s) this PR fixes:
Fixes #3639

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-03-30 15:40:19 +00:00
guqing ddca7731dd
feat: support user registration (#3631)
#### What type of PR is this?
/kind feature
/area core
/area console
/milestone 2.4.0

#### What this PR does / why we need it:
新增用户注册功能

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

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
```release-note
新增用户注册功能
```
2023-03-30 09:44:15 +00:00
guqing 520074bd9c
fix: initialization status of the privileged auth provider is OFF (#3627)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.4.x

#### What this PR does / why we need it:
修复 Local 认证方式的开关初始化状态为关闭

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

#### Does this PR introduce a user-facing change?
```release-note
None
```
2023-03-30 08:42:14 +00:00
guqing d355e797bd
feat: add reactive setting fetcher for plugin (#3625)
#### What type of PR is this?
/kind feature
/milestone 2.4.x
/area core

#### What this PR does / why we need it:
提供 ReactiveSettingFetcher 供插件获取配置

此 PR 基于原有的阻塞的 SettingFetcher 逻辑挪到 DefaultReactiveSettingFetcher 中并将阻塞的实现用 Reactive 得代理,不需要测试,单元测试过了即可。
可以尝试在插件中依赖注入 ReactiveSettingFetcher 看是否能正确注入

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

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

```release-note
提供 ReactiveSettingFetcher 供插件获取配置
```
2023-03-30 08:38:13 +00:00
guqing 31e5014dec
refactor: merge patch default values to the existing config for theme and plugin setting (#3616)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.4.x

#### What this PR does / why we need it:
修复升级主题或插件时新增加的配置默认值没有更新的问题

how to test it?
1. 安装包含设置的主题后获取主题的 ConfigMap 并记下
2. 修改(增加/更新)主题的设置(Setting)的默认值,模拟更新主题
3. 期望默认值改变不会影响到之前已有的配置,对于新增加的配置的默认值会被合并到已有的 ConfigMap 中

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

#### Does this PR introduce a user-facing change?
```release-note
修复升级主题或插件时新增加的配置默认值没有更新的问题
```
2023-03-30 08:34:14 +00:00
John Niang 1d9c7343fc
Fix typo: snaphosts -> snapshots (#3618)
#### What type of PR is this?

/kind cleanup
/area core
/area console

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

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

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

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

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

```release-note
None
```
2023-03-30 08:28:16 +00:00
John Niang 29f3c25a44
Fix the problem of listing users with unstable result (#3635)
#### What type of PR is this?

/kind bug
/area core

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

Use concatMap instead of flatMap to ensure stable result. 

Please see the differences between flatMap and concatMap from links below:

- https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#flatMap-java.util.function.Function-
- https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#concatMap-java.util.function.Function-

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

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

#### Special notes for your reviewer:

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

```release-note
修复用户列表排序不稳定问题
```
2023-03-30 03:00:18 +00:00
John Niang ad6ac87d73
Make referrer-policy configurable (#3614)
#### What type of PR is this?

/kind feature
/area core

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

This PR provides a configuration item to control referrer-policy header. Default is `strict-origin-when-cross-origin`.

```yaml
halo:
  security:
    referrer-options:
      policy: no-referrer
```

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

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

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

```release-note
提供配置以控制站点引用策略(Referrer-Policy)
```
2023-03-29 09:18:13 +00:00
John Niang b846a05276
Make frame options header configurable (#3612)
#### What type of PR is this?

/kind feature
/area core

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

See https://github.com/halo-dev/halo/issues/3605#issuecomment-1486509473 for more.

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

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

#### Special notes for your reviewer:

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

```release-note
提供配置以控制能否被 iframe 引用
```
2023-03-29 06:56:13 +00:00
John Niang 79f1393395
Fix the problem not allowing logging in after upgrading Halo (#3603)
#### What type of PR is this?

/kind bug
/area core

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

This PR makes extension initialization before starting reconcilers to prevent modification conflicts.

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

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

#### Special notes for your reviewer:

1. Try to run Halo 2.3.2 with command `docker run --rm -it -v ~/halo2-dev:/root/.halo2 -p 8090:8090 halohub/halo:2.3.2`
2. Then run Halo 2.4.0-SNAPSHOT with dev profile.

    ```bash
    ./gradlew bootRun --args="--spring.profiles.active=dev"
    ```
4. Check logs and logging functionality
5. Repeat steps above

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

```release-note
None
```
2023-03-29 05:46:14 +00:00
John Niang a0b4a0eb0b
Upgrade to Spring Boot 3.0.5 (#3609)
#### What type of PR is this?

/kind cleanup
/area core

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

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

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

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

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

```release-note
升级至 Spring Boot 3.0.5
```
2023-03-28 15:42:12 +00:00
Ryan Wang e5253cf6eb
chore: bump default theme version to 1.2.1 (#3607)
#### What type of PR is this?

/kind improvement

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

升级默认主题的版本为 1.2.1:https://github.com/halo-dev/theme-earth/releases/tag/v1.2.1

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

```release-note
None
```
2023-03-28 14:52:12 +00:00
guqing bd4cc0c72d
feat: support aggregate several roles into one combined role (#3568)
#### What type of PR is this?
/kind feature
/milestone 2.4.x
/area core

#### What this PR does / why we need it:
支持聚合多个角色到一个角色

see #3560 for more details.

how to test it?
创建一个测试角色和和一个 RoleBinding 将此角色的绑定到其他角色,在不修改用户权限的情况下,用户将拥有新创建的测试角色的权限。

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

Fixes #3560

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

```release-note
支持聚合多个角色到一个角色
```
2023-03-27 09:48:01 +00:00
guqing 3339b381c8
feat: provide a secret extension to store sensitive data (#3594)
#### What type of PR is this?
/kind feature
/milestone 2.4.x
/area core

#### What this PR does / why we need it:
提供 Secret 自定义模型用于存储敏感数据
例如:密码、token 等
参考自: https://kubernetes.io/docs/concepts/configuration/secret

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

Fixes #3267

#### Does this PR introduce a user-facing change?
```release-note
提供 Secret 自定义模型用于存储敏感数据
```
2023-03-27 09:25:59 +00:00
guqing 2b73a56b6c
fix: unapproved replies are included in the reply count of comments (#3578)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.4.x
/kind api-change

#### What this PR does / why we need it:
修复未审核过的回复包含在了评论的回复数量中的问题

此改动需要评论组件修改回复数量取值为 `status.visibleReplyCount`

how to test it?
1. 创建评论,并在评论下回复
2. 评论的所有回复被计数在 `status.replyCount` 中
3. 而 `status.visibleReplyCount` 数量不包含 `spec.hiden=true` 或 `spec.approved = false` 的

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

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

```release-note
修复未审核过的回复包含在了评论的回复数量中的问题
```
2023-03-27 09:08:04 +00:00
Ryan Wang 8ce0913c0e
perf: hide disabled auth providers in user profile (#3561)
#### What type of PR is this?

/kind improvement
/area console

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

隐藏个人资料中未启用的认证方式。

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

Fixes #3556 

#### Special notes for your reviewer:

测试方式:

1. 安装 OAuth 2 插件:https://github.com/halo-sigs/plugin-oauth2/pull/3
2. 再不做任何配置的情况下,访问已登录用户的个人资料页面,检查是否列出了认证方式。
3. 配置某个认证方式并开启,再检查是否列出了已启用的认证方式。

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

```release-note
None
```
2023-03-27 08:32:12 +00:00
guqing 6bc712d263
fix: NPE when stopping the plugin after the plugin startup fails (#3580)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.4.x

#### What this PR does / why we need it:
修复插件启动失败后停止插件时出现的 NPE 问题

how to test it?
见 #3579,先使用 issue 描述步骤复现问题,在切换到此 PR 尝试相同步骤

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

Fixes #3579

#### Does this PR introduce a user-facing change?
```release-note
修复插件启动失败后停止插件时出现的 NPE 问题
```
2023-03-27 08:12:12 +00:00
guqing fb2bc4252d
refactor: add parameter verification to the visit counter API (#3546)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.4.x

#### What this PR does / why we need it:
对访问量统计的 API 增加数据合法性校验
点赞同理

see #3530 for more details

how to test it?
1. 访问文章和页面可以统计访问量
2. 使用访问以下 API 添加模拟使用错误数据不会在 Counter 模型添加记录
```shell
curl 'http://localhost:8090/apis/api.halo.run/v1alpha1/trackers/counter' -u 'your-username:your-password'  \
--header 'Content-Type: application/json' \
--data '{
    "group": "fake.halo.run",
    "plural": "posts",
    "name": "fake-name",
    "hostname": "localhost",
    "screen": "1920x1080",
    "language": "zh-CN",
    "url": "/archives/hello-halo",
    "referrer": "http://localhost:8090/"
}'
```
期望出现日志:
```
2023-03-21T12:37:08.391+08:00 DEBUG 7036 --- [task-4] r.h.app.metrics.VisitedEventReconciler   : Skip visit event for: GroupPluralName[group=fake.halo.run, plural=posts, name=fake-name]
```
并且
```
curl 'http://localhost:8090/apis/metrics.halo.run/v1alpha1/counters' -u 'your-username:your-password'
```
不会出现上述错误数据的记录
#### Which issue(s) this PR fixes:

Fixes #3530

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

```release-note
对访问量统计的 API 增加数据合法性校验
```
2023-03-27 08:04:17 +00:00
Ryan Wang fbe8e627e8
perf: hide the switch of local identity authentication (#3562)
#### What type of PR is this?

/kind improvement
/area console 

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

在身份认证的列表中隐藏本地身份认证的启用/禁用开关。

<img width="1402" alt="image" src="https://user-images.githubusercontent.com/21301288/226804384-e12ea447-d7ad-4429-82bc-2621fcca84dc.png">

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

Fixes #3557 

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

```release-note
None 
```
2023-03-27 08:02:20 +00:00
John Niang fa7f3c119a
Change type of SettingFetcher from interface into abstract class (#3593)
#### What type of PR is this?

/kind bug
/area core

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

Change type of SettingFetcher from interface into abstract class for backward compatibility. See https://github.com/halo-dev/halo/issues/3592 for more.

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

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

#### Special notes for your reviewer:

Please use [plugin-search-widget](https://github.com/halo-sigs/plugin-search-widget) to test.

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

```release-note
None
```
2023-03-27 04:22:10 +00:00
John Niang c400c85922
Refactor project structure for a better development (#3552)
#### What type of PR is this?

/kind cleanup
/area core

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

This PR totally refactor project structure for a better plugin development. Now we can maintain and publish api and platform modules at Halo application side, which will be references by plugins.

Currently, we can execute command `./gradlew clean publish` to publish api and platform modules into **local** Maven repository, so that we can refer these dependencies (`run.halo.tools.platform:plugin:2.4.0-SNAPSHOT` and `run.halo.app:api:2.4.0-SNAPSHOT`) in plugin projects. 

I will make another pull request to publish api library and platforms into Maven central repository.

**Modules explanation**:
- API module contains common classes which might be used by plugins.
- Plugin Platform module contains dependency declarations of other plugin API modules.
- Application Platform module contains dependency declarations application module might uses.

If we want to build application only(exclude check and jar), we have to execute the command below:

```bash
./gradlew clean :application:build -x :application:check -x :application:jar
```

The executable Jar will be generated at folder `application/build/libs/`.

If we want to build a Docker image, we could execute the command below:

```bash
docker build -t johnniang/halo:project-structure .

# Test the Docker image
docker run -it --rm -p8090:8090 johnniang/halo:project-structure
```

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

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

#### Special notes for your reviewer:

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

```release-note
重构项目结构
```
2023-03-23 08:02:33 +00:00