Commit Graph

5340 Commits (b761fe2b7933281ec86c5ba2cbe4d2c0fee4c644)

Author SHA1 Message Date
Ryan Wang a860cb5ad8
refactor: simplify page title of deleted page (#6708)
#### What type of PR is this?

/kind improvement
/area ui
/milestone 2.20.x

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

简化页面回收站的页面标题。

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

```release-note
简化页面回收站的页面标题。
```
2024-09-26 08:49:33 +00:00
Ryan Wang 565dc1cbc8
refactor: unified empty state UI action button styles (#6704)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

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

统一空状态界面中操作按钮的风格。

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

```release-note
统一空状态界面中操作按钮的风格。
```
2024-09-26 08:47:31 +00:00
John Niang 9710201aa4
Support obtaining ServerWebExchange in ContextView (#6705)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.20.x

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

This PR registers a ServerWebExchangeContextFilter to make ServerWebExchange available under ContextView. The usage example is as follows:

```java
Mono.deferContextual(contextView -> {
    var exchange = ServerWebExchangeContextFilter.getExchange(contextView);
    assertTrue(exchange.isPresent());
    return mono;
})
```

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

```release-note
None
```
2024-09-26 08:43:30 +00:00
Ryan Wang fd40770ebc
chore: bump vue version to 3.5 (#6696)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

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

升级 UI 项目的 Vue 版本至 3.5.x。

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

```release-note
升级 UI 项目的 Vue 版本至 3.5.x。
```
2024-09-26 08:11:31 +00:00
Ryan Wang 7e911e9738 Refine UI 2024-09-25 16:15:56 +08:00
Ryan Wang e2e1d1da4e
Merge branch 'main' into refactor/setting-config-update 2024-09-25 15:30:55 +08:00
guqing f6409a0cb0
fix: correct file mime type validation parameter to restore functionality (#6673)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
修复文件上传时类型校验失效的问题

此问题由 #6390 导致

#### Does this PR introduce a user-facing change?
```release-note
修复文件上传时类型校验失效的问题
```
2024-09-25 02:59:25 +00:00
John Niang 86b95ccfd0
Upgrade to Spring Boot 3.4.0-M3 (#6687)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.20.x

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

This PR upgrades to [Spring Boot 3.4.0-M3](https://github.com/spring-projects/spring-boot/releases/tag/v3.4.0-M3).

1. Fix the compilation error of OptimalPropertyAccess because the class has been privated in [this commit](b431594021).
2. Fix exception `org.mockito.exceptions.misusing.UnnecessaryStubbingException` for some unit tests after upgrading.
3. Replace deprecated annotations `@MockBean` and `@SpyBean` with `@MockitoBean` and `@MockitoSpyBean` respectively.

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

```release-note
升级 Spring Boot 至 3.4.0-M3
```
2024-09-24 07:01:22 +00:00
Ryan Wang 035207b8db
chore: remove unused code related to system configMap (#6695)
#### What type of PR is this?

/area ui
/kind cleanup
/milestone 2.20.x

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

清理 UI 中关于获取 system configmap 的无用代码,目前观察到已经没有任何地方在使用这个数据。

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

```release-note
None
```
2024-09-24 06:57:20 +00:00
Ryan Wang c945a9443c Refine UI 2024-09-24 12:50:25 +08:00
guqing dd2080c3ae feat: add API to update system config by group 2024-09-24 12:10:30 +08:00
guqing 9de18d82c3 Merge remote-tracking branch 'upstream/main' into refactor/6468 2024-09-24 11:51:51 +08:00
guqing 9000ad3bb7 Merge remote-tracking branch 'upstream/main' into refactor/setting-config-update 2024-09-24 11:34:10 +08:00
guqing 03368281cc
chore: reorganize package structure in application project (#6691)
* chore: reorganize package structure in application project
2024-09-23 17:59:03 +08:00
John Niang 8b3bde050f
Refactor ReactivePropertyAccessor by wrapping existing PropertyAccessor (#6686)
#### What type of PR is this?

/kind improvement
/area core
/area theme

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

This PR removes ReactivePropertyAccessor because it use `AstUtils#getPropertyAccessorsToTry` which is already hidden  in [the commit](33fbd7141d (diff-deaf3517fbd66f40a8717877a8328dee0fb2581dfb6be487f327dc73ea33b5b5)). If we upgraded to Spring Boot 3.4.0-M3, the code in ReactivePropertyAccessor would be broken.

More importantly, I believe there is one issue with the current implementation although it can resolve the reactive issue.
- The PropertyAccessor modified the process flow of SPEL

This PR provides some wrappers to wrap existing PropertyAccessor and MethodResolver to evaluate reactive return value.

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

```release-note
None
```
2024-09-23 08:47:15 +00:00
guqing 0dcab32712 feat: add API to fetch system configs by group 2024-09-23 16:01:29 +08:00
John Niang df195b12f2
Make ApplicationContext inaccessible in ServerWebExchange (#6679)
#### What type of PR is this?

/kind improvement
/area core
/area plugin
/milestone 2.20.x

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

Plugins can implement their own RouterFunctions and ControllerMappings, but those might expose root ApplicationContext for plugins, which is not expected.

So this PR fixes the insecure access to root ApplicationContext.

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

```release-note
None
```
2024-09-20 03:16:59 +00:00
John Niang a87dedd916
Make ApplicationContext inaccessible in ITemplateContext (#6680)
#### What type of PR is this?

/kind improvement
/area core
/area plugin
/milestone 2.20.x

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

This PR disables access to ApplicationContext using ITemplateContext.

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

```release-note
None
```
2024-09-20 03:14:58 +00:00
John Niang fb9aff00ca
Add chunked transfer support for rendering templates (#6580)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

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

This PR adds chunked transfer support for rendering templates, which means that the max memory used by rendering template will be max chunk size instead of size of rendering result.

Users can define the max chunk size like below:

```yaml
spring:
  thymeleaf:
    reactive:
      maxChunkSize: 8KB # Setting to 0 will disable the chunked response.
```

#### Special notes for your reviewer:

1. Try to start Halo instance
2. Execute the command like below and see if the response headers contain `transfer-encoding: chunked`:
		
    ```bash
	http http://localhost:8090/ -p h
	HTTP/1.1 200 OK
	Cache-Control: no-cache, no-store, max-age=0, must-revalidate
	Content-Language: en-CN
	Content-Type: text/html
	Expires: 0
	Pragma: no-cache
	Referrer-Policy: strict-origin-when-cross-origin
	Vary: Origin
	Vary: Access-Control-Request-Method
	Vary: Access-Control-Request-Headers
	X-Content-Type-Options: nosniff
	X-Frame-Options: SAMEORIGIN
	X-XSS-Protection: 0
	content-encoding: gzip
	set-cookie: XSRF-TOKEN=1e677724-ce82-4b63-911c-f78b22cd9169; Path=/
	transfer-encoding: chunked
	```

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

```release-note
优化模板渲染时所需的内存
```
2024-09-19 10:16:55 +00:00
guqing 1c31917778
chore: replace deprecated Version methods with updated API (#6678)
#### What type of PR is this?
/milestone 2.20.x
/area core

#### What this PR does / why we need it:
替换 Version 过时方法的引用为新 API

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-09-19 07:50:55 +00:00
guqing dcadd38843
feat: add Halo version variable to theme model (#6677)
#### What type of PR is this?
/kind feature
/milestone 2.20.x
/area theme

#### What this PR does / why we need it:
主题支持通过 `${site.version}` 得到 Halo 版本号

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

#### Does this PR introduce a user-facing change?
```release-note
主题支持通过 `${site.version}` 得到 Halo 版本号
```
2024-09-19 07:20:54 +00:00
John Niang 07077f7d0c
Provide ElementTagProcessor to handle element tag in plugin (#6670)
#### What type of PR is this?

/kind feature
/area plugin

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

This PR provides an interface ElementTagProcessor to make plugin handle element tag easily. e.g.:

```java
public class ImgTagProcessor implements ElementTagPostProcessor {

    @Override
    public Mono<Void> process(ITemplateContext context, IProcessableElementTag tag,
        IElementTagStructureHandler structureHandler) {
        var elementName = tag.getElementDefinition().getElementName();
        if (!Objects.equals("img", elementName.getElementName())) {
            return Mono.empty();
        }
        var srcAttr = tag.getAttribute("src");
        if (srcAttr == null) {
            return Mono.empty();
        }
        var newSrc = srcAttr.getValue();
        // TODO rewrite src
        structureHandler.setAttribute("src", newSrc);
        return Mono.empty();
    }
    
}
```

After PR merged, plugins https://github.com/webp-sh/halo-plugin-webp-cloud and https://github.com/guqing/plugin-cloudinary can be refined with new method.

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

```release-note
支持在插件中操作渲染结果
```
2024-09-19 02:56:53 +00:00
John Niang ded5b4135f
Generate JS and CSS bundle with fixed buffer size (#6573)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

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

If we are running Halo instance in machine with small memory available, the JS/CSS bundle might  not be accessible.

This RP refactors generation of JS and CSS bundle with fixed buffer size rather than length of original resources.

```java
2024-09-02T15:01:27.667+08:00  WARN 62039 --- [boundedElastic-3] reactor.core.Exceptions                  : throwIfFatal detected a jvm fatal exception, which is thrown and logged below:

java.lang.OutOfMemoryError: Java heap space
        at java.base/java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:64) ~[na:na]
        at java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:363) ~[na:na]
        at org.springframework.core.io.buffer.DefaultDataBuffer.allocate(DefaultDataBuffer.java:234) ~[spring-core-6.1.12.jar:6.1.12]
        at org.springframework.core.io.buffer.DefaultDataBuffer.setCapacity(DefaultDataBuffer.java:196) ~[spring-core-6.1.12.jar:6.1.12]
        at org.springframework.core.io.buffer.DefaultDataBuffer.ensureWritable(DefaultDataBuffer.java:228) ~[spring-core-6.1.12.jar:6.1.12]
        at org.springframework.core.io.buffer.DefaultDataBuffer.write(DefaultDataBuffer.java:296) ~[spring-core-6.1.12.jar:6.1.12]
        at org.springframework.core.io.buffer.DefaultDataBuffer.write(DefaultDataBuffer.java:289) ~[spring-core-6.1.12.jar:6.1.12]
        at org.springframework.core.io.buffer.DefaultDataBuffer.write(DefaultDataBuffer.java:43) ~[spring-core-6.1.12.jar:6.1.12]
        at run.halo.app.core.extension.service.impl.PluginServiceImpl.lambda$uglifyJsBundle$17(PluginServiceImpl.java:257) ~[classes/:na]
        at run.halo.app.core.extension.service.impl.PluginServiceImpl$$Lambda$4661/0x000000c80214e298.accept(Unknown Source) ~[na:na]
        at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:196) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxUsing$UsingFuseableSubscriber.onNext(FluxUsing.java:353) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxGenerate$GenerateSubscription.next(FluxGenerate.java:178) ~[reactor-core-3.6.9.jar:3.6.9]
        at org.springframework.core.io.buffer.DataBufferUtils$ReadableByteChannelGenerator.accept(DataBufferUtils.java:1002) ~[spring-core-6.1.12.jar:6.1.12]
        at org.springframework.core.io.buffer.DataBufferUtils$ReadableByteChannelGenerator.accept(DataBufferUtils.java:974) ~[spring-core-6.1.12.jar:6.1.12]
        at reactor.core.publisher.FluxGenerate.lambda$new$1(FluxGenerate.java:58) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxGenerate$$Lambda$4155/0x000000c802069228.apply(Unknown Source) ~[na:na]
        at reactor.core.publisher.FluxGenerate$GenerateSubscription.slowPath(FluxGenerate.java:271) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxGenerate$GenerateSubscription.request(FluxGenerate.java:213) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxUsing$UsingFuseableSubscriber.request(FluxUsing.java:320) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.request(FluxPeekFuseable.java:144) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxFlatMap$FlatMapInner.onSubscribe(FluxFlatMap.java:968) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onSubscribe(FluxPeekFuseable.java:178) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxUsing$UsingFuseableSubscriber.onSubscribe(FluxUsing.java:347) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxGenerate.subscribe(FluxGenerate.java:85) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxUsing.subscribe(FluxUsing.java:102) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.Flux.subscribe(Flux.java:8848) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:430) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.tryOnNext(FluxHandleFuseable.java:135) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxIterable$IterableSubscriptionConditional.slowPath(FluxIterable.java:664) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxIterable$IterableSubscriptionConditional.request(FluxIterable.java:623) ~[reactor-core-3.6.9.jar:3.6.9]
        at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.request(FluxHandleFuseable.java:260) ~[reactor-core-3.6.9.jar:3.6.9]

2024-09-02T15:01:27.681+08:00 DEBUG 62039 --- [boundedElastic-3] a.w.r.e.AbstractErrorWebExceptionHandler : [131a559b-102] Resolved [OutOfMemoryError: Java heap space] for HTTP GET /apis/api.console.halo.run/v1alpha1/plugins/-/bundle.js
2024-09-02T15:01:27.681+08:00 ERROR 62039 --- [boundedElastic-3] a.w.r.e.AbstractErrorWebExceptionHandler : [131a559b-102]  500 Server Error for HTTP GET "/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.js?v=1725260408176"

java.lang.OutOfMemoryError: Java heap space
        at java.base/java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:64) ~[na:na]
```

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

```release-note
优化在内存紧张时 Console 端无法加载插件资源的问题
```
2024-09-18 08:22:50 +00:00
guqing 749c80cb96
chore: cleanup subscription integration test (#6671)
#### What type of PR is this?
/kind cleanup
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
删除 SubscriptionServiceIntegrationTest 类。因为当前测试类不经常性出错,暂时无法排查原因。

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-09-18 04:18:49 +00:00
guqing a634065d48 feat: support JSON-based retrieval and update for theme and plugin configs 2024-09-14 16:10:31 +08:00
guqing 3fda9e6db4
refactor: remove trailing slash in site url for notification (#6660)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
修复 external-url 配置带了尾部斜杠导致邮件通知的查看通知链接无法访问的问题

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

#### Does this PR introduce a user-facing change?
```release-note
修复 external-url 配置带了尾部斜杠导致邮件通知的查看通知链接无法访问的问题
```
2024-09-14 07:16:31 +00:00
John Niang a9c0ecebe3
Support resolving i18n message with standard way (#6648)
#### What type of PR is this?

/kind feature
/area theme
/sig docs
/milestone 2.20.x

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

After this PR, we can define i18n message files next to the template file.

```yaml
i18n:
    default.properties
templates:
    index.html
    index.properties # Higher properties than default.properties
    index_zh.properties # Higher properties than index.properties
    index_zh_CN.properties # Higher priority than index_zh.properties
```

It's convenient for plugins that define the template files.

See https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html#standard-message-resolver for more.

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

```release-note
支持在主题中通过 Thymeleaf 默认行为实现国际化
```
2024-09-14 02:52:30 +00:00
John Niang c5f9c766bb
Support changing locale using query language (#6658)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

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

This PR adds support changing locale using query `language`. After passing the query, we will automatically respond a cookie `language` back to browser.

Please see the result below:

```bash
http http://localhost:8090/\?language\=zh-CN Accept:text/html -p h

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Language: zh-CN
Content-Type: text/html
Expires: 0
Pragma: no-cache
Referrer-Policy: strict-origin-when-cross-origin
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
content-encoding: gzip
content-length: 4765
set-cookie: language=zh-CN; Path=/; Secure
set-cookie: XSRF-TOKEN=f0f2c972-0024-4575-aef2-0609356b4757; Path=/
```

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

```release-note
支持利用参数 language 切换地域语言
```
2024-09-14 02:48:29 +00:00
Ryan Wang 46793af0bd
fix: correct ordered list styling issue in editor (#6656)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.20.x

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

修复编辑器中有序列表的样式问题。

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

Fixes #6615 

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

```release-note
修复编辑器中有序列表的样式问题。
```
2024-09-13 09:40:26 +00:00
John Niang 8ab8a440b6
Simplify ThemeLocaleContextResolver (#6651)
#### What type of PR is this?

/kind improvement
/area theme
/milestone 2.20.x

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

This PR simplifies ThemeLocaleContextResolver by removing unused attributes. 

In another PR <https://github.com/halo-dev/halo/pull/6647>, fixed locale resolution for query parameter `language`. This PR fixes locale resolution for cookie `language` as well.

Please see the results below:

```bash
http https://www.halo.run/ Cookie:language=zh-CN -p h

HTTP/1.1 200 OK
Content-Language: und
```

```bash
http http://localhost:8090 Cookie:language=zh-CN -p h

HTTP/1.1 200 OK
Content-Language: zh-CN
```

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

```release-note
None
```
2024-09-13 07:44:26 +00:00
Takagi 25eec1ec4f
pref: improve hover and pre-selection state for formkit select (#6607)
#### What type of PR is this?

/kind improvement
/area ui
/milestone 2.20.x

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

优化了 Formkit 中的 selec 组件,使得其使用快捷键与鼠标选中的预选状态始终只有一个。且在多选状态下按回车时,不再预选跳转至第一个选项。

#### How to test it?

在多选状态下测试使用键盘进行预选及使用鼠标 hover 进行预选的状态是否符合预期。

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

Fixes #6600

#### Does this PR introduce a user-facing change?
```release-note
优化 Formkit select 组件在多选状态下的待选中状态。
```
2024-09-13 02:22:26 +00:00
guqing 7ed859cefb
refactor: prevent replies to comments that are pending approval (#6622)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
不允许回复未通过审核的评论

#### Does this PR introduce a user-facing change?
```release-note
禁止非管理员回复未通过审核的评论
```
2024-09-13 02:14:25 +00:00
guqing 07d200b45b
Trigger attachment status update on storage policy config change (#6639) 2024-09-12 17:13:19 +08:00
John Niang 6a5e9c4932
Fix the problem of resolving locale context by language parameter (#6647)
#### What type of PR is this?

/kind bug
/area theme
/milestone 2.20.x

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

If we pass a query `language` while requesting index page, we will get the wrong header `Content-Language`. Please see the result below:

```bash
http https://www.halo.run/\?language\=zh-CN -p h

HTTP/1.1 200 OK
Content-Language: und
...
```

After fixing, we will get the right header `Content-Language`.

```bash
http http://localhost:8090/\?language\=zh-CN -p h

HTTP/1.1 200 OK
Content-Language: zh-CN
...
```

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

```release-note
修复主题端区域和语言解析错误的问题
```
2024-09-12 09:12:22 +00:00
Ryan Wang 697963d628
feat: add menu select form item (#6642)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.20.x

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

为 FormKit 添加菜单选择输入类型

<img width="549" alt="image" src="https://github.com/user-attachments/assets/b5e40c1d-908f-4cdc-89d5-76f9b67ae298">

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

```release-note
为 FormKit 添加菜单选择输入类型
```
2024-09-12 05:28:20 +00:00
John Niang ba18f7010b
Update attachment permalink only when handler is available (#6641) 2024-09-12 11:02:21 +08:00
John Niang a36822c861
Expose CryptoService and RateLimiterRegistry to plugins (#6638)
#### What type of PR is this?

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

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

Currently, we are refactoring login and logout pages to make them extensible. If plugins want to realize a new authentication method, the CryptoService and RateLimiterRegistry may be used to authenticate.

So this PR exposes the two beans to plugins. No side effect will be introduced.

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

```release-note
【开发相关】允许在插件使用 CryptoService 和 RateLimiterRegistry
```
2024-09-12 02:34:20 +00:00
guqing 39545a1e4c
refactor: optimize request headers when generating thumbnails from URI (#6628)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
优化根据 URI 生成缩略图时的请求头

1. 由于之前 attachment 的 permalink 是 `URI.toString` 会导致根据 permalink 索引查询附件可能由于编码问题无法查询到导致生成缩略图只能根据 URI 生成
2. 可能配置了 nginx 判断请求头不允许脚本请求如导致根据 URI 访问图片无法访问导致无法生成,如
```
if ($http_user agent ~*(python curlljava wget go-http-client httpclient okhttp)){
}
```

Fixes #6627

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-09-10 09:28:10 +00:00
Takagi b02ab8d809
fix: resolve incorrect display of options in formkit selector with async data (#6629)
#### What type of PR is this?

/kind bug
/area ui
/milestone 2.20.x

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

为 formkit select 组件优化逻辑,目前将可以监听到 options 的变化,用于在变化时设置值。用于解决当 options 是异步获取,而 value 是初始设置时,无法显示正常的 label。

#### How to test it?

测试 options 比设置 value 晚时,数据能否正常显示 label。

#### Does this PR introduce a user-facing change?
```release-note
解决当 formkit select 组件中的 options 延迟设置时无法正常回显的问题。
```
2024-09-10 08:16:10 +00:00
Takagi 3c785cb7c8
fix: correct boolean value display issue in formkit selector component (#6624)
#### What type of PR is this?

/kind bug
/area ui
/milestone 2.20.x

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

解决 Formkit Selector 在值为布尔或者数字类型时,回显时内容不正常的问题。

#### How to test it?

测试当 FormKit Select 组件的值为布尔或者数字时,回显的内容是否正常。 

#### Does this PR introduce a user-facing change?
```release-note
修复 FormKit Select 组件中布尔值的显示问题。
```
2024-09-10 07:56:10 +00:00
John Niang 93ffb7d8ea
Prevent null role while getting permissions (#6612)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.20.x

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

This PR filters blank role name while granting roles for an user to prevent null role in permissions.

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

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

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

```release-note
修复取消用户角色后无法正常渲染用户列表的问题
```
2024-09-06 14:01:52 +00:00
Takagi cf2837d744
fix: formkit select component not emitting event or updating selection on value change (#6602)
#### What type of PR is this?

/kind bug
/area ui
/milestone 2.20.x

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

重新修改 formkit select 初始化值的监听方式,用于当 value 发生变化时,使选项值可以发生变化。

另外在更新数据时,如果数据发生变化,则发出 `onChange` 事件。

> 需要注意的是,通过 v-modal 传入默认值,再将此值改为 `undefined` 时无法触发 `watch` 及 formkit 的 `input` 事件,原因暂时未知,将此值设置为 `""` 即可正常触发。

#### How to test it?

由于此 PR 改动了初始化的方式,因此需要全量测试所有使用 `Select` 组件的位置。包括多选与单选,本地源与远程源。确保功能符合预期。

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

Fixes #6594 

#### Does this PR introduce a user-facing change?
```release-note
解决 Formkit Select 组件在值变更时不会发出事件及修改选项值的问题。
```
2024-09-06 09:45:51 +00:00
guqing 2ea063d37f
fix: skip thumbnail generation for GIF images (#6597)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
修复 GIF 缩略图生成只会保留第一帧的问题

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

#### Does this PR introduce a user-facing change?
```release-note
修复 GIF 缩略图生成只会保留第一帧的问题
```
2024-09-06 09:27:52 +00:00
Takagi 6cdd2a7588
fix: resolve issue with disabled property in options not working (#6595)
#### What type of PR is this?

/kind bug
/area ui

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

解决 formkit select 组件中,option 使用 `attrs: { disabled: true }` 无效的问题。

#### How to test it?

测试在 formkit select 组件中,option 设置 disabled 属性是否有效。

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

Fixed #6592 

#### Does this PR introduce a user-facing change?
```release-note
解决 formkit select 组件的 Option 设置 disabled 无效的问题
```
2024-09-06 09:25:52 +00:00
Takagi 51609abc57
pref: add parameter to formkit select component for remote search by specific field (#6591)
#### What type of PR is this?

/kind improvment
/area ui
/milestone 2.20.x

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

为 Formkit Select 组件增加 `fieldSelectorKey` 字段,用于在使用 `fieldSelector` 字段远程查询时,指定查询所使用的 Key。

例如指定 `fieldSelectorKey` 为 `metadata.name` 则接口调用时的参数为 `fieldSelector: metadata.name=(admin)`。

#### How to test it?

测试在远程搜索时,`fieldSelector` 的查询 key 是否为设置的内容。

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

Fixes #6589 

#### Does this PR introduce a user-facing change?
```release-note
为 Formkit Select 组件远程查询增加指定 Key 的字段。
```
2024-09-06 09:23:52 +00:00
Takagi b80522e486
docs: add documentation for formkit select allowCreate property (#6590)
#### What type of PR is this?

/kind documentation
/area docs

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

补充 formkit select 组件中关于 allowCreate 属性的文档

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

Fixes halo-dev/docs#408 

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-09-05 07:29:47 +00:00
Takagi 733679d5ac
fix: resolve error when adding tables in default editor (#6587)
#### What type of PR is this?

/kind bug
/area ui
/milestone 2.20.x

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

在过滤默认编辑器重复扩展时,移除将扩展扁平化的操作。并且若扩展没有 name,则不对其进行过滤,用于解决一些潜在的问题。

#### How to test it?

测试在默认编辑器中新增 table ,是否会出现报错。

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

Fixes #6585 

#### Does this PR introduce a user-facing change?
```release-note
解决在默认编辑器中添加表格报错的问题
```
2024-09-04 14:11:44 +00:00
guqing 7991ef8cf1
refactor: preserve original image if smaller than requested thumbnail size (#6582)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
当生成缩略图时如果原图尺寸小于请求尺寸则返回原图以保持其质量

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

#### Does this PR introduce a user-facing change?
```release-note
当生成缩略图时如果原图尺寸小于请求尺寸则返回原图以保持其质量
```
2024-09-04 06:07:43 +00:00
John Niang 19de4db273
Fix the problem that Lucene lock is held by VM (#6570)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.20.x

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

This PR add keyword synchronized for methods `addOrUpdateDocuments`, `deleteDocuments` and `deleteAll` to ensure the write lock of Lucene is obtained only by one IndexWriter at the same time.

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

Fixes #6569 

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

```release-note
修复重启后无法搜索部分文档的问题
```
2024-09-03 05:11:39 +00:00
John Niang 7281a48325
Prepare for developing 2.20.0 (#6575)
#### What type of PR is this?

/kind cleanup
/area core

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

This PR bumps all version to 2.20.0 to prepare for next development.

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

```release-note
None
```
2024-09-02 09:41:37 +00:00