Commit Graph

5094 Commits (6bc13552eed27bf9dca02942eb9ca57010136a5e)

Author SHA1 Message Date
John Niang 9b02bc3405
Merge pull request #6132 from halo-dev/refactor/api-client 2024-06-25 12:48:12 +08:00
Ryan Wang c74187c066 feat: add requests library as a global shared dependency 2024-06-25 12:31:44 +08:00
JohnNiang ecc0a70249 Refactor api client using separated OpenAPI groups 2024-06-25 12:31:25 +08:00
Ryan Wang af73a69e69
fix: resolve phantom dependency issue for iconify (#6120)
#### What type of PR is this?

/kind bug
/area ui
/milestone 2.17.x

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

修复关于 iconify 图标包的幽灵依赖问题,某些情况下,可能导致无法正常导入模块。

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

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

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

```release-note
None
```
2024-06-25 04:24:44 +00:00
Ryan Wang 4f63352b47
chore: bump mariadb driver to 1.2.1 to fix crash issue (#6133)
#### What type of PR is this?

/area core
/kind bug
/milestone 2.17.x

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

升级 MariaDB 的原生驱动版本至 [1.2.1](https://github.com/mariadb-corporation/mariadb-connector-r2dbc/releases/tag/1.2.1),以解决无法正常部署的问题。

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

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

#### Special notes for your reviewer:

测试方式:

```shell
./gradlew clean build -x check -x test --refresh-dependencies
```

```shell
docker build -t halohub/halo:mariadb-fix .
```

```yaml
services:
  halo:
    image: halohub/halo:mariadb-fix
    restart: on-failure:3
    networks:
      halo_network:
    volumes:
      - ./halo2:/root/.halo2
    ports:
      - "8090:8090"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s
    command:
      - --spring.r2dbc.url=r2dbc:pool:mariadb://halodb:3306/halo
      - --spring.r2dbc.username=root
      - --spring.r2dbc.password=jzm3h9t9jggo6ww
      - --spring.sql.init.platform=mariadb
      - --halo.external-url=http://localhost:8090/

  halodb:
    image: mariadb:latest
    container_name: mariadb
    restart: always
    networks:
      halo_network:
    environment:
      MYSQL_ROOT_PASSWORD: jzm3h9t9jggo6ww
      MYSQL_DATABASE: halo
    volumes:
      - ./db:/var/lib/mysql
networks:
  halo_network:
```

```shell
docker compose up
```

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

```release-note
升级 MariaDB 的原生驱动版本至 [1.2.1](https://github.com/mariadb-corporation/mariadb-connector-r2dbc/releases/tag/1.2.1),以解决使用 MariaDB 无法正常部署的问题。
```
2024-06-24 16:16:44 +00:00
Ryan Wang 9604262378
Refactor attachment moving using the patch api (#6111)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.17.x

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

使用新的 [patch](https://github.com/halo-dev/halo/pull/6031) 接口重构附件的移动功能。

#### Special notes for your reviewer:

1. 测试附件移动至其他分组的功能是否正常。
2. 测试删除附件分组,选择 **删除并将附件移动至未分组** 选项,观察删除分组之后,其中的附件是否已经移动到未分组。

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

```release-note
None
```
2024-06-24 04:12:42 +00:00
Ryan Wang 6a1ade375d
refactor: simplify the plugin startup logic (#6113)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.17.x

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

简化插件启动的接口,改为之前单独提供的修改插件状态的接口,而不是修改 `spec.enabled`。

#### Special notes for your reviewer:

需要测试:

1. 手动安装插件之后,启动插件。

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

```release-note
None
```
2024-06-24 03:58:43 +00:00
Ryan Wang f45ffdeca1
Refactor comment data update using the patch api (#6112)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.17.x

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

使用新的 patch 接口重构评论相关的逻辑。

#### Special notes for your reviewer:

需要测试:

1. 审核评论和回复功能。
2. 批量审核评论和回复功能。

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

```release-note
None
```
2024-06-23 16:16:33 +00:00
Ryan Wang ae7dcbb317
fix: not remembering the selected attachment policy in upload modal (#6115)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.17.x

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

修复首次上传附件时,没有默认选择第一个存储策略的问题。

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

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

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

```release-note
修复首次上传附件时,没有默认选择第一个存储策略的问题。
```
2024-06-23 03:48:29 +00:00
Ryan Wang 373229e9de
fix: not remembering the selected editor (#6114)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.17.x

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

修复新建文章时,没有自动选择之前所选编辑器的问题。

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

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

#### Special notes for your reviewer:

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

```release-note
修复新建文章时,没有自动选择之前所选编辑器的问题。
```
2024-06-23 03:46:29 +00: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 db9e0f4ac7
Upgrade SpringBoot to 3.3.1 (#6110)
#### What type of PR is this?

/kind improvement
/area core

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

This PR upgrades Spring Boot to [3.3.1](https://github.com/spring-projects/spring-boot/releases/tag/v3.3.1) and Dependency Management Plugin to [1.1.5](https://github.com/spring-gradle-plugins/dependency-management-plugin/releases/tag/v1.1.5).

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

```release-note
None
```
2024-06-20 15:10:07 +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
Takagi b445b505be
feat: add import and export theme configuration (#6071)
#### What type of PR is this?

/kind feature
/area ui
/milestone 2.17.x

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

为主题增加导入及导出配置的功能。

<img width="1666" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/3574b33e-0293-427c-9036-5d82948aa7f2">

#### How to test it?

测试主题导入及导出功能是否正常可用。
测试当前主题下的不同版本导入导出后数据是否正常。
测试在当前主题下使用其他主题导出的配置是否会报错。

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

Fixes #1073 

#### Does this PR introduce a user-facing change?
```release-note
为单个主题配置增加导入与导出的功能。
```
2024-06-19 10:55:00 +00:00
BugKing 0f87ed8370
docs: add image linked to video in README.md (#6084)
#### What type of PR is this?


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

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

Fixes #

#### Special notes for your reviewer:

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


```release-note
```
2024-06-19 07:54:57 +00:00
Takagi c956533160
pref: default code block indentation from Tab to 2 Spaces in editor (#6090)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.17.x

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

将默认编辑器中代码块的缩进由一个制表符(\t),更改为两个空格` {2}`。

#### How to test it?

测试使用 `Tab` 即 `Shift + Tab` 缩进时,是否每次缩进两个空格而不是一个制表符。

#### Does this PR introduce a user-facing change?
```release-note
优化默认编辑器代码块缩进为两个空格。
```
2024-06-18 06:02:53 +00:00
Takagi 1e37768b35
pref: improve code block styling in editor (#6089)
#### What type of PR is this?

/kind improvement
/area editor

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

优化编辑器代码块样式。

before:

<img width="907" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/11ad91a9-75ce-42ec-a947-effca7b42f30">

after:

<img width="932" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/d0b3275b-a269-4104-aea8-0d8726ce32e7">

#### How to test it?

测试复制功能是否正常。

#### Does this PR introduce a user-facing change?
```release-note
优化默认编辑器代码块样式
```
2024-06-18 06:00:52 +00:00
Takagi 10f3157258
fix: ensure pasted content auto-generates title id (#6059)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.17.x

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

当前在编辑器中粘贴内容后,如果不修改任意标题或新增标题,则无法为当前标题自动生成标题 ID,进而导致锚点失效。

本 PR 将在编辑器触发内容更改后,如果是粘贴的内容,则直接触发生成标题 ID。

#### How to test it?

新建一篇文章并粘贴一段带标题的内容后直接发布。

查看发布后的文章是否可以在主题端使用锚点跳转。

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

Fixes #6056 

#### Does this PR introduce a user-facing change?
```release-note
解决在默认编辑器中粘贴的内容无法生成标题 ID 的问题
```
2024-06-17 13:48:50 +00:00
Takagi 3076838f36
fix: default editor focus setting failure (#6062)
#### What type of PR is this?

/kind bug
/area editor
/area ui

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

当前为默认编辑器设置焦点的时机放在 `onMounted` 时,但此时默认编辑器可能还未加载成功且标题也为能成功加载,因此无法保证正确设置标题焦点。

当前 PR 将此时机放置在默认编辑器创建完成之后的 `onCreate` ,此时将能够保证焦点设置成功。

#### How to test it?

测试默认编辑器能否正常设置标题或内容的焦点。

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

Fixes #6060 

#### Does this PR introduce a user-facing change?
```release-note
解决使用默认编辑器时无法正确设置焦点的问题
```
2024-06-14 08:08:39 +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
mashirot f2a0c502e3
fix: content offset caused by empty slot (#6040)
#### What type of PR is this?

/area ui
/kind improvement

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

Fixes #5877 

```release-note
修复Tag Icon为空时,后台文章的Tag内容不居中
```
2024-06-06 06:43:21 +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 a188f719cb
Upgrade to Gradle 8.8 (#6033)
#### What type of PR is this?

/kind cleanup
/area core

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

This PR upgrades Gradle to 8.8. See https://github.com/gradle/gradle/releases/tag/v8.8.0 for more.

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

```release-note
升级 Gradle 至 8.8
```
2024-06-03 15:05:45 +00:00
John Niang 1821829f99
Prepare for developing 2.17.0 (#6032)
#### What type of PR is this?

/kind cleanup
/area core

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

This is a regular update after a release.

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

```release-note
None
```
2024-06-03 09:53:44 +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
Ryan Wang a26b73e258
chore: remove unnecessary env (#6022)
#### What type of PR is this?

/area ui
/kind cleanup
/milestone 2.16.x

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

移除 UI 项目中不必要的环境变量配置。

1. VITE_API_URL:当前 Console 不会考虑独立部署,并且在开发环境是后端 Proxy 的 Console 请求,所以此变量没有任何意义。
2. VITE_BASE_URL:无意义,当前不考虑修改。

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

```release-note
None
```
2024-05-30 08:31:16 +00:00
Ryan Wang 296d8c5833
fix: dropdown component auto-destruction issue (#6021)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.16.x

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

修复 Dropdown 组件自动销毁的问题,这可能导致部分插件在 Dropdown 中的组件无法正常渲染。

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

```release-note
None 
```
2024-05-30 08:29:15 +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
Ryan Wang 4c6abdcaa1
feat: enable asynchronous resolving for UI extension points (#6018)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.16.x

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

优化 UI 部分的扩展点获取实现,让部分扩展点支持异步获取,之前的实现与文档不符。

比如:

```ts
import { definePlugin } from "@halo-dev/console-shared";
import axios from "axios";

export default definePlugin({
  components: {},
  routes: [],
  extensionPoints: {
    "attachment:selector:create": async () => {
      const { data } = await axios.get(
        "/apis/v1alpha1/fake.halo.run/attachments/selectors"
      );

      return data;
    },
  },
});
```

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

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

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

```release-note
优化 UI 部分的扩展点获取实现,让部分扩展点支持异步获取。
```
2024-05-30 07:01:15 +00:00
Ryan Wang bf75a36df7
chore: revert @uppy/xhr-upload version to 3.6.0 (#6019)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.16.x

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

回退 `@uppy/xhr-upload` 的版本至 3.6.0,因为最新版本的 `@uppy/xhr-upload` 添加了重试机制和修改了错误异常的结构,并且当前重试参数并没有体现在文档和 API 中,所以暂时先回退至 3.6.0 以解决 https://github.com/halo-dev/halo/issues/6014

31cc47f3fb/packages/%40uppy/utils/src/fetcher.ts (L26)

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

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

#### Special notes for your reviewer:

需要测试:

1. 附件上传功能
2. 上传已安装的插件或者主题,观察是否有提示升级。

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

```release-note
None
```
2024-05-30 06:55: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
Ryan Wang f87e78904c
feat: add version for themes and plugins when copying overview information (#6012)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.16.x

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

在概览页面复制信息时,为主题和插件添加版本号。

示例:

```
- 外部访问地址: 
- 启动时间: 2024-05-29 15:51
- 版本: 2.16.0-SNAPSHOT
- 构建时间: 2024-05-29 15:51
- Git Commit: 6204472
- Java: OpenJDK Runtime Environment / 17.0.11+0
- 数据库: PostgreSQL / 15.2 (Debian 15.2-1.pgdg110+1)
- 操作系统: Mac OS X / 14.5
- 已激活主题: [Earth 1.8.0](https://github.com/halo-dev/theme-earth.git)
- 已启动插件:
  - [静态网页服务 1.0.0-alpha.2](https://github.com/ruibaby/plugin-static-pages)
  - [评论组件 2.10.0-SNAPSHOT](https://github.com/halo-dev/plugin-comment-widget)
  - [OAuth2 认证 1.1.1](https://github.com/halo-sigs/plugin-oauth2)
  - [增强备份(Backup IMproved) 1.0.0-SNAPSHOT](https://www.halo.run/store/apps/app-dHakX)
  - [图库管理 1.3.0](https://github.com/halo-sigs/plugin-photos)
  - [Markdown / HTML 内容块 1.2.0](https://github.com/halo-dev/plugin-hybrid-edit-block)
  - AI 助手 1.0.0-alpha.2
  - [对象存储(Amazon S3 协议) 1.9.1](https://github.com/halo-dev/plugin-s3)
  - [链接管理 1.3.3](https://github.com/halo-sigs/plugin-links)
  - [Docsme 1.0.0-alpha.5](https://github.com/f2ccloud/plugin-docsme)
  - [ByteMD 1.4.0](https://github.com/ruibaby/plugin-bytemd)
  - [StackEdit 1.1.1](https://github.com/halo-sigs/plugin-stackedit)
  - [应用市场 1.3.0](https://www.halo.run/store/apps/app-VYJbF)
```

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

```release-note
在概览页面复制信息时,为主题和插件添加版本号。
```
2024-05-29 08:53:11 +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
Ryan Wang afabffc546
refactor: typing component template refs for VModal (#5994)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

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

为 VModal 组件的引用添加类型。

See https://vuejs.org/guide/typescript/composition-api.html#typing-component-template-refs

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

```release-note
None
```
2024-05-27 08:56:57 +00:00
Ryan Wang 22ce60b0e9
chore: bump uppy version (#5997)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

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

更新上传库 Uppy 的包依赖。

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

```release-note
更新上传库 Uppy 的包依赖。
```
2024-05-27 08:34:56 +00:00
Ryan Wang 94826d44c0
refactor: improve ui/ux of attachment group and policy selector (#5996)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

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

优化附件分组、存储策略选择组件的 UI。

<img width="1649" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/194d6334-e600-4235-85f7-affb1d44c003">
<img width="953" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/d8cb2470-2500-4b2c-a251-5fdf45a9cccb">

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

```release-note
优化附件分组、存储策略选择组件的 UI。
```
2024-05-27 08:30:57 +00:00
Ryan Wang 19fb1c2311
feat: record the plugin query conditions in the route query parameters (#5995)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.16.x

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

在插件数据管理列表页面路由中记录查询条件,可以保证在刷新页面或者切换路由返回时保留之前的查询状态。

<img width="1663" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/2638dfc9-793b-48c6-81dd-f460a6c9214d">

#### Special notes for your reviewer:

需要测试:

1. 插件管理列表的所有筛选项是否可以正常工作。
2. 尝试设置部分筛选,然后刷新页面,观察筛选条件是否正常保留。

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

```release-note
Console 端的插件管理列表支持在地址栏记录筛选条件。
```
2024-05-27 08:28:57 +00:00
Ryan Wang 54e088741e
refactor: logic of publishing post (#5987)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

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

重构文章的发布逻辑,以下是主要改动:

1. 如果文章未发布,点击文章设置的发布按钮时,会先保存文章。
2. 在文章列表的操作菜单中添加发布 / 取消发布的选项。
3. 重构文章设置中,发布 / 取消发布按钮的显示条件。
4. 优化文章设置对话框的显示条件,减少不必要的渲染开销和请求。

#### Special notes for your reviewer:

需要测试:

1. 文章正常新建和发布的逻辑。
2. 文章设置未来时间的发布逻辑。
3. 取消定时发布和已发布文章的逻辑。

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

```release-note
优化 Console 文章管理中的文章发布逻辑。
```
2024-05-27 08:26:58 +00:00
Ryan Wang 6124ab9831
feat: add retry feature for update last read time of comment (#5985)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

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

为更新评论的最后读取时间添加重试机制。Ref https://github.com/halo-dev/halo/pull/5903#issuecomment-2106855779

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

```release-note
None 
```
2024-05-27 08:24:59 +00:00
Ryan Wang d675c4a8b1
fix: update initial values when form data changes (#5993)
#### What type of PR is this?

/area ui
/kind bug
/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-27 08:22:57 +00:00