mirror of https://github.com/halo-dev/halo
Add width parameter to thumbnail endpoint for flexible size handling
parent
398a818935
commit
f0cfd78e7f
|
@ -20,12 +20,12 @@ import run.halo.app.core.attachment.ThumbnailService;
|
||||||
import run.halo.app.core.attachment.ThumbnailSize;
|
import run.halo.app.core.attachment.ThumbnailSize;
|
||||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||||
import run.halo.app.extension.GroupVersion;
|
import run.halo.app.extension.GroupVersion;
|
||||||
import run.halo.app.extension.ReactiveExtensionClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thumbnail endpoint for thumbnail resource access.
|
* Thumbnail endpoint for thumbnail resource access.
|
||||||
*
|
*
|
||||||
* @author guqing
|
* @author guqing
|
||||||
|
* @author johnniang
|
||||||
* @since 2.19.0
|
* @since 2.19.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@ -34,8 +34,6 @@ public class ThumbnailEndpoint implements CustomEndpoint {
|
||||||
|
|
||||||
private final ThumbnailService thumbnailService;
|
private final ThumbnailService thumbnailService;
|
||||||
|
|
||||||
private final ReactiveExtensionClient client;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RouterFunction<ServerResponse> endpoint() {
|
public RouterFunction<ServerResponse> endpoint() {
|
||||||
var tag = "ThumbnailV1alpha1Public";
|
var tag = "ThumbnailV1alpha1Public";
|
||||||
|
@ -57,7 +55,17 @@ public class ThumbnailEndpoint implements CustomEndpoint {
|
||||||
.implementation(ThumbnailSize.class)
|
.implementation(ThumbnailSize.class)
|
||||||
.description("The size of the thumbnail")
|
.description("The size of the thumbnail")
|
||||||
.required(true)
|
.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();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue