Commit Graph

15 Commits (0794644dbda477b3844e593ce4f00e3541281741)

Author SHA1 Message Date
guqing 8619d96f6a
refactor: optimizing plugin upgrade steps (#3838)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.5.x

#### What this PR does / why we need it:
优化插件的升级流程

how to test it?
1. 测试正常的插件升级是否正常
2. 测试插件升级失败后插件是否会被卸载的问题
3. 测试没有 version 的插件安装是否能成功
4. 在插件目录不会多出一个名为 `{升级插件名称}-null.jar` 的文件

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

Fixes #3839

#### Does this PR introduce a user-facing 
```release-note
优化插件的升级流程
```
2023-04-27 03:50:15 +00:00
guqing e412866749
feat: add public APIs for client side (#3787)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.5.x
/kind api-change

#### What this PR does / why we need it:
为客户端提供一套 APIs

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

#### Does this PR introduce a user-facing change?
```release-note
为访客端提供一套完整的 API
```
2023-04-24 12:16:15 +00:00
John Niang a94c0c7f85
Add property halo.use-absolute-permalink to control permalink generation (#3772)
#### What type of PR is this?

/kind improvement
/kind api-change
/area core
/milestone 2.5.x

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

Add property `halo.use-absolute-permalink`(default is `false`) to control permalink generation. Leave `halo.external-url` as `null` by default.

Meanwhile, I enhanced `ExternalUrlSupplier#getURL` to get URL from not only properties but only http request.

#### How to use it?

```yaml
halo:
  use-absolute-permalink: false
```

Or:

```yaml
halo:
  external-url: https://halo.run/
  use-absolute-permalink: false
```

Or:

```yaml
halo:
  external-url: https://halo.run/
  use-absolute-permalink: true
```

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

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

#### Special notes for your reviewer:

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

```release-note
新增是否生成相对地址的配置
```
2023-04-19 07:54:24 +00:00
John Niang ed14fcb5f4
Support publishing to maven central repository (#3767)
#### What type of PR is this?

/kind feature
/area core

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

Use Gradle plugin `maven-publish` to publish Halo modules(`platform.application`, `platform.plugin` and `api`) to Maven central repository.

```bash
# Try to publish to Maven local repository.
./gradlew publish
# Really publish to Maven central repository.
./gradlew -Prelease publish -PossrhUsername=username -PossrhPassword=password
```

Note that currently we only support manually publishing.

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

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

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

```release-note
None
```
2023-04-18 14:28:23 +08:00
John Niang d760d4d362
Expose attachment service to plugin (#3740)
#### What type of PR is this?

/kind feature
/area core
/area plugin

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

This PR refactor AttachmentEndpoint by extracting `upload`, `delete`, `getPremalink` and `getSharedURL` logic in the endpoint into AttachmentService. Meanwhile, I expose the service to plugin, so that we can use the service in plugin conveniently.

#### Special notes for your reviewer:

Please confirm that those changes won't influence existing attachment features.

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

```release-note
None
```
2023-04-14 09:26:49 +00:00
John Niang 2bbdb96979
Fix the problem that generateing OpenAPI defined in Plugin may not work (#3729)
#### What type of PR is this?

/kind bug
/area core

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

- Use the class loader belonging to the parameter type when creating a generic class.
- Use full qualified class name when generating a generic class.

Before testing, you have to set property `springdoc.cache.disabled` to `true`.

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

Fixes #3728 

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

```release-note
None
```
2023-04-10 15:20:25 +00:00
John Niang 0973c64ad2
Move common classes related to theme into api module (#3686)
#### What type of PR is this?

/kind cleanup
/area core

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

Move common classes related to theme into api module.

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

```release-note
None
```
2023-04-03 08:06:13 +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 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
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