Commit Graph

472 Commits (d6489283b854adab76e1779fd85c9478f493f79e)

Author SHA1 Message Date
guqing 36bc461147
refactor: remove IP address judgment for device management (#6275)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.18.x

#### What this PR does / why we need it:
设备管理去除 IP 地址检查以避免频繁登录

#### Does this PR introduce a user-facing change?
```release-note
设备管理去除 IP 地址检查以避免频繁登录
```
2024-07-05 09:33:07 +00:00
John Niang 708b8be792
Respond 409 for operation conflict instead of 500 (#6274)
#### What type of PR is this?

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

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

This PR makes ConcurrencyFailureException respond http status code 409 instead of 500.

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

Fixes #6254 

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

```release-note
None
```
2024-07-05 09:02:38 +00:00
guqing 138d52e731
chore: keep the pluginWrapper bean for compatibility (#6271)
#### What type of PR is this?
/area core
/milestone 2.18.x

#### What this PR does / why we need it:
为了平滑升级先保留 PluginWrapper 的 Bean

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-07-05 04:08:37 +00:00
John Niang ad66247872
Support obtaining plugins root in plugins (#6269)
#### What type of PR is this?

/kind feature
/kind api-change
/area core
/area plugin

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

This PR supports obtaining plugins root in plugins. Below is an example in plugin:

```java
@Component
class PluginsRootGetterDemo {

    private final PluginsRootGetter pluginsRootGetter;

    PluginsRootGetterDemo(PluginsRootGetter pluginsRootGetter) {
        this.pluginsRootGetter = pluginsRootGetter;
    }

}
```

Meanwhile, I remove the `PluginProperties#pluginsRoot` for a clear way to obtain plugins root.

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

```release-note
支持在插件中获取插件根目录
```
2024-07-04 13:36:33 +00:00
John Niang 36fb44c8b7
Build and run using IntelliJ IDEA after building ui (#6261)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.18.x

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

This PR treats `ui/build/dist` as resource dir for application module to adapt building and running using IntelliJ IDEA.

How to use?

1. Build ui project by executing command `./gradlew :ui:build -x :ui:check`.
1. Create a `Run/Debug Configuration` with arguments `--spring.profiles.active=dev --halo.console.proxy.enabled=false --halo.uc.proxy.enabled=false`.
1. Go to `Settings | Build, Execution, Deployment | Build Tools | Gradle` and select `IntelliJ IDEA` for `Build and run using:`
1. Run/Debug the configuration 

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

```release-note
None
```
2024-07-04 03:22:32 +00:00
guqing b964c7bb00
chore: cleanup deprecated constructor for base plugin (#6243)
#### What type of PR is this?
/kind cleanup
/area plugin
/milestone 2.17.x

#### What this PR does / why we need it:
移除 BasePlugin 中已经过时的构造方法

在 2.6.1 版本中将 `BasePlugin(PluginWrapper wrapper)` 标记为过时并使用 `BasePlugin(PluginContext pluginContext)` 代替,现在已经过了很多版本,是时候移除它了。

see also #4023
#### Does this PR introduce a user-facing change?
```release-note
开发者相关:移除 BasePlugin 中已经过时的构造方法
```
2024-07-03 03:49:34 +00:00
guqing 484b5c1b74
chore: cleanup deprecated extension yaml (#6245)
#### What type of PR is this?
/kind cleanup
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
清理已经过时很久的 yaml extension 声明

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-07-02 04:45:24 +00:00
guqing b9c500dc8d
fix: handle plugin entry file loading when cache temp directory is cleared (#6238)
#### What type of PR is this?
/kind bug
/area plugin
/milestone 2.17.x

#### What this PR does / why we need it:
修复当插件入口文件的缓存目录被系统清理后会导致一直无法加载的问题

原问题复现步骤:
1. 登录后刷新页面,此时缓存目录被创建
2. 删除缓存目录后就会提示文件不存在然后导致插件入口文件一致无法加载直到重启 Halo

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

#### Does this PR introduce a user-facing change?
```release-note
修复当插件入口文件的缓存目录被系统清理后会导致一直无法加载的问题
```
2024-07-01 10:05:17 +00:00
John Niang cc3564bf82
Add support to disable two-factor authentication (#6242)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.17.0

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

This PR provides a configuration property to control whether two-factor authentication is disabled. e.g.:

```yaml
halo:
  security:
    two-factor-auth:
      disabled: true | false # Default is false.
```

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

Fixes #5640 

#### Special notes for your reviewer:

1. Enable 2FA and configure TOTP
2. Disable 2FA by configuring property above
3. Restart Halo and try to login

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

```release-note
支持通过配置的方式全局禁用二步验证
```
2024-07-01 09:57:17 +00:00
guqing f5ebd9fe43
feat: add TemplateFooterProcessor extension point for extending footer tag content in theme (#6191)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
提供对模板中 halo footer 标签内容的扩展点以支持扩展页脚内容

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

#### Does this PR introduce a user-facing change?
```release-note
提供对模板中 halo footer 标签内容的扩展点以支持扩展页脚内容
```
2024-07-01 09:49:17 +00:00
guqing 1f4bf8ea47
feat: enhance PluginFinder to support check plugin availability by version (#6236)
#### What type of PR is this?
/kind feature
/area core
/area theme
/milestone 2.17.x

#### What this PR does / why we need it:
支持在主题中检查已启动的插件是否符合指定的版本要求,以便可以在某些功能可以正常工作时才渲染

示例
```html
<p th:if="${pluginFinder.available('plugin-search-widget', '>=2.3.0')}>
<!-- do something -->
</p>
```

#### Does this PR introduce a user-facing change?
```release-note
支持在主题中检查已启动的插件是否符合指定的版本要求
```
2024-07-01 09:45:17 +00:00
John Niang bbc6f23b2d
Fix the problem of null type of search result (#6241)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.17.0

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

This PR adds missed type to HaloDocument while converting.

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

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

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

```release-note
None
```
2024-07-01 09:25:17 +00:00
John Niang 4ea4bdf8b5
Expose search service for plugin (#6239)
#### What type of PR is this?

/kind feature
/kind api-change
/area core
/area plugin
/milestone 2.17.0

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

This PR creates a SearchService and makes it invokable for plugins.

#### Special notes for your reviewer:

1. Create a plugin
2. Publish all publication into Maven local repository by executing `./gradlew publishAllPublicationsToMavenLocalRepository`
3. Use `2.17.0-SNAPSHOT` as dependency version and refresh dependencies
4. Try to use the SearchService to search something.

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

```release-note
为插件提供全文搜索服务
```
2024-07-01 09:11:17 +00:00
John Niang 3875251d97
Allow plugin to listen the event the plugin has started (#6234)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.17.x

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

This PR add support for allowing plugin to listen the event that the plugin has started. Below is an example of listening the event in plugin:

```java
    @EventListener
    void onPluginStartedEvent(PluginStartedEvent event) {
        // do something.
    }
```

See https://github.com/halo-dev/halo/issues/5339#issuecomment-2199220068 for more.

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

Fixes https://github.com/halo-dev/halo/issues/5339#issuecomment-2199220068

#### Special notes for your reviewer:

1. Create a plugin, add the listener above and write some logs
2. Build and install the plugin
3. Start plugin and see the logs you wrote

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

```release-note
支持在插件中监听已启动事件
```
2024-07-01 07:31:17 +00:00
guqing e7f4419131
chore: compatibility support for null for sort parameter of listAll (#6230)
#### What type of PR is this?
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
由于2.17.0 修改了 listAll 的实现导致出现了不兼容 Sort 参数为 null 的情况,考虑到给开发者适应的时间因此先兼容并给出警告日志

see also #6219

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

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-07-01 06:59:17 +00:00
guqing 967eaa21e1
feat: add LoginHandlerEnhancer for enhanced login processing (#6176)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
新增 LoginHandlerEnhancer 用于 Halo 扩展登录成功或失败后的处理逻辑如 RememberMe 和设备管理等

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-07-01 06:49:16 +00:00
Ryan Wang 9e1cd02c41
chore: bump preset plugins version (#6225)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.17.x

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

更新预设插件的版本。

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

```release-note
None
```
2024-07-01 02:55:16 +00:00
John Niang 9410006659
Fix the problem of fetching old value from plugin setting fetcher (#6216)
#### What type of PR is this?

/kind bug
/area core
/area plugin
/milestone 2.17.x

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

This PR  makes sure the method `cache#put` is called before the event is published to avoid the event listener to fetch the old value from the cache.

The problem was introduced by <https://github.com/halo-dev/halo/pull/6141>.

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

Fixes #6213 

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

```release-note
修复在插件配置变更监听器中始终获取到旧数据的问题
```
2024-06-30 02:57:11 +00:00
guqing 8e97814018
fix: causing API to be pending when plugin startup encounters an error (#6207)
#### What type of PR is this?
/kind improvement
/area core
/area plugin

#### What this PR does / why we need it:
修复当启动插件遇到 Error 级别的错误时会导致 API 被挂起无法终止的问题

```
- Throwable
    - Error
    - Exception
```
see #6192 for more details

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

#### Does this PR introduce a user-facing change?
```release-note
修复当启动插件遇到 Error 级别的错误时会导致 API 被挂起无法终止的问题
```
2024-06-29 16:39:10 +00:00
guqing d2a03dc849
fix: incorrect post display when linking or unlinking hidden categories (#6204)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
修复文章关联或取消关联隐藏分类后显示不正确的问题

#### Which issue(s) this PR fixes:
Fixes #6194
Fixes #6195

#### Does this PR introduce a user-facing change?
```release-note
修复文章关联或取消关联隐藏分类后显示不正确的问题
```
2024-06-28 13:51:00 +00:00
Ryan Wang f0445f4e51
refactor: remove page cache feature (#6108)
#### What type of PR is this?

/area core
/kind api-change
/milestone 2.17.x

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

移除内置的页面静态缓存功能,后续将由 https://github.com/halo-sigs/plugin-page-cache 插件提供。

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

Fixes #5639 

#### Special notes for your reviewer:

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

```release-note
移除内置的页面静态缓存功能,后续由 https://github.com/halo-sigs/plugin-page-cache 插件提供。
```
2024-06-28 10:08:59 +00:00
guqing 4cafdb5a72
fix: breadcrumbs for hidden category can not be displayed (#6200)
#### What type of PR is this?
/kind bug
/area core
/area theme
/milestone 2.17.x

#### What this PR does / why we need it:
修复获取隐藏分类的面包屑路径不正确的问题

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

#### Does this PR introduce a user-facing change?
```release-note
修复获取隐藏分类的面包屑路径不正确的问题
```
2024-06-28 10:02:59 +00:00
John Niang c7bf87b361
Rectify role templates about PAT and 2FA endpoints (#6201)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.17.x

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

In PR <https://github.com/halo-dev/halo/pull/6130>, I changed the api group of PAT and 2FA endpoints, but I forgot to change the corresponding role templates. So other users except admin will encounter 403 error like <https://github.com/halo-dev/halo/issues/6199>.

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

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

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

```release-note
None
```
2024-06-28 07:24:58 +00:00
Ryan Wang 2ed117042a
refactor: translate extension point descriptions to simplified chinese (#6190)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.17.x

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

将扩展点定义和扩展点的描述文件改为简体中文。

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

```release-note
None
```
2024-06-28 04:08:57 +00:00
John Niang f936e131c4
Remove deprecated ExtensionComponentsFinder (#6185)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.17.x

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

In <https://github.com/halo-dev/halo/pull/5386>, I marked ExtensionComponentsFinder as deprecated. Four months have passed, it's time to remove it.

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

```release-note
None
```
2024-06-28 02:40:57 +00:00
John Niang c524ee4340
Fix the unstable integration test of Lucene search engine (#6187)
#### What type of PR is this?

/kind failing-test
/area core
/milestone 2.17.x

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

This PR allows retrying to operate on posts when optimistic locking errors occur.

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

Fixes #6186 

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

```release-note
None
```
2024-06-28 01:56:58 +00:00
guqing 68d94f6653
refactor: optimize the extension watch parameters to always be of real type (#6180)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
优化触发 Extension Watch 方法(onAdd/onUpdate/onDelete)时的参数始终为真实类型避免使用时进行类型转换

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-06-27 10:16:54 +00:00
guqing 0cdd043d1f
feat: add method to find path of a specified node in a category tree (#6135)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
为分类 Finder 提供获取指定节点的面包屑路径方法

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

#### Does this PR introduce a user-facing change?
```release-note
为分类 Finder 提供获取指定节点的面包屑路径方法
```
2024-06-27 10:13:05 +00:00
John Niang 556e65a618
Fix the problem of enabling 2FA unexpectedly (#6174)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.17.x

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

Some users encountered 2FA required issue after upgrading Halo 2.16, because they enabled 2FA but didn't configure TOTP before. The issue was introduced by <https://github.com/halo-dev/halo/pull/6005>.

This PR checks if TOTP configured to determine whether 2FA is required.

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

```release-note
修复在没有配置 TOTP 验证器的情况下仍被要求二步验证的问题
```
2024-06-27 09:40:54 +00:00
guqing 4d6450d065
fix: spelling errors in sorting criteria for query categories (#6173)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
修复查询分类的排序条件拼写错误导致的错误

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

#### Does this PR introduce a user-facing change?
```release-note
修复查询分类的排序条件拼写错误导致的错误
```
2024-06-27 09:02:54 +00:00
John Niang 54cd1c82f4
Use top-level interface of session repository (#6160)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.17.x

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

Use top-level interface `org.springframework.session.ReactiveFindByIndexNameSessionRepository` for being compatible with other session repositories.

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

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

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

```release-note
None
```
2024-06-27 03:32:53 +00:00
John Niang 47157ddd3f
Fix the problem of not being able to autowire settingFetcher bean in plugin (#6156)
#### What type of PR is this?

/kind bug
/area core
/area plugin

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

The problem was introduced by PR <https://github.com/halo-dev/halo/pull/6141>. That PR wrongly registered `settingFetcher` singleton bean.

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

<img width="1920" alt="image" src="https://github.com/halo-dev/halo/assets/16865714/ecc67064-3506-49b8-8114-a145da549126">

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

```release-note
None
```
2024-06-26 15:46:50 +00:00
John Niang 632bb69dfe
Refactor search engine and improve document extensibility (#6082)
#### What type of PR is this?

/kind improvement
/kind api-change
/area core

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

See https://github.com/JohnNiang/halo/blob/refactor/search/docs/extension-points/search-engine.md for more

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

Fixes https://github.com/halo-dev/halo/issues/5202
Fixes https://github.com/halo-dev/halo/issues/5339
Fixes https://github.com/halo-dev/halo/issues/5613
Fixes https://github.com/halo-dev/halo/issues/5172
Fixes https://github.com/halo-dev/halo/issues/4796
Fixes https://github.com/halo-dev/halo/issues/5625
Fixes https://github.com/halo-dev/halo/issues/5805

#### Special notes for your reviewer:

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

```release-note
重构搜索引擎并提高可扩展性。
```
2024-06-26 15:22:51 +00:00
Ryan Wang 5eabce7544
feat: add management and view pages for extension points (#6137)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.17.x

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

添加扩展点的查看和设置页面。

<img width="1414" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/4dd4660f-540f-46b5-8250-b4f011ebaae6">

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

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

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

```release-note
添加系统扩展点的查看和设置页面。
```
2024-06-26 13:58:51 +00:00
guqing 0196315228 feat: support hide categories and posts from the list 2024-06-26 19:24:47 +08:00
guqing 68d428aa29
refactor: enhance cache management in plugin setting config (#6141)
#### What type of PR is this?
/kind feature
/area plugin
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
增强插件配置的缓存管理

1. 通过 SettingFetcher/ReactiveSettingFetcher 获取插件配置可以不在考虑获取数据的性能问题,当数据变更后会自动更新缓存
2. 现在你可以通过在插件中监听 `PluginConfigUpdatedEvent` 事件来做一些处理,它会在用户更改插件配置后被触发

#### Does this PR introduce a user-facing change?
```release-note
增强插件配置的缓存管理并支持通过监听 `PluginConfigUpdatedEvent` 事件做一些特殊处理
```
2024-06-26 11:20:51 +00:00
guqing 8d71fc3966 feat: add device management mechanism 2024-06-26 18:52:32 +08:00
guqing ae6724a2b6
feat: implement persistent token based remember me mechanism (#6131)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
新增基于持久化 Token 的 RememberMe 机制

本次更新引入了一种新的 RememberMe 机制,该机制基于持久化 Token,以增强安全性和管理灵活性。在此之前,RememberMe 功能通过以下方式生成 Token,并将其作为 cookie 发送回客户端:
```
 username + ":" + expiryTime + ":" + algorithmName + ":"
   + algorithmHex(username + ":" + expiryTime + ":" + password + ":" + key)
```
此方法的优点在于无需存储 Token 就可以进行验证,并且用户密码的更改会自动使 Token 失效。然而,它的主要缺点是缺乏管理能力,例如无法手动撤销 Token。

鉴于最新的设备管理需求(见 PR #6100),我们需要一种支持设备撤销(revoke)的机制。因此,我们采用了持久化 Token 的方式,并通过随机生成的方法来提高安全性,而不将用户名和密码直接签名在 Token 中。新的 Token 格式如下:
```
base64(tokenValue:series)
```
此更改将为系统带来更高的安全保障和更灵活的管理选项,特别是在需要高度控制和监管设备访问时。

#### Does this PR introduce a user-facing change?
```release-note
引入基于持久化 Token 的新 RememberMe 机制以增强安全性和管理灵活性,升级后需要重新登录
```
2024-06-26 08:40:49 +00:00
John Niang e4cce918f7
Refactor ExtensionGetter for enabling or disabling extensions (#6134)
#### What type of PR is this?

/kind improvement
/kind api-change
/area core

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

This PR refactors ExtensionGetter implementation to add a support of enabling extension point(s). Here is an example of data field of `system` config map:

```json
{
  "data": {
    "extensionPointEnabled": "{  \"search-engine\": [\"search-engine-algolia\"]}"
  },
```

> 1. The `search-engine` is a name of extension point definition.
> 2. The `search-engine-algolia` is a name of extension definition.

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

```release-note
None
```
2024-06-25 07:46:45 +00:00
JohnNiang ecc0a70249 Refactor api client using separated OpenAPI groups 2024-06-25 12:31:25 +08:00
guqing c10862d6fe
refactor: index mechanism to enhance overall performance (#6039)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
重构索引机制的查询和排序以提升整体性能

**how to test it?**
使用 postgre 数据库,初始化 Halo ,然后执行以下脚本创建 30w 文章数据进行测试:
<details>
<summary>点击展开查看 SQL</summary>

```sql
DO $$
DECLARE
    i integer;
    postNameIndex integer;
    snapshotName varchar;
    totalRecords integer;
BEGIN
    postNameIndex := 1;
    totalRecords := 300000;

    FOR i IN 1..3 LOOP
      INSERT INTO "public"."extensions" ("name", "data", "version")
      VALUES (
          '/registry/content.halo.run/categories/category-'||i,
          convert_to(
              jsonb_build_object(
                  'spec', jsonb_build_object(
                      'displayName', '分类-'||i,
                      'slug', 'category-'||i,
                      'description', '测试分类',
                      'cover', '',
                      'template', '',
                      'priority', 0,
                      'children', '[]'::jsonb
                  ),
                  'status', jsonb_build_object(
                      'permalink', '/categories/category-'||i,
                      'postCount', totalRecords,
                      'visiblePostCount', totalRecords
                  ),
                  'apiVersion', 'content.halo.run/v1alpha1',
                  'kind', 'Category',
                  'metadata', jsonb_build_object(
                      'finalizers', jsonb_build_array('category-protection'),
                      'name', 'category-' || i,
                      'annotations', jsonb_build_object(
                          'content.halo.run/permalink-pattern', 'categories'
                      ),
                      'version', 0,
                      'creationTimestamp', '2024-06-12T03:56:40.315592Z'
                  )
          )::text, 'UTF8'),
          0
      );
    END LOOP;


    FOR i IN 1..3 LOOP
      INSERT INTO "public"."extensions" ("name", "data", "version")
        VALUES (
            '/registry/content.halo.run/tags/tag-' || i,
            convert_to(
               jsonb_build_object(
               'spec', jsonb_build_object(
                   'displayName', 'Halo tag ' || i,
                   'slug', 'tag-'||i,
                   'color', '#ffffff',
                   'cover', ''
               ),
               'status', jsonb_build_object(
                   'permalink', '/tags/tag-' || i,
                   'visiblePostCount', totalRecords,
                   'postCount', totalRecords,
                   'observedVersion', 0
               ),
               'apiVersion', 'content.halo.run/v1alpha1',
               'kind', 'Tag',
               'metadata', jsonb_build_object(
                   'finalizers', jsonb_build_array('tag-protection'),
                   'name', 'tag-'||i,
                   'annotations', jsonb_build_object(
                       'content.halo.run/permalink-pattern', 'tags'
                   ),
                   'version', 0,
                   'creationTimestamp', '2024-06-12T03:56:40.406407Z'
               )
       )::text, 'UTF8'),
       0);
    END LOOP;

    FOR i IN postNameIndex..totalRecords LOOP
        -- Generate snapshotName
        snapshotName := 'snapshot-' || i;

        -- Insert post data
        INSERT INTO "public"."extensions" ("name", "data", "version")
        VALUES (
            '/registry/content.halo.run/posts/post-' || postNameIndex,
            convert_to(
                jsonb_build_object(
                    'spec', jsonb_build_object(
                        'title', 'title-' || postNameIndex,
                        'slug', 'slug-' || postNameIndex,
                        'releaseSnapshot', snapshotName,
                        'headSnapshot', snapshotName,
                        'baseSnapshot', snapshotName,
                        'owner', 'admin',
                        'template', '',
                        'cover', '',
                        'deleted', false,
                        'publish', true,
                        'pinned', false,
                        'allowComment', true,
                        'visible', 'PUBLIC',
                        'priority', 0,
                        'excerpt', jsonb_build_object(
                            'autoGenerate', true,
                            'raw', ''
                        ),
                        'categories', ARRAY['category-kEvDb', 'category-XcRVk', 'category-adca'],
                        'tags', ARRAY['tag-RtKos', 'tag-vEsTR', 'tag-UBKCc'],
                        'htmlMetas', '[]'::jsonb
                    ),
                    'status', jsonb_build_object(
                        'phase', 'PUBLISHED',
                        'conditions', ARRAY[
                            jsonb_build_object(
                                'type', 'PUBLISHED',
                                'status', 'TRUE',
                                'lastTransitionTime', '2024-06-11T10:16:15.617748Z',
                                'message', 'Post published successfully.',
                                'reason', 'Published'
                            ),
                            jsonb_build_object(
                                'type', 'DRAFT',
                                'status', 'TRUE',
                                'lastTransitionTime', '2024-06-11T10:16:15.457668Z',
                                'message', 'Drafted post successfully.',
                                'reason', 'DraftedSuccessfully'
                            )
                        ],
                        'permalink', '/archives/slug-' || postNameIndex,
                        'excerpt', '如果你看到了这一篇文章,那么证明你已经安装成功了,感谢使用 Halo 进行创作,希望能够使用愉快。',
                        'inProgress', false,
                        'contributors', ARRAY['admin'],
                        'lastModifyTime', '2024-06-11T10:16:15.421467Z',
                        'observedVersion', 0
                    ),
                    'apiVersion', 'content.halo.run/v1alpha1',
                    'kind', 'Post',
                    'metadata', jsonb_build_object(
                        'finalizers', ARRAY['post-protection'],
                        'name', 'post-' || postNameIndex,
                        'labels', jsonb_build_object(
                            'content.halo.run/published', 'true',
                            'content.halo.run/deleted', 'false',
                            'content.halo.run/owner', 'admin',
                            'content.halo.run/visible', 'PUBLIC',
                            'content.halo.run/archive-year', '2024',
                            'content.halo.run/archive-month', '06',
                            'content.halo.run/archive-day', '11'
                        ),
                        'annotations', jsonb_build_object(
                            'content.halo.run/permalink-pattern', '/archives/{slug}',
                            'content.halo.run/last-released-snapshot', snapshotName,
                            'checksum/config', '73e40d4115f5a7d1e74fcc9228861c53d2ef60468e1e606e367b01efef339309'
                        ),
                        'version', 0,
                        'creationTimestamp', '2024-06-11T05:51:46.059292Z'
                    )
                )::text, 'UTF8'),
            1
        );

        -- Insert content data
        INSERT INTO "public"."extensions" ("name", "data", "version")
        VALUES (
            '/registry/content.halo.run/snapshots/' || snapshotName,
            convert_to(
                jsonb_build_object(
                    'spec', jsonb_build_object(
                        'subjectRef', jsonb_build_object(
                            'group', 'content.halo.run',
                            'version', 'v1alpha1',
                            'kind', 'Post',
                            'name', 'post-' || postNameIndex
                        ),
                        'rawType', 'HTML',
                        'rawPatch', '<p style=\"\">测试内容</p>',
                        'contentPatch', '<p style=\"\">测试内容</p>',
                        'lastModifyTime', '2024-06-11T06:01:25.748755Z',
                        'owner', 'admin',
                        'contributors', ARRAY['admin']
                    ),
                    'apiVersion', 'content.halo.run/v1alpha1',
                    'kind', 'Snapshot',
                    'metadata', jsonb_build_object(
                        'name', snapshotName,
                        'annotations', jsonb_build_object(
                            'content.halo.run/keep-raw', 'true'
                        ),
                        'creationTimestamp', '2024-06-11T06:01:25.748925Z'
                    )
                )::text, 'UTF8'),
            1
        );

        postNameIndex := postNameIndex + 1;
    END LOOP;
END $$;
```

</details>

使用以下 API 查询文章
```
curl 'http://localhost:8090/apis/api.console.halo.run/v1alpha1/posts?page=1&size=20&labelSelector=content.halo.run%2Fdeleted%3Dfalse&labelSelector=content.halo.run%2Fpublished%3Dtrue&fieldSelector=spec.categories%3Dcategory-1&fieldSelector=spec.tags%3Dc33ceabb-d8f1-4711-8991-bb8f5c92ad7c&fieldSelector=status.contributors%3Dadmin&fieldSelector=spec.visible%3DPUBLIC' \
--header 'Authorization: Basic YWRtaW46YWRtaW4='
```
Before:

![SCR-20240612-o20](https://github.com/halo-dev/halo/assets/38999863/fc27a265-6571-4361-a707-a683ea040837)
After:

![SCR-20240612-q1c](https://github.com/halo-dev/halo/assets/38999863/c0a241b8-5ed4-4973-8dfc-c260ffccd727)

#### Does this PR introduce a user-facing change?
```release-note
重构索引机制的查询和排序使整体性能提升 50% 以上
```
2024-06-21 08:04:11 +00:00
guqing 8bdde317e5
feat: add preventParentPostCascadeQuery option to control visibility of child category posts (#6083)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
此次变更为文章分类引入了一个新的 `preventParentPostCascadeQuery` 布尔属性,用于控制分类及其子分类下的文章显示方式。具体变更包括:

- 在分类结构中增加了 `preventParentPostCascadeQuery` 属性。
- 当分类的 `preventParentPostCascadeQuery` 属性设置为 `true` 时,该分类的文章数量不会汇总到父分类中。
- 更新了树结构遍历逻辑,以支持对 `preventParentPostCascadeQuery` 属性的处理。
- 确保独立分类中的文章显示受控,不向上级分类进行聚合。
- 增加了相应的测试用例,以验证在不同树结构中 `preventParentPostCascadeQuery` 属性的功能性。

#### Which issue(s) this PR fixes:
Fixes #5663 
Fixes #4923
Fixes https://github.com/halo-dev/halo/issues/3418

#### Does this PR introduce a user-facing change?
```release-note
新增独立分类选项用于控制关联的子分类下的文章显示以提供更灵活的内容管理方式
```
2024-06-21 04:08:10 +00:00
John Niang c0ac2f37d7
Add support for patching extensions (#6031)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.17.x

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

This PR adds patch method for all extensions API.

Patch example:

```bash
http -a admin:admin PATCH http://localhost:8090/apis/plugin.halo.run/v1alpha1/plugins/app-store-integration \
  Content-Type:application/json-patch+json \
  --raw='[{"op": "replace", "path": "/spec/enabled", "value": false}]'
```

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

Fixes #2311 

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

```release-note
None
```
2024-06-20 09:32:06 +00:00
guqing b5f9010e60
feat: support setting rendering templates for related posts on category (#6106)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
支持在分类上为关联的文章统一设置渲染模板

现在文章的模板生效顺序为:
1. 文章关联的分类上设置的文章模板,如果有多个则选择第一个
2. 文章上设置的自定义模板
3. 文章的默认模板

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

#### Does this PR introduce a user-facing change?
```release-note
支持在分类上为关联的文章统一设置渲染模板
```
2024-06-20 08:12:07 +00:00
guqing 6d3a157d35
fix: a verified email can be reused (#6064)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.17.x

#### What this PR does / why we need it:
修复已验证邮箱可以重复的问题

如果出现多个重复的已验证邮箱,则只保留一个其他的设置为未验证

#### Does this PR introduce a user-facing change?
```release-note
修复已验证邮箱可以重复的问题
```
2024-06-20 08:10:07 +00:00
John Niang a94596a9f8
Add support for publishing events among plugins (#6081)
#### What type of PR is this?

/kind feature
/area core
/area plugin

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

This PR enhance usage of SharedEvent annotation to add support for publishing events among plugins.

#### How to test?

1. Clone repository https://github.com/halo-dev/plugin-starter
2. Change build.gradle as following:

	```gradle
	dependencies {
	    implementation platform('run.halo.tools.platform:plugin:2.17.0-SNAPSHOT')
	```

3. Change StarterPlugin as following:

	```java
	@Component
	public class StarterPlugin extends BasePlugin {
	
	    private final ApplicationContext appContext;
	
	    public StarterPlugin(PluginContext pluginContext, ApplicationContext appContext) {
	        super(pluginContext);
	        this.appContext = appContext;
	    }
	
	    @Override
	    public void start() {
	        appContext.publishEvent(new PostDeletedEvent(this, "fake-plugin"));
	    }
	
	    @Override
	    public void stop() {
	    }

	    @EventListener(PostDeletedEvent.class)
	    public void onApplicationEvent(PostDeletedEvent event) {
	        System.out.println("Post deleted event received in plugin: " + event.getName());
	    }
	}
	```
4. Add a listener to Halo core
```java
	    @EventListener(PostDeletedEvent.class)
	    public void onApplicationEvent(PostDeletedEvent event) {
	        System.out.println("Post deleted event received in core: " + event.getName());
	    }
```
5. Build plugin and install plugin
6. Enable the plugin and see the result

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

```release-note
None
```
2024-06-19 16:11:00 +00:00
John Niang ebf1a1fe1b
Fix the problem that bundle files are not changed in development mode (#6073)
#### What type of PR is this?

/kind regression
/area plugin
/milestone 2.17.x

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

This PR reverts changes of generating bundle resource version in <https://github.com/halo-dev/halo/pull/6028>.

Because the changes were adapted realtime change of bundle files for plugin developers in plugin development runtime mode, but I ignored it.

#### Special notes for your reviewer:

1. Try to start Halo in plugin development mode
2. Change and rebuild ui resources
3. Refresh console and check the result

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

```release-note
None
```
2024-06-13 09:28:36 +00:00
John Niang b692db1f57
Move post events into api modules (#6052)
Signed-off-by: JohnNiang <johnniang@foxmail.com>
2024-06-07 18:34:09 +08:00
John Niang ccbe18567f
Fix the problem that theme assets could not be found after the first initialization (#6049)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.17.x

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

When initialized for the first time, the folder `${halo.work-dir}/themes` does not exist, resulting in the `themes` path being ignored when invoking `themeRootResource.createRelative(themeName + "/templates/assets/");`. It works very well after restarting.

This PR fixes the problem by resolving theme resource directly rather than delegating to PathResourceResolver.

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

Fixes #6048 

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

```release-note
修复首次初始化后无法正常访问主题资源的问题
```
2024-06-07 03:32:22 +00:00
John Niang e446054813
Fix concurrent issue during bundle file concurrent generation testing (#6043)
#### What type of PR is this?

/kind failing-test
/area core
/milestone 2.17.x

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

I wrongly invoked `Arraylist#add`(probes) method in multi threads. So the unit test was unstable and might encounter the problem as follows:

```java
Expected :1
Actual   :0
<Click to see difference>

org.opentest4j.AssertionFailedError: expected: <1> but was: <0>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:166)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:632)
	at run.halo.app.core.extension.service.impl.PluginServiceImplTest$BundleCacheTest.concurrentComputeBundleFileIfAbsent(PluginServiceImplTest.java:460)
```

See https://github.com/halo-dev/halo/actions/runs/9382059472/job/25832681545 for more.

This PR moves the invocation outside thread tasks.

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

```release-note
None
```
2024-06-06 03:42:13 +00:00
Ryan Wang 2841ff8282
fix: missing default values for system settings (#6035)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.16.x

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

补充缺失的系统设置默认值。

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

```release-note
修复系统设置未保存导致无法正常注册的问题
```
2024-06-05 02:31:18 +00:00
John Niang ba96118b4e
Fix the problem that bundle files can be generated arbitrarily (#6028)
#### What type of PR is this?

/kind bug
/area  core
/area plugin
/milestone 2.16.0

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

Before the PR, any user can generate bundle files by providing random query param `v` while requesting bundle files.

This PR refactors the whole bundle file generation method.

1. Do nothing if users provide arbitrary bundle file version
2. Better lock for writing bundle files if not exist

#### Special notes for your reviewer:

1. Request `http://localhost:8090/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.js?v=xyz` 
2. Check if the file `xyz.js` in folder `$TMPDIR/halo-plugin-bundle**`

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

```release-note
None
```
2024-06-03 02:42:13 +00:00
guqing 9f6a441288
refactor: use index mechanism to query extension point definitions (#6011)
#### What type of PR is this?
/kind improvement
/area core
/kind milestone 2.16.x

#### What this PR does / why we need it:
使用索引机制来查询扩展点定义

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-05-30 07:49:15 +00:00
John Niang e881ee9a89
Refactor cache control for static resources (#6015)
#### What type of PR is this?

/kind improvement
/area core

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

This PR unifies cache control for static resources.

Example configuration of cache control:

```yaml
spring:
  web:
    resources:
      cache:
        cachecontrol:
          no-cache: true
          no-store: true
        use-last-modified: false
```

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

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

#### Special notes for your reviewer:

1. Run with `default` and `dev` profiles respectively.
2. See the difference of the `Cache-Control` header in HTTP response

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

```release-note
优化 HTTP 缓存控制
```
2024-05-30 07:05:15 +00:00
guqing 6d3ba969ab
refactor: refine i18n prompts for themes (#6020)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
优化主题安装时的中文提示

<img width="493" alt="image" src="https://github.com/halo-dev/halo/assets/38999863/cd5250ea-8438-4867-89bc-0ab7bc8485e4">

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-05-30 05:31:14 +00:00
John Niang 08ff7e6e00
Fix the problem where extension point might not be obtained when the plugin was started (#6006)
#### What type of PR is this?

/kind bug
/area plugin
/area core

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

This PR refactors SpringComponentsFinder to prevent unexpected cleanup, which might lead to not be able to obtain plugin extension when the plugin was started.

The real reason is that entries is initialized by AttachmentReconciler during initialization of some plugins.

Please note the problem cannot be reproduced stably.

Refs:

- e3125f2998/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java (L229-L249)
- e3125f2998/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java (L312-L316)

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

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

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

```release-note
修复插件启动成功但仍然可能无法获取扩展点导致页面无法访问的问题
```
2024-05-29 06:35:10 +00:00
John Niang 608f2bbca3
Fix the problem the PAT could not be created or restored while logging in with remember-me (#6007)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.16.0

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

PAT could not be created or restored while logging in with remember-me due to lack of RememberMeAuthenticationToken check.

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

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

#### Special notes for your reviewer:

1. Log in with remember-me
2. Create a PAT or restore a PAT
3. See the result

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

```release-note
None
```
2024-05-29 03:13:10 +00:00
John Niang dad6610cce
Add support for serializing or deserializing HaloUser and 2FA (#6005)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.16.x

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

This PR adds support for serializing HaloUser and 2FA.

1. Refactor delegate of HaloUser using `org.springframework.security.core.userdetails.User`.
2. Add `HaloSecurityJackson2Module` to enable serialization/deserialization of Halo security module.

Below is code snippet of integration:

```java
        this.objectMapper = Jackson2ObjectMapperBuilder.json()
            .modules(SecurityJackson2Modules.getModules(this.getClass().getClassLoader()))
            .modules(modules -> modules.add(new HaloSecurityJackson2Module()))
            .indentOutput(true)
            .build();
```

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

```release-note
None
```
2024-05-28 09:13:06 +00:00
John Niang 5df51bb715
Refactor plugin reconciliation for dependency mechanism (#5900)
#### What type of PR is this?

/kind improvement
/area core
/area plugin

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

This PR wholly refactors plugin reconciliation to implement dependency mechanism.

Currently,
- If we disable plugin which has dependents, the plugin must wait for dependents to be disabled.
- If we enable plugin which has dependencies , the plugin must wait for dependencies to be enabled.
- If we upgrade plugin which has dependents, the plugin must request dependents to be unloaded. After the plugin is unloaded, the plugin must cancel unload request for dependents.

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

Fixes #5872 

#### Special notes for your reviewer:

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

```release-note
优化被依赖的插件的升级,启用和禁用
```
2024-05-27 08:16:56 +00:00
guqing cb2138580c
chore: provide post content retrieval bean for plugins (#5981)
#### What type of PR is this?
/kind improvement
/area core
/area plugin
/milestone 2.16.x

#### What this PR does / why we need it:
为插件提供文章内容获取的 bean 以简化文章内容获取

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

#### Does this PR introduce a user-facing change?
```release-note
为插件提供文章内容获取的 Bean
```
2024-05-24 06:46:51 +00:00
guqing 9ec608be3b
feat: add remember-me mechanism to enhance user login experience (#5929)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
为登录增加记住我机制以优化登录体验

how to test it?
1. 勾选记住密码选项后登录
2. 退出浏览器后打开 console 期望依然可以访问而不需要登录
3. 测试修改密码功能,期望修改密码后所有会话需要重新登录包括当前设备和其他设备

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

#### Does this PR introduce a user-facing change?
```release-note
为登录增加记住我机制以优化登录体验
```
2024-05-24 06:20:50 +00:00
guqing c1e8bdb568
feat: add scheduled post publishing feature (#5940)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
新增文章定时发布功能

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

#### Does this PR introduce a user-facing change?
```release-note
新增文章定时发布功能
```
2024-05-24 04:58:51 +00:00
John Niang de85156067
Refactor CryptoService for simplifying RSA key generation (#5978)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.16.x

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

This PR removes PatJwkSupplier interface, scheduled RSA key generation, and move some of them into CryptoService.

Currently, we only use `pat_id_rsa` as private key for authentication modules instead of `id_rsa`(deprecated).

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

```release-note
None
```
2024-05-24 04:32:50 +00:00
Ryan Wang f3c3c91ca4
refactor: improve method name of api client (#5980)
#### What type of PR is this?

/area ui
/kind cleanup
/milestone 2.16.x

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

规范 api client 的方法名,之前生成的 api client 的方法名没有完全遵循驼峰命名。

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

Close https://github.com/halo-dev/halo/issues/5716

#### Special notes for your reviewer:

CI 通过即可。

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

```release-note
None
```
2024-05-24 04:04:50 +00:00
John Niang bbc5c979b7
Unify security configurations into one (#5961)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.16.x

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

This PR unifies api and portal security configurations into one for a better maintenance.

Meanwhile, removing `HaloAnonymousAuthenticationWebFilter` introduced by <https://github.com/halo-dev/halo/pull/3152> may fix <https://github.com/halo-dev/halo/issues/4047>.

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

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

#### Special notes for your reviewer:

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

```release-note
修复登录成功后立即出现登录失效的问题
```
2024-05-22 03:00:46 +00:00
John Niang 2feaa20d05
Ignore includeSubdomains for hsts header (#5956)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.16.x

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

This PR ignores `includeSubdomains` for HSTS header. See https://github.com/halo-dev/halo/issues/4943 for more.

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

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

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

```release-note
修复开启 HSTS 可能会导致未开启 HSTS 的子域名站点无法访问的问题
```
2024-05-21 04:22:44 +00:00
guqing d2a9c804ce
refactor: email notifications are now sent only to verified email addresses (#5905)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
邮件通知功能现在只向经过验证的邮箱地址发送通知匿名用户除外

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

#### Does this PR introduce a user-facing change?
```release-note
邮件通知功能现在只向经过验证的邮箱地址发送通知匿名用户除外
```
2024-05-20 09:22:42 +00:00
guqing c22b4e9ef4
refactor: optimize auth provider sorting with drag-and-drop support (#5914)
#### What type of PR is this?
/kind feature
/area core
/area ui
/milestone 2.16.x

#### What this PR does / why we need it:
优化认证方式的排序并支持拖动

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

#### Does this PR introduce a user-facing change?
```release-note
优化认证方式的排序并支持拖动
```
2024-05-20 08:30:42 +00:00
guqing 94d625fbb0
refactor: automatically approve comments or replies after admin replied it (#5903)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
管理员回复评论或回复后自动通过审核

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

#### Does this PR introduce a user-facing change?
```release-note
管理员回复评论或回复后自动通过审核
```
2024-05-20 08:10:41 +00:00
guqing 9c98d0a54c
refactor: original should be removed when session id changed (#5931)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
当 session id 改变时清除原来的 session id 记录

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-05-16 08:32:35 +00:00
guqing f24b08c7db
feat: add an API to invalidate theme template cache (#5906)
#### What type of PR is this?
/kind feature
/area core
/area theme
/milestone 2.16.x

#### What this PR does / why we need it:
为主题管理增加在线清理缓存功能

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

#### Does this PR introduce a user-facing change?
```release-note
为主题管理增加在线清理缓存功能
```
2024-05-16 02:36:36 +00:00
Takagi e5bc699fb2
feat: support filtering attachments in the library by file media type (#5893)
#### What type of PR is this?

/kind feature
/area core
/area ui

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

为 `/apis/api.console.halo.run/v1alpha1/attachments` 接口增加了 `accepts` 可选参数,用于根据附件的 `MediaType` 进行筛选。

为附件库增加通过文件的 MediaType 类型进行筛选的筛选项。

同时支持使用了 `CoreSelectorProvider` 组件的文件选择框的筛选。现在只会显示 `accepts` 所支持的文件。

#### How to test it?

测试 ui 端文件选择框的类型筛选是否正确有效。
测试使用了 `CoreSelectorProvider` 组件的 `accepts` 是否有效。

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

Fixes #5054

#### Does this PR introduce a user-facing change?
```release-note
附件库支持按文件类型进行过滤
```
2024-05-16 02:32:35 +00:00
guqing 983e70d50d
fix: secret data cannot be used in YAML (#5917)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
修复 Secret 的 data 字段无法在 YAML 使用的问题

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-05-15 07:32:34 +00:00
John Niang 2341905323
Fix the problem where extensions were not changed but still updated (#5887)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.16.x

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

This PR fixes the problem where extensions were not changed but still updated. What we want is to not update the extension if it has not changed.

Before that, we update the version of extension manually while getting the latest extension, this will lead to change the type of metadata.version from int to long.See the code snippet below:

a629961e8d/application/src/main/java/run/halo/app/extension/JSONExtensionConverter.java (L83)

Now, we force update the versions using type Long.

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

```release-note
None
```
2024-05-15 07:14:34 +00:00
John Niang a629961e8d
Fix the problem of not being able to initialize preset plugins (#5874)
#### What type of PR is this?

/kind bug
/area core
/area plugin
/milestone 2.16.x

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

This PR refactors plugin running state change method to resolve the problem of not being able to initialize preset plugins due to too small gap between installation and enabling.

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

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

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

```release-note
解决初始化时无法正常启用插件的问题
```
2024-05-10 05:46:26 +00:00
guqing dc451e2629
fix: changes to Unstructured metadata do not take effect (#5880)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
修复对 Unstructured 的 metadata 进行更改不会被应用的问题

#### Does this PR introduce a user-facing change?
```release-note
修复插件定义的权限没有在插件详情页显示的问题
```
2024-05-10 04:32:24 +00:00
John Niang fe809c10a1
Fix the problem that some plugins could not be used after upgrading dependent plugin (#5855)
#### What type of PR is this?

/kind bug
/area plugin
/area core

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

This PR resolves the problem that some plugins could not be used after upgrading dependent plugin.

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

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

#### Special notes for your reviewer:

1. Install plugin [app-store](https://www.halo.run/store/apps/app-VYJbF)
2. Install plugin [backup](https://www.halo.run/store/apps/app-dHakX) and activate it
3. Disable plugin app-store
4. Check the features of plugin backup
5. Enable plugin app-store
6. Check the features of plugin backup
7. Upgrade plugin app-store with the any versions
8. Check the features of plugin backup

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

```release-note
修复因升级应用市场插件导致部分插件意外停止的问题
```
2024-05-07 03:25:58 +00:00
guqing 9b3f00dab0
fix: extension resources weren't deleted as expected on initialization (#5859)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.16.x

#### What this PR does / why we need it:
修复初始化时未按预期删除自定义资源

#### Does this PR introduce a user-facing change?
```release-note
修复初始化时未按预期删除自定义资源
```
2024-05-06 08:21:34 +00:00
Ryan Wang 1f71532327
chore: bump preset plugins version (#5839)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.15.0

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

升级所有预设插件的版本。

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

```release-note
None
```
2024-04-30 06:38:17 +00:00
guqing 5770ad4c55
fix: update post with retry (#5823)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
修复重试更新文章的错误写法

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-04-29 09:48:35 +00:00
guqing d86ddf4a04
fix: permissions for post content versions (#5819)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
修复拥有文章管理权限的用户无法正常使用版本历史的问题

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

#### Does this PR introduce a user-facing change?
```release-note
修复拥有文章管理权限的用户无法正常使用版本历史的问题
```
2024-04-28 05:50:11 +00:00
Takagi 3916d5b8e5
fix: the post admin does not have tag list permissions (#5818)
#### What type of PR is this?

/kind bug
/area ui

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

补充 #5593 中缺少的 `api.console.halo.run` 权限。用于解决具有文章列表权限的用户,访问标签列表时提示无权限的问题

#### How to test it?

创建一个具有文章列表查看权限的用户,是否能够访问到标签列表。

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

Fixes #5814

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-04-28 03:22:11 +00:00
guqing 0e17d53ede
feat: subscription support for expression-based subscribing (#5705)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
通知订阅支持基于表达式订阅

see #5632 for more details

how to test it?
1. 测试系统通知功能的文章、页面有新评论通知和评论有新回复通知的功能是否正常
2. 测试 2.14 创建的文章、评论和回复升级到此版本后是否能继续收到相应通知,如文章有新评论

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

#### Does this PR introduce a user-facing change?
```release-note
通知订阅支持基于表达式订阅避免订阅随数据量增长同时自动优化之前的订阅数据
```
2024-04-26 10:26:41 +00:00
Ryan Wang 58f82d2cc2
feat: add features for view post history snapshots (#5787)
* Add snapshots related api

* feat: add features for view post history snapshots

---------

Co-authored-by: guqing <i@guqing.email>
2024-04-26 18:10:06 +08:00
guqing 1ade8493da
feat: require password verification for email updates (#5780)
#### What type of PR is this?
/kind feature
/milestone 2.15.x
/area core

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

增加了在用户尝试更新邮箱地址时进行密码验证的步骤。此举提高了安全性,确保邮箱修改操作由经过身份验证的用户执行。

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

#### Does this PR introduce a user-facing change?
```release-note
更新邮箱地址时需进行密码验证
```
2024-04-26 10:06:32 +00:00
guqing c0de807b9e
refactor: optimize comment and reply deletion (#5777)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
优化评论和回复删除,只有删除第一页后才会再次查询避免数据堆积

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-04-26 09:49:26 +00:00
John Niang a635881d34
Add WebSocket support in plugins (#5662)
#### What type of PR is this?

/kind feature
/area core
/area plugin

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

This PR allows plugin developers defining WebSocket endpoints in plugins.

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

Fixes #5285 

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

```release-note
支持在插件中实现 WebSocket
```
2024-04-25 08:19:14 +00:00
guqing 9054e1fb92
fix: comment and reply observed version for status (#5800)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
修复由于没有更新 observed version 导致评论和回复的 reconciler 执行次数控制没有生效的问题

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-04-25 07:49:11 +00:00
Takagi a692c622c9
feat: add search and filtering functions to post tags (#5710) 2024-04-23 17:26:29 +08:00
guqing 06e0b63b5b
feat: invalidate all sessions of a user after password changed (#5757)
* feat: invalidate all sessions of a user after password changed

* fix: unit test case

* refactor: use spring session 3.3 to adapt

* refactor: compatible with session timeout configuration

* refactor: indexed session repository

* Reload page after changed the password

Signed-off-by: Ryan Wang <i@ryanc.cc>

* chore: update session repository

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: Ryan Wang <i@ryanc.cc>
2024-04-23 15:21:24 +08:00
Takagi 944a244186
feat: add the order of the posts according to last modify time (#5727)
* feat: add the order of the posts according to last modify time

* replace es change
2024-04-23 11:28:53 +08:00
guqing 25339c7d14
refactor: optimize comment reconciliation for better performance and efficiency (#5708) 2024-04-23 11:28:28 +08:00
John Niang b74f7c4463
Cleanup resources when plugin startup fails (#5765)
Signed-off-by: JohnNiang <johnniang@foxmail.com>
2024-04-22 16:57:53 +08:00
guqing b4b6693732
refactor: refine statistical approach for tallying posts by category association (#5671) 2024-04-22 15:48:44 +08:00
guqing f07c09b243
feat: add original password verification for password change (#5748)
* feat: add original password verification for password change

* chore: update properties file

* Refine ui

Signed-off-by: Ryan Wang <i@ryanc.cc>

* chore: update properties file

* fix: confirm assword

* fix: unit test case

* feat: add new api for change own password

* chore: regenerate api client

* chore: adapt to UI

* chore: enusre old password not blank

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: Ryan Wang <i@ryanc.cc>
2024-04-21 15:07:46 +08:00
guqing 36b63d6b3c
fix: paginated data queries by expand (#5746)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
修复分页遍历数据的查询参数

此问题由 #5504#5656 重构导致,如果数据超过分页限制会导致无法结束的致命问题

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-04-19 05:40:08 +00:00
John Niang 3c20ce3c55
Generate API docs and regenerate API client (#5742)
#### What type of PR is this?

/kind cleanup
/area core

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

This PR adds support for generating API docs into project and generate API client according the API docs.

To generate/update latest API docs, execute the following command:

```bash
./gradlew clean generateOpenApiDocs
```

To generate/update latest API client, execute the following command:

```bash
make -C ui api-client-gen
```

Meanwhile, I also remove the lint on API client due to unnecessary.

Supersedes of https://github.com/halo-dev/halo/pull/5637

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

```release-note
None
```
2024-04-19 02:34:07 +00:00
Takagi 60f113110b
feat: change the tab title to the site title of the website (#5696)
#### What type of PR is this?

/kind feature
/area ui
/area core
/milestone 2.15.x

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

将 Console 与 UC 页面的标签页标题改为网站实际标题

#### How to test it?

查看 Console 页面与 UC 页面的标题页标题是否变为网站实际标题

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

Fixes #5679 

#### Does this PR introduce a user-facing change?
```release-note
将 Console 与 UC 的标签页标题改为网站实际标题
```
2024-04-12 09:48:08 +00:00
mashirot 0ebb959c45
feat: hide registration-related options when allowRegistration is disabled (#5690)
#### What type of PR is this?

/kind improvement
/area core

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

Fixes #5688 

```release-note
当未开启允许注册选项时,隐藏注册相关的其他选项。
```
2024-04-12 09:04:07 +00:00
ZhengHaoYu 817963c15e
feat: support sorting posts by views and comment count (#5614)
#### What type of PR is this?
/kind feature

#### What this PR does / why we need it:
文章支持根据访问量和评论量排序

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

Fixes #3216 

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

```release-note
文章支持根据访问量和评论量排序
```
2024-04-11 10:10:11 +00:00
guqing 3ef1461c32
refactor: optimize data acquisition from previous to next posts in a post (#5659)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
优化文章上一篇下一篇的查询方式避免瞬时内存占用过高

#### Does this PR introduce a user-facing change?
```release-note
优化文章上一篇下一篇的查询方式避免瞬时内存占用过高
```
2024-04-11 08:24:11 +00:00
guqing 34febb4d5d
refactor: optimize the query for subscriptions (#5656)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
优化通知订阅数据查询

#### Does this PR introduce a user-facing change?
```release-note
优化通知订阅数据查询以解决由于数据过多导致查询慢进而阻塞调用方的问题
```
2024-04-11 08:22:11 +00:00
guqing 52204d6487
refactor: optimize query for category association posts count to prevent blocking due to large data (#5658)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.15.x

#### What this PR does / why we need it:
优化分类关联文章数量的查询避免因查询数据量过大而导致的阻塞或内存溢出

#### Does this PR introduce a user-facing change?
```release-note
优化分类关联文章数量的查询避免因查询数据量过大而导致的阻塞或内存溢出
```
2024-04-08 09:18:08 +00:00
mashirot c630a37eea
feat: add gravatar url into annotation of spec of comment for anonymous (#5642)
/kind feature
/area core

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

see https://github.com/halo-dev/plugin-comment-widget/issues/97

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

Fixes #5641 

```release-note
评论数据返回邮箱地址 hash 值以便生成默认头像
```
2024-04-08 08:14:07 +00:00
Ryan Wang 5fae1d8e9a
chore: update display name of default attachment policy (#5626)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.14.0

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

在 Halo 完成动态数据的 i18n 之前,使用中文描述存储策略名称。

Ref https://github.com/halo-dev/plugin-s3/pull/128

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

```release-note
将默认存储策略模板的显示名称改为中文
```
2024-03-31 13:50:06 +00:00
guqing 867d86b1a7
refactor: reduce the number of failures due to conflict post update (#5604)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.14.x

#### What this PR does / why we need it:
减少文章更新因版本号冲突而失败的次数

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

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-03-27 13:22:07 +00:00
Takagi b660eb6d3e
fix: unable to modify the publish time of post in the uc (#5596)
#### What type of PR is this?

/kind bug
/area core

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

修复在个人中心下,用户无法修改发布时间的问题。

#### How to test it?

需要测试两种情况:

1. 用户首次发布文章时,修改发布时间是否有效。
2. 用户后续编辑文章发布时间时是否生效。

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

Fixes #5473 

#### Does this PR introduce a user-facing change?
```release-note
修复个人中心中用户无法修改文章发布时间的问题
```
2024-03-26 09:18:06 +00:00
Takagi a2810156da
feat: add verification function to the notification settings for the mailbox (#5464)
#### What type of PR is this?

/kind feature
/area ui
/area core
/milestone 2.14.x

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

为邮件的 `通知设置` 添加验证的功能。

同时为 formkit 增加了一个新的组件 (verificationForm),用于支持验证,它的定义方式如下:
```
- $formkit: verificationForm
  action: "http://localhost:8090/verify/user"
  label: 用户验证
  children:
    - $formkit: text
      label: "用户名"
      name: username
      validation: required
    - $formkit: password
      label: "密码"
      name: password
      validation: required
```

verificationForm 支持 `action` 属性,当前端数据验证通过时,会将其下所包含的子节点数据发送至 action 所代表的接口上。
按上述示例,则验证数据会提交至 `http://localhost:8090/verify/user` 进行验证。验证的数据为 `{name: xxx, password: xxx}`

需要注意的是,verificationForm 只用于包装需要验证的数据,不会破坏原始数据的格式。因此上述数据在提交保存后仍旧为 `{name: xxx, password: xxx}` 而不会变成 `{verificationForm1: {name: xxx, password: xxx}}`

#### How to test it?

1. 测试邮箱中的 `通知设置` 新增的验证按钮是否可以正常验证邮箱。
2. 查看数据是否正常回显

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

Fixes #4714 

#### Does this PR introduce a user-facing change?
```release-note
在邮件通知设置中增加了发送测试的功能。
```
2024-03-26 08:00:07 +00:00
Tienyu Yang 687c1b2266
Add configuration option for email sender address apart from SMTP username (#5351)
<!--  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
/kind api-change
<!--
添加其中一个类别:
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:
As described in #5350, when using Amazon SES, for example, as email provider, SMTP username for authentication may not exactly match sender email address. When this happens, websites using Halo will not be able to send emails due to invalid addresses that Halo put in SMTP requests. This PR adds a configuration field for those who got a non-email-address username to specify one separately.

#### 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 #5350

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
Yes
<!--
如果当前 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
action required
添加了“发送邮件地址”配置项。如果你的 username 是邮件地址,那么忽略这一栏即可;如果不是,那么请在这里填上你希望使用的发件人地址
```
2024-03-24 13:44:07 +00:00
MashiroT e798866eb7
feat: comments from users with comment management permission could exempt from review (#5529)
#### What type of PR is this?

/area comment
/area core
/kind improvement

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

> 开启了新评论审核设置,如果是在文章页面登录超级管理员账号进行评论,仍然需要在后台进行审核

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

Fixes #5468 

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

```release-note
新增评论设置,允许有评论管理权限的用户发布的评论无需审核
```
2024-03-22 02:46:06 +00:00
guqing cb9c3eebd0
fix: sequence inconsistency in the comment list on the theme side (#5524)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.14.x

#### What this PR does / why we need it:
修复主题测评论列表顺序不一致的问题

此问题由 #5505 导致,开启了同时返回回复后,评论列表的顺序出现问题

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-03-18 09:08:08 +00:00
Ryan Wang bf81f29fbc
feat: improve the help tips for system setting options (#5516)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.14.0

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

improve the help tips for system setting options

<img width="612" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/9f97a4d7-09f7-4671-8a4e-f4ab7dc8dcbd">


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

Fixes #5513 

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

```release-note
完善系统设置选项的帮助提示。
```
2024-03-18 08:56:09 +00:00
guqing 5e073bfe3c
feat: add support for fetching replies alongside comment list (#5505)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.14.x
/kind api-change

#### What this PR does / why we need it:
主题端评论列表支持同时获得评论数据

Resolves #5435

#### Does this PR introduce a user-facing change?
```release-note
主题端评论列表支持同时获得评论数据
```
2024-03-16 14:52:07 +00:00
guqing 7c3f8b9be2
refactor: simplify the code of reconciler for comment and optimize performance (#5504)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.14.x

#### What this PR does / why we need it:
优化评论控制器的实现逻辑以优化代码和性能

Resolves #5435 

how to test it?
- 测试删除评论时能正确连同回复一起删除
- 测试评论下的最新回复的已读功能是否正确
- 删除/审核评论,观察主题端和Console端分别显示的评论数量是否正确

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-03-15 15:58:09 +00:00
guqing 0435e42123
chore: optimize and reorganize code for post and page service (#5498)
#### What type of PR is this?
/kind cleanup
/area core
/milestone 2.14.x

#### What this PR does / why we need it:
优化并重新整理文章和自定义页面 Service 的部分代码

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-03-15 15:42:08 +00:00
guqing 26dc24cc00
fix: missing notifier descriptors permissions in notification role template (#5489)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.14.x

#### What this PR does / why we need it:
修复分配通知器权限时一片空白的问题

- 隐藏了原先权限中展示的通知器配置权限选项
- 系统设置的权限中依赖了通知器配置权限,但需要有系统设置管理权限才会展示通知配置的 Tab

Fixes #5492

#### Does this PR introduce a user-facing change?
```release-note
修复仅拥有通知器配置权限时无法修改配置的问题
```
2024-03-15 15:38:08 +00:00
John Niang 0843747abc
Collect Gradle plugin versions into root build.gradle (#5511)
#### What type of PR is this?

/kind cleanup
/area core

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

This PR collects all Gradle plugin versions into root build.gradle for easy management.

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

```release-note
None
```
2024-03-15 10:34:07 +00:00
guqing e704e09807
refactor: optimize reply queries using index mechanisms (#5497)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.14.x

#### What this PR does / why we need it:
使用索引机制优化回复功能的查询以提高查询速度

#### Does this PR introduce a user-facing change?
```release-note
使用索引机制优化回复功能的查询以提高查询速度
```
2024-03-13 08:44:08 +00:00
John Niang 956f4ef3f3
Set source and target compatibility to Java 17 (#5499)
#### What type of PR is this?

/kind chore
/area core

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

I get the following errors when I develop Halo in JDK 21:

```bash
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':application:bootRun'.
> Could not resolve all dependencies for configuration ':application:runtimeClasspath'.
   > Failed to calculate the value of task ':application:compileJava' property 'javaCompiler'.
      > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on aarch64.
         > No locally installed toolchains match and toolchain download repositories have not been configured.
```

This PR removes the Java toolchain configuration and adds source and target compatibility to Java 17, allowing developers to develop Halo in Java 17 or higher versions.

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

```release-note
None
```
2024-03-12 07:44:07 +00:00
guqing ed23914050
refactor: optimize the update method for the number of tag associated with posts (#5422)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
优化标签关联的文章数量的更新方式以降低标签太多时对 CPU 的消耗

how to test it?
测试文章关联标签、取消关联、更新关联、删除文章到回收站、彻底删除文章时标签对应的文章可见文章数量和所有文章数量是否正确

#### Does this PR introduce a user-facing change?
```release-note
优化标签关联的文章数量的更新方式以降低标签太多时对 CPU 的消耗
```
2024-03-12 03:16:07 +00:00
guqing 20d80f8f65
refactor: using index mechanisms to optimize comment queries (#5453)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.14.x

#### What this PR does / why we need it:
使用索引机制优化评论数据查询以提高效率

how to test it?
- 测试 console 评论列表和筛选条件是否正确
- 测试主题端评论显示是否正确

#### Does this PR introduce a user-facing change?
```release-note
使用索引机制优化评论数据查询以提高效率
```
2024-03-08 13:32:06 +00:00
longjuan e52be2bf3b
chore: update the link to view notifications in the email template (#5459)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/main/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/main/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
/area core
<!--
添加其中一个类别:
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 https://github.com/halo-dev/halo/issues/5458

#### 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
None
```
2024-03-07 02:35:06 +00:00
Ryan Wang 6ea7abeff2
chore: bump preset plugins version (#5423)
#### What type of PR is this?

/area core
/milestone 2.13.0
/kind improvement

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

更新预设插件的版本。

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

```release-note
None
```
2024-02-29 16:43:39 +00:00
guqing 11114416fa
refactor: optimize notification and subscription query using index (#5414)
### What type of PR is this?
/kind improvement
/area core
/milestone 2.13.x

### What this PR does / why we need it:
使用索引机制优化通知和订阅查询以提高性能

how to test it
测试通知列表不报错即可

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

```release-note
使用索引机制优化通知和订阅查询以提高性能
```
2024-02-27 11:53:13 +00:00
John Niang d2f569699b
Check dependencies while installing and upgrading plugins (#5361)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.13.x

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

This PR checks dependencies while installing and upgrading plugins.

Steps to test:

1. Prepare a plugin with dependencies.

	```diff
	apiVersion: plugin.halo.run/v1alpha1
	kind: Plugin
	metadata:
	  name: a-plugin
	...
	+  pluginDependencies:
	+    app-store-integration: 1.*
	```
2. Build the plugin.
3. Try to uninstall `app-store` plugin.
4. Install `a-plugin`.
5. See the result

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

Fixes #5345 

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

```release-note
插件安装和更新时检查依赖是否合法
```
2024-02-27 10:51:13 +00:00
Ryan Wang 2bfa20d316
chore: add help text for mustVerifyEmailOnRegistration option (#5410)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.13.0

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

为用户设置中 **注册需验证邮箱** 选项添加提示。

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

```release-note
None
```
2024-02-27 10:17:12 +00:00
guqing 7f4abbba09
refactor: only select the required index fields when build query index view (#5312)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.13.x

#### What this PR does / why we need it:
构建查询视图时只选择被使用到的索引字段
how to test it?
验证文章和附件列表的查询条件和排序条件不会报错即可

#### Does this PR introduce a user-facing change?
```release-note
优化查询视图构建只选择被使用到的索引字段构建查询视图
```
2024-02-27 09:21:12 +00:00
guqing a15a9587b8
refactor: optimize user query using index (#5396)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.13.x

#### What this PR does / why we need it:
使用索引机制优化用户查询以提高性能

#### Does this PR introduce a user-facing change?
```release-note
使用索引机制优化用户查询以提高性能
```
2024-02-27 08:45:12 +00:00
John Niang b132597cac
Fix the problem of updating plugin extensions incorrectly (#5404)
#### What type of PR is this?

/kind bug
/area plugin
/area core
/milestone 2.13.x

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

Fix the problem of updating plugin extensions incorrectly.

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

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

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

```release-note
None
```
2024-02-26 08:36:11 +00:00
John Niang 348079d82e
Upgrade Spring Boot to 3.2.3 (#5402)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.13.x

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

Upgrade Spring Boot to [3.2.3](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.3).

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

```release-note
升级依赖 Spring Boot 至 3.2.3
```
2024-02-25 14:24:08 +00:00
John Niang b6edb0c4ca
Fix the problem of being unable to login when 2FA was enabled but TOTP was not configured (#5400)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.13.x

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

This PR ignored `email verified` status while 2FA was enabled.

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

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

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

```release-note
修复开启两步验证但未配置 TOTP 可能无法登录的问题
```
2024-02-25 06:14:08 +00:00
guqing bf6bf8cd7c
refactor: add cache control for reverse proxy resources (#5392)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.13.x

#### What this PR does / why we need it:
为插件静态代理资源增加缓存控制以减少不必要的请求

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

#### Does this PR introduce a user-facing change?
```release-note
为插件静态代理资源增加缓存控制以减少不必要的请求
```
2024-02-23 09:30:41 +00:00
John Niang bbe79bac10
Provide extension points for authentication-related web filters (#5386)
#### What type of PR is this?

/kind feature
/area core
/area plugin
/milestone 2.13.x

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

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

This PR provides three extension points:

- FormLoginSecurityWebFilter
- AuthenticationSecurityWebFilter
- AnonymousAuthenticationSecurityWebFilter

which could be extended by plugins easily.

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

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

#### Special notes for your reviewer:

TBD.

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

```release-note
None
```
2024-02-23 09:04:40 +00:00
MashiroT 50fbe37be8
feat: add support for force verify email during user registration (#5320)
#### What type of PR is this?

/kind feature
/kind improvement
/area core
/area console
/kind api-change

#### What this PR does / why we need it:
增加对用户注册时必须验证邮箱的支持

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

Fixes #5016

#### Special notes for your reviewer:
`regRequireVerifyEmail` 为 `false` 时与现在的注册行为一致
为 `true` 时注册页显示验证码校验相关,注册成功后 `UserSpec.emailVerified` 即为 `true`
没有判断邮件通知是否开启,与现有的邮箱验证一致,如未开启则收不到邮件

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

```release-note
增加对用户注册时必须验证邮箱的支持
```
2024-02-22 09:44:06 +00:00
Ryan Wang 50e954d297
fix: refine error message of the plugin already exists (#5376)
#### What type of PR is this?

/area core
/kind bug
/milestone 2.13.x

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

补全插件已存在错误提示的翻译。

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

```release-note
None
```
2024-02-20 15:34:08 +00:00
guqing 80e14e97d7
refactor: optimize old attachment query parameters using index (#5363)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.13.x

#### What this PR does / why we need it:
使用索引功能优化附件列表查询

#### Does this PR introduce a user-facing change?
```release-note
使用索引功能优化附件列表查询
```
2024-02-20 02:58:09 +00:00
John Niang 333422a0d4
Keep length of PAT stable (#5374)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.13.x

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

In fact, PAT is a JWT, which is very long. However, we put the claim `roles` into PAT, which will cause the length of PAT to increase as the `roles` information increases.

So, the current PR removes the claim `roles` from PAT, which ensures that the length of PAT becomes stable and we can update roles information for PAT at runtime.

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

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

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

```release-note
避免个人令牌长度随着角色信息增长
```
2024-02-20 02:48:08 +00:00
John Niang 8156d9da8a
Move username-password authentication into security filter chain (#5348)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.13.x

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

UsernamePasswordAuthenticator is a normal webfilter instead of authentication webfilter in security filter chain. There does not guarentee expected results due to different in execution order. So this PR changes UsernamePasswordAuthenticator to AuthenticationWebFilter for managing the filter by security filter chain.

By the way, these changes will not affect any plugins.

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

```release-note
None
```
2024-02-18 08:46:15 +00:00
John Niang 9178ad0e22
Refactor AdditionalWebFilter load (#5349)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.13.x

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

This PR creates AdditionalWebFilterChainProxy to call all additional filters instead of using SecurityWebFilterChain.

Please note that:
- the AdditionalWebFilterChainProxy should be executed before `org.springframework.security.web.server.WebFilterChainProxy`.
- I don't change `UsernamePasswordAuthenticator` because of <https://github.com/halo-dev/halo/pull/5348>. The authenticator should be in Security scope instead of a standalone webfilter.

See https://github.com/halo-dev/halo/issues/5300#issuecomment-1933436652 for more.

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

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

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

```release-note
None
```
2024-02-18 04:16:15 +00:00
John Niang 0f9552d923 Do not execute :ui:build when application is not building
Signed-off-by: John Niang <johnniang@foxmail.com>
2024-02-06 10:37:14 +08:00
John Niang 29ec459eac Merge remote-tracking branch 'upstream/main' into refactor/console-as-subproject 2024-02-05 23:40:07 +08:00
guqing 7341f9de6c
chore: remove unnecessary indices build process for lucene on startup (#5332)
#### What type of PR is this?
/kind cleanup
/area core
/milestone 2.13.x

#### What this PR does / why we need it:
移除启动时不必要的搜索引擎索引构建步骤

#### Does this PR introduce a user-facing change?
```release-note
移除启动时不必要的搜索引擎索引构建步骤
```
2024-02-05 06:54:13 +00:00
guqing 06a44d05dc
fix: possible incorrect result set obtained by Gc synchronizer when sartup (#5325)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.13.x

#### What this PR does / why we need it:
修复启动时 GcSynchronizer 没有精准过滤出所需数据导致内存占用会出现较高峰值的问题

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

#### Does this PR introduce a user-facing change?
```release-note
修复启动时 GcSynchronizer 没有精准过滤出所需数据导致内存占用会出现较高峰值的问题
```
2024-02-05 06:31:13 +00:00
guqing dcef5d4157
fix: failure in data query due to reconciler triggered by uncommitted transaction (#5323)
#### What type of PR is this?
/kind bugfix
/milestone 2.12.x
/area core

#### What this PR does / why we need it:
修复事务未提交便触发控制器执行可能导致数据状态不正确的问题

**how to test it?**
1. 测试如 #5315 的问题是否还存在
2. 测试添加重名自定义模型对象会抛出异常且数据被回滚

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

#### Does this PR introduce a user-facing change?
```release-note
修复事务未提交便触发控制器执行可能导致数据状态不正确的问题
```
2024-02-05 04:09:07 +00:00
John Niang a3772fab1b Add build script for ui project
Signed-off-by: John Niang <johnniang@foxmail.com>
2024-02-03 22:51:50 +08:00
Ryan Wang e85a55e416
feat: add supports for ui permissions of notification reason type (#5286)
#### What type of PR is this?

/kind feature
/area core
/area console
/milestone 2.12.x

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

为通知类型设置添加 UI 权限判断。

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

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

#### Special notes for your reviewer:

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

```release-note
为通知类型设置添加 UI 权限判断。
```
2024-01-31 12:11:25 +00:00
John Niang e15923b2d4
Fix the problem of unable to enable/disable 2FA for non-admin users (#5290)
Signed-off-by: John Niang <johnniang@foxmail.com>
2024-01-31 15:44:41 +08:00
guqing a5b0e866bd fix: the order of contributors for posts is not fixed 2024-01-30 15:51:28 +08:00
guqing 2de03851c4
refactor: error prompt for inability to obtain avatar permalink when starting (#5269)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.12.x

#### What this PR does / why we need it:
优化启动时用户头像获取不到的错误提示

原因是在启动时用户被执行 reconcile 时使用的 plugin-s3 插件还没有启动所以无法获取到 permalink 需要重试

how to test it?
使用 plugin-s3 插件作为用户头像的存储策略然后上传头像测试此 PR 在启动时的异常提示是否输出为:
```
2024-01-29T11:53:13.674+08:00  WARN 31937 --- [rReconciler-t-1] r.h.a.c.e.reconciler.UserReconciler      : Failed to get avatar permalink for user [guqing] with attachment [460be0c4-b09f-4b25-ad93-e45f30331ec7], re-enqueuing...
```
#### Which issue(s) this PR fixes:
Fixes #5268

#### Does this PR introduce a user-facing change?
```release-note
优化启动时用户头像获取不到的错误提示
```
2024-01-29 09:52:25 +00:00
John Niang 47a1aa7631
Fix the problem of showing 500 error while containing special chars in excerpt (#5263)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.12.0

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

This PR refactors building html meta by using `modelFactory#createStandaloneElementTag`.

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

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

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

#### Special notes for your reviewer:

Validate via <https://github.com/halo-dev/halo/issues/4755#issuecomment-1776391345>.

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

```release-note
修复摘要中包含特殊字符导致无法解析页面的问题
```
2024-01-29 08:58:48 +00:00