Add width parameter to thumbnail endpoint for flexible size handling

John Niang 2025-09-30 15:36:08 +08:00
parent 398a818935
commit f0cfd78e7f
No known key found for this signature in database
GPG Key ID: D7363C015BBCAA59
1 changed files with 12 additions and 4 deletions

View File

@ -20,12 +20,12 @@ import run.halo.app.core.attachment.ThumbnailService;
import run.halo.app.core.attachment.ThumbnailSize;
import run.halo.app.core.extension.endpoint.CustomEndpoint;
import run.halo.app.extension.GroupVersion;
import run.halo.app.extension.ReactiveExtensionClient;
/**
* Thumbnail endpoint for thumbnail resource access.
*
* @author guqing
* @author johnniang
* @since 2.19.0
*/
@Component
@ -34,8 +34,6 @@ public class ThumbnailEndpoint implements CustomEndpoint {
private final ThumbnailService thumbnailService;
private final ReactiveExtensionClient client;
@Override
public RouterFunction<ServerResponse> endpoint() {
var tag = "ThumbnailV1alpha1Public";
@ -57,7 +55,17 @@ public class ThumbnailEndpoint implements CustomEndpoint {
.implementation(ThumbnailSize.class)
.description("The size of the thumbnail")
.required(true)
);
)
.parameter(parameterBuilder()
.in(ParameterIn.QUERY)
.name("width")
.description("""
The width of the thumbnail, if 'size' is not provided, this \
parameter will be used to determine the size\
""")
.required(false)
)
;
})
.build();
}