Commit Graph

703 Commits

Author SHA1 Message Date
John Niang
fe445fbe41 Refactor IndexRouteFactory to use lazy loading for posts with timeout 2025-12-10 15:08:20 +08:00
John Niang
747d7edc24 Apply timeout to reactive blocking operations (#8004) 2025-12-10 15:06:42 +08:00
Ryan Wang
488f9cc7c4 Make content fields required in post and content models (#7972)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.22.x

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

See #7967 

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

Fixes #7967 

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

```release-note
None
```
2025-12-01 02:39:37 +00:00
John Niang
3a177fe050 Clean up generated thumbnails on out-of-memory errors (#7928)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.22.x

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

When OOME occurs, the created empty thumbnail files won't be cleaned up. As a result, subsequent requests of the thumbnail will respond 200(OK) status only.

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

```release-note
None
```
2025-11-11 14:16:41 +00:00
Jerry
897558f08c fix: Error detection method in the MIMEType and file extension matching stage (#7922)
### What type of PR is this?

/kind bug

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

Ref: #7903 

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

Fixes #7661
Fixes #7903 

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

```release-note
修复因文件类型与文件拓展名匹配导致无法上传部分文件的问题
```
2025-11-11 02:00:40 +00:00
John Niang
9f20ce42e8 Add requeue logic for missing theme settings in SettingUtils (#7923) 2025-11-07 21:34:25 +08:00
John Niang
71c621b9b1 Refactor Thymeleaf dependencies to resolve potential memory leak (#7914)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.22.x

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

Supersedes <https://github.com/halo-dev/halo/pull/7678>.

See https://github.com/halo-dev/thymeleaf/pull/4 for more.

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

```release-note
修复潜在的内存泄漏问题
```
2025-11-06 13:42:29 +00:00
John Niang
da4ca5309d Replace TemplateEngine with SpringTemplateEngine in ThumbnailImgTagPostProcessorTest (#7916)
#### What type of PR is this?

/kind bug
/are core
/milestone 2.22.x

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

This PR replaces TemplateEngine with SpringTemplateEngine in ThumbnailImgTagPostProcessorTest because ongl dependencies was removed by Thymeleaf Spring6.

If we don't include thymeleaf dependency manually, the unit test will fail as below:

```java
java.lang.NoClassDefFoundError: ognl/PropertyAccessor
	at org.thymeleaf.standard.StandardDialect.getVariableExpressionEvaluator(StandardDialect.java:178)
	at org.thymeleaf.standard.StandardDialect.getExecutionAttributes(StandardDialect.java:392)
	at org.thymeleaf.DialectSetConfiguration.build(DialectSetConfiguration.java:263)
	at org.thymeleaf.EngineConfiguration.<init>(EngineConfiguration.java:123)
	at org.thymeleaf.TemplateEngine.initialize(TemplateEngine.java:341)
	at org.thymeleaf.TemplateEngine.getConfiguration(TemplateEngine.java:411)
	at run.halo.app.core.attachment.thumbnail.ThumbnailImgTagPostProcessorTest.setUp(ThumbnailImgTagPostProcessorTest.java:42)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.ClassNotFoundException: ognl.PropertyAccessor
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	... 10 more
```

> https://github.com/halo-dev/halo/actions/runs/19129978229/job/54668145618

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

```release-note
None
```
2025-11-06 11:52:31 +00:00
John Niang
9dc980d923 Upgrade to Gradle 9.2.0 (#7886)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.22.x

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

This PR upgrades to Gradle [9.2.0](https://github.com/gradle/gradle/releases/tag/v9.2.0) and enable configuration cache by default.

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

```release-note
None
```
2025-11-05 03:18:26 +00:00
John Niang
705713c345 Enforce email validation and normalize case for password reset and verification (#7901)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.22.x

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

This PR enforces emai lvalidation and normalize case for password reset and verification.

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

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

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

```release-note
优化重置密码时因邮箱可输入大小写导致的问题
```
2025-11-05 03:10:26 +00:00
柳意梧情
5a47be9783 Add protected usernames restriction to sign-up (#7887)
#### What type of PR is this?

/kind feature

#### What this PR does / why we need it:
- 自定义设置限制用户名注册

<img width="500" alt="image" src="https://github.com/user-attachments/assets/b4e72734-4740-4f5e-93d5-3745a2d58136" />
<img width="500" alt="803e971cf23cebb212379cbc35c5d3a2" src="https://github.com/user-attachments/assets/c6429096-d600-4539-9b65-9a0670dc6197" />

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

Fixes #7165

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

```release-note
用户注册支持设置受保护用户名
```
2025-10-31 08:10:19 +00:00
John Niang
ef896539a8 Remove unused fields from User and UserVo classes (#7880)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.22.x

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

This PR removes unused fields(`status.loginAt` and `status.loginHistory`) from User and UserVo classes.

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

```release-note
None
```
2025-10-28 13:52:19 +00:00
John Niang
9c211d7e7a Add built-in plugins initializer and refactor plugin manager integration 2025-10-28 18:19:17 +08:00
John Niang
edc940ed56 Make UI build optional by changing dependency to mustRunAfter in build.gradle (#7878)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.22.x

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

This PR changes dependency `:ui:doBuild` to mustRunAfter for task `:application:copyUiDist` to speed up build process in IDEA. So that we can run our unit tests quicker and run task `bootRun` during UI development.

#### Special notes for your reviewer:

Make sure executing task `./gradlew build` will include UI resources.

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

```release-note
None
```
2025-10-28 09:36:16 +00:00
John Niang
dc7cd46d36 Refactor RequestSynchronizer to list all names in batches for improved performance (#7860)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.22.x

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

This PR refactors RequestSynchronizer to list all names in batches for improved performance and refactors reconciler classes to replace DefaultExtensionMatcher with syncAllListOptions for improved query handling.

See https://github.com/halo-dev/halo/pull/6145 for more.

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

```release-note
None
```
2025-10-23 09:30:14 +00:00
John Niang
470cd3cc02 Refactor index engine to improve indexing and query performance (#7822)
#### What type of PR is this? 
 
/kind bug 
/kind improvement 
/kdin api-change 
/area core 
/area plugin 
/milestone 2.22.x 
 
#### What this PR does / why we need it: 
 
This PR refactors index engine entirely to improve indexing and query performance. 
 
Meanwhile, these changes allow developers to configure various index types instead of String only, such as Boolean, Integer, Instant an so on. 
 
#### Which issue(s) this PR fixes: 
 
This PR also fixes some potential bugs, such as <https://github.com/halo-dev/halo/issues/7622>, <https://github.com/halo-dev/halo/pull/6934>, <https://github.com/halo-dev/halo/issues/6466> and so on. 
 
Fixes https://github.com/halo-dev/halo/issues/7622 
 
#### Special notes for your reviewer: 
 
Make sure these changes are backwardly compatible for old data. 
 
#### Does this PR introduce a user-facing change? 
 
```release-note 
优化索引引擎以提升索引和查询性能 
```
2025-10-22 10:04:16 +00:00
John Niang
508881d76e Refactor safeToUri method in HaloUtils to handle mixed special characters in URIs (#7829) 2025-10-20 14:50:44 +08:00
John Niang
90b292288e Upgrade Checkstyle to version 12.1.0 and standardize plugin declaration (#7828) 2025-10-20 11:16:54 +08:00
John Niang
468eac0938 Add safeToUri method to HaloUtils for robust URI conversion (#7825) 2025-10-18 19:21:54 +08:00
John Niang
daad2c94d9 Fix thumbnail handling for special characters in permalinks (#7821) 2025-10-18 12:12:56 +08:00
John Niang
9966e3c608 Enhance thumbnail retrieval to support relative permalinks and local site checks (#7820)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.22.x

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

This PR enhances thumbnail retrieval to support relative permalinks and in-site checks.

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

```release-note
None
```
2025-10-17 13:29:52 +00:00
John Niang
fc46737f8e Enhance thumbnail generation with configurable quality and improved path resolution (#7815)
#### What type of PR is this?

/kind improvement
/kind bug
/area core
/milestone 2.22.x

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

This PR enhances thumbnail generation with configurable quality and also fixes incorrect thumbnail generation due to invalid cache key.

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

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

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

```release-note
None
```
2025-10-17 09:11:50 +00:00
John Niang
2f0d83fc8b Add conserveMemoryWorkaround property to thumbnailator configuration (#7817) 2025-10-17 17:10:23 +08:00
John Niang
929e5fb4cb Refactor thumbnail generation to support configurable concurrent threads and disable option (#7812)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.22.x

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

This PR refactors thumbnail generation to support configurable concurrent threads and disable option.

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

```release-note
支持配置缩略图生成启用、禁用和并发量
```
2025-10-17 06:51:51 +00:00
John Niang
84eefe37fa Use ResourceTransformer to implement thumbnails for all images under attachments (#7791)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.22.x

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

This PR use ResourceTransformer to implement thumbnails for all images under attachments, such as `attachments/migrate-from-1.x`, `attachments/migrate-from-wp`.

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

```release-note
None
```
2025-10-03 04:00:27 +00:00
Ryan Wang
41005f2c0e Add new plugins to presetPluginUrls list (#7785)
Added plugin-shiki v1.0.1 and plugin-editor-hyperlink-card v1.5.2 to the presetPluginUrls in build.gradle to support their automatic download and inclusion.
2025-10-03 00:15:24 +08:00
John Niang
300af1edc3 Fix recursive update issue in concurrent map for thumbnail generation (#7789)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.22.x

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

This PR fixes recursive update issue in concurrent map for thumbnail generation.

```java
java.lang.IllegalStateException: Recursive update
	at java.base/java.util.concurrent.ConcurrentHashMap.replaceNode(Unknown Source) ~[na:na]
```

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

```release-note
None
```
2025-10-02 10:22:25 +00:00
John Niang
43f41c3fc2 Handle invalid characters in permalink URI construction (#7788)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.22.x

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

This PR fixes invalid characters in permalink URI construction.

```java
java.lang.IllegalArgumentException: Invalid character ' ' for PATH in "/upload/2021/04/Web 14ecd358cce14f9f9ca0fa7a1716b5d8.pdf"
	at org.springframework.web.util.HierarchicalUriComponents.verifyUriComponent(HierarchicalUriComponents.java:422) ~[spring-web-6.2.11.jar:6.2.11]
	at org.springframework.web.util.HierarchicalUriComponents$FullPathComponent.verify(HierarchicalUriComponents.java:922) ~[spring-web-6.2.11.jar:6.2.11]
	at org.springframework.web.util.HierarchicalUriComponents.verify(HierarchicalUriComponents.java:386) ~[spring-web-6.2.11.jar:6.2.11]
	at org.springframework.web.util.HierarchicalUriComponents.<init>(HierarchicalUriComponents.java:146) ~[spring-web-6.2.11.jar:6.2.11]
	at org.springframework.web.util.UriComponentsBuilder.buildInternal(UriComponentsBuilder.java:346) ~[spring-web-6.2.11.jar:6.2.11]
	at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:334) ~[spring-web-6.2.11.jar:6.2.11]
	at run.halo.app.core.attachment.endpoint.LocalAttachmentUploadHandler.doGetPermalink(LocalAttachmentUploadHandler.java:296) ~[classes/:2.22.0-SNAPSHOT]
	at run.halo.app.core.attachment.endpoint.LocalAttachmentUploadHandler.getPermalink(LocalAttachmentUploadHandler.java:266) ~[classes/:2.22.0-SNAPSHOT]
	at run.halo.app.core.user.service.impl.DefaultAttachmentService.lambda$getPermalink$12(DefaultAttachmentService.java:128) ~[classes/:2.22.0-SNAPSHOT]
```

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

```release-note
修复可能无法正常获取附件链接的问题
```
2025-10-02 05:06:25 +00:00
John Niang
033117cd9c Refactor image attachment thumbnail feature 2025-10-02 10:29:30 +08:00
John Niang
db00883c3d Set dynamic branch name for Docker image tags in build.gradle (#7780) 2025-09-24 12:17:33 +08:00
Ryan Wang
d0f050ff86 Enable auto-height for textarea fields in forms (#7749)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.21.x

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

Add auto-height prop to  formkit textarea to support automatic resizing based on content length.

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

```release-note
Console 端的部分多行文本输入框支持自动高度。
```
2025-09-20 15:16:03 +00:00
John Niang
f1a2669604 Update GitHub Container Registry namespace for Docker image publishing 2025-09-18 23:23:27 +08:00
John Niang
5633446434 Refactor build tasks to improve UI distribution and cleanup processes (#7768) 2025-09-18 17:49:06 +08:00
John Niang
01304d7fec Remove Fit2Cloud registry publishing due to persistent 403 errors (#7767) 2025-09-18 17:01:13 +08:00
John Niang
35504b4e5a Update Docker image name and tags for Fit2Cloud registry 2025-09-16 23:59:04 +08:00
John Niang
cd2dac7f01 Add build and publish tasks for Docker images using Buildpacks 2025-09-16 20:06:44 +08:00
John Niang
010bb8a569 Handle ghost users in user retrieval logic (#7745)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.21.x

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

This PR fixes the always show of ghost user in post contributors.

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

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

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

```release-note
修复文章贡献者中始终显示已删除用户的问题
```
2025-09-10 06:46:52 +00:00
John Niang
291d8dafb2 Restore context ClassLoader management during plugin lifecycle (#7746)
#### What type of PR is this?

/kind improvement
/area plugin
/milestone 2.21.x

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

This PR restores context ClassLoader mangement during plugin lifecycle to prevent resource leak.

Meanwhile, it also fixes Class initialization error when starting plugins.

Superseds https://github.com/halo-dev/halo/pull/7725

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

```release-note
None
```
2025-09-10 06:44:51 +00:00
John Niang
2a37366c92 Set context ClassLoader to plugin ClassLoader for correct class loading operations (#7725)
#### What type of PR is this?

/kind bug
/area plugin
/milestone 2.21.x

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

This PR fixes the problem that loading resources from class path during static initialization doesn't work.

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

```release-note
修复部分场景下无法正常启动插件的问题
```
2025-08-29 03:30:15 +00:00
John Niang
956e23dd7f Allow deserializing ListResult (#7711)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.21.x

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

This PR allows ListResult to be deserialized with JSON. So we can resolve ListResult response of APIs correctly.

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

```release-note
None
```
2025-08-21 10:15:48 +00:00
Ryan Wang
4ac80f5eb3 Update comment widget plugin to v3.0.0 (#7705) 2025-08-19 15:32:02 +08:00
Ryan Wang
3487132154 Add support for hidden comments (#7679)
* Add 'hidden' field to comment and reply requests

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

* Add support for filtering comments with hidden

* Specify hidden=false and approved=true for anonymous users

* Set default hidden flag only if null in comments

* Add 'private reply' option to comment modals

* Add private tag for hidden comments and replies

* Allow hiding comments only

* Enhance comment visibility logic to allow owners to view hidden comments

* Remove hidden input for reply form

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

* Refine i18n

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

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: John Niang <johnniang@foxmail.com>
2025-08-19 14:47:37 +08:00
Ryan Wang
3345ccb035 Merge pull request #7695 from ruibaby/feat/comment-a-target
Allow target attribute on <a> tags in comment sanitizer
2025-08-17 23:38:00 +08:00
Ryan Wang
2bcfbbc371 Optimize comment notification template to support rich text rendering (#7683)
#### What type of PR is this?

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

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

Optimize comment notification template to support rich text rendering

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

```release-note
None
```
2025-08-13 07:32:50 +00:00
Ryan Wang
eddcb5bc38 Allow <s> tag and class attribute on <code> in comments (#7682)
#### What type of PR is this?

/area code
/milestone 2.21.x
/kind improvement

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

Comments are allowed to contain `s` tags and `code` tags with class attributes for the following reasons:

1. `s`: The comment component uses tiptap editor's [strikethrough extension](https://tiptap.dev/docs/editor/extensions/marks/strike#:~:text=while%20you%20type.-,Restrictions,-The%20extension%20will) which enforces the use of `s` tags for strikethrough text and cannot be changed.
2. `code[class]`: Used for code highlighting (class="language-*")

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

```release-note
None
```
2025-08-13 07:14:50 +00:00
John Niang
6f608f12aa Fix the problem of memory leak caused by thymeleaf (#7678)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.21.x

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

This PR replaces the dependency `thymeleaf-spring6` to apply the memory leak fix of <https://github.com/halo-dev/thymeleaf/pull/1>.

Please note that this is a temporary fix, and we would revert this PR after Thymeleaf official released a new version including my fix.

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

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

#### Special notes for your reviewer:

1. Execute command ab -c 100 -n 1000 -H 'Accept: text/html' -H 'Cache-Control: no-cache' http://localhost:8090/ and then press Ctrl + C to stop the thread.
2. See logs in Halo

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

```release-note
修复在特定情况下模板引擎可能出现内存泄漏的问题
```
2025-08-12 10:46:48 +00:00
John Niang
535fe01624 Check if the contents of comment and reply are valid before persistence (#7677)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.21.x

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

This PR checks if the contents of comment and reply are valid before persistence to prevent users from XSS attacks.

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

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

#### Special notes for your reviewer:

Try to comment or reply with the contents from <https://cheatsheetseries.owasp.org/cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html>.

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

```release-note
检测评论和回复内容是否合法以防止 XSS 攻击
```
2025-08-12 04:08:46 +00:00
Ryan Wang
59030f839a Refactor SEO meta tag processors and update help texts for ui (#7665)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.21.x

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

This PR optimizes SEO tag generation with the following changes:

1. Site description and keywords settings now only apply to the homepage and are no longer inserted on other pages.
2. Added meta description tags for category archive pages, using the category description as content.
3. Improved the help text descriptions for SEO options in system settings.

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

Fixes #7662 

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

```release-note
优化页面的 SEO 标签的生成
```
2025-08-08 12:42:41 +00:00
John Niang
576dda9d74 Add social login endpoint for remember-me support (#7670)
#### What type of PR is this?

/kind feature
/kind api-change
/area core
/milestone 2.21.x

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

This PR adds a new endpoint `POST /login/social/{auth_provider_name}?remember-me=true` to make the social login support remember-me mechanism. 

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

```release-note
支持社交登录时选择是否保持登录
```
2025-08-08 11:06:39 +00:00
Ryan Wang
9607ee4912 chore: bump preset plugins and theme version (#7667)
#### What type of PR is this?

/area core
/milestone 2.21.x

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

Bump all preset plugins and theme version

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

```release-note
None
```
2025-08-06 16:12:38 +00:00