mirror of https://github.com/halo-dev/halo
Deprecate LocalThumbnail, LocalThumbnailsReconciler, Thumbnail, and ThumbnailReconciler classes for removal in version 2.22.0
parent
b941047c99
commit
c3cda7df48
|
@ -1,41 +0,0 @@
|
|||
package run.halo.app.core.attachment;
|
||||
|
||||
import static run.halo.app.infra.FileCategoryMatcher.IMAGE;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.util.Assert;
|
||||
import run.halo.app.core.extension.attachment.Attachment;
|
||||
|
||||
@UtilityClass
|
||||
public class AttachmentUtils {
|
||||
/**
|
||||
* Check whether the attachment is an image.
|
||||
*
|
||||
* @param attachment Attachment must not be null
|
||||
* @return true if the attachment is an image, false otherwise
|
||||
*/
|
||||
public static boolean isImage(Attachment attachment) {
|
||||
Assert.notNull(attachment, "Attachment must not be null");
|
||||
var mediaType = attachment.getSpec().getMediaType();
|
||||
return mediaType != null && IMAGE.match(mediaType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert URI to URL.
|
||||
*
|
||||
* @param uri URI must not be null
|
||||
* @return URL
|
||||
* @throws IllegalArgumentException if the URL is malformed
|
||||
*/
|
||||
public static URL toUrl(@NonNull URI uri) {
|
||||
try {
|
||||
return uri.toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ import run.halo.app.extension.GVK;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
@GVK(group = "storage.halo.run", version = "v1alpha1", kind = "LocalThumbnail",
|
||||
plural = "localthumbnails", singular = "localthumbnail")
|
||||
@Deprecated(forRemoval = true, since = "2.22.0")
|
||||
public class LocalThumbnail extends AbstractExtension {
|
||||
public static final String UNIQUE_IMAGE_AND_SIZE_INDEX = "uniqueImageAndSize";
|
||||
public static final String REQUEST_TO_GENERATE_ANNO = "storage.halo.run/request-to-generate";
|
||||
|
|
|
@ -14,6 +14,7 @@ import run.halo.app.extension.GVK;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
@GVK(group = "storage.halo.run", version = "v1alpha1", kind = "Thumbnail",
|
||||
plural = "thumbnails", singular = "thumbnail")
|
||||
@Deprecated(forRemoval = true, since = "2.22.0")
|
||||
public class Thumbnail extends AbstractExtension {
|
||||
|
||||
public static final String ID_INDEX = "thumbnail-id";
|
||||
|
|
|
@ -21,6 +21,7 @@ import run.halo.app.extension.controller.Reconciler;
|
|||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Deprecated(forRemoval = true, since = "2.22.0")
|
||||
class LocalThumbnailsReconciler implements Reconciler<Reconciler.Request> {
|
||||
|
||||
private static final String CLEAN_UP_FINALIZER = "thumbnail-cleaner";
|
||||
|
|
|
@ -11,6 +11,7 @@ import run.halo.app.extension.controller.Reconciler;
|
|||
|
||||
@Slf4j
|
||||
@Component
|
||||
@Deprecated(forRemoval = true, since = "2.22.0")
|
||||
class ThumbnailReconciler implements Reconciler<Reconciler.Request> {
|
||||
|
||||
private final ExtensionClient client;
|
||||
|
|
Loading…
Reference in New Issue