mirror of https://github.com/halo-dev/halo
Merge remote-tracking branch 'upstream/main' into refactor/6468
commit
9de18d82c3
|
@ -8,8 +8,8 @@ import reactor.core.publisher.Mono;
|
|||
import run.halo.app.core.extension.User;
|
||||
import run.halo.app.core.extension.content.Comment;
|
||||
import run.halo.app.core.extension.content.Reply;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.metrics.CounterService;
|
||||
import run.halo.app.metrics.MeterUtils;
|
||||
|
|
|
@ -17,8 +17,8 @@ import reactor.core.publisher.Flux;
|
|||
import reactor.core.publisher.Mono;
|
||||
import reactor.util.retry.Retry;
|
||||
import run.halo.app.core.extension.content.Comment;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.Extension;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ListResult;
|
||||
|
|
|
@ -22,8 +22,8 @@ import reactor.core.publisher.Mono;
|
|||
import reactor.util.retry.Retry;
|
||||
import run.halo.app.core.extension.content.Comment;
|
||||
import run.halo.app.core.extension.content.Reply;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.PageRequest;
|
||||
|
|
|
@ -34,7 +34,7 @@ import run.halo.app.core.extension.content.Category;
|
|||
import run.halo.app.core.extension.content.Post;
|
||||
import run.halo.app.core.extension.content.Snapshot;
|
||||
import run.halo.app.core.extension.content.Tag;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.MetadataOperator;
|
||||
|
|
|
@ -28,7 +28,7 @@ import run.halo.app.content.Stats;
|
|||
import run.halo.app.core.extension.content.Post;
|
||||
import run.halo.app.core.extension.content.SinglePage;
|
||||
import run.halo.app.core.extension.content.Snapshot;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.extension.Ref;
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.nio.file.Path;
|
|||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.lang.NonNull;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.attachment.LocalThumbnail;
|
||||
import run.halo.app.core.attachment.extension.LocalThumbnail;
|
||||
import run.halo.app.infra.ExternalLinkProcessor;
|
||||
import run.halo.app.infra.exception.NotFoundException;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.attachment.endpoint;
|
||||
package run.halo.app.core.attachment.endpoint;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.attachment.endpoint;
|
||||
package run.halo.app.core.attachment.endpoint;
|
||||
|
||||
import static java.nio.file.StandardOpenOption.CREATE_NEW;
|
||||
import static run.halo.app.infra.utils.FileNameUtils.randomFileName;
|
||||
|
@ -41,6 +41,7 @@ import run.halo.app.core.extension.attachment.Attachment;
|
|||
import run.halo.app.core.extension.attachment.Attachment.AttachmentSpec;
|
||||
import run.halo.app.core.extension.attachment.Constant;
|
||||
import run.halo.app.core.extension.attachment.Policy;
|
||||
import run.halo.app.core.extension.attachment.endpoint.AttachmentHandler;
|
||||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.extension.Metadata;
|
||||
import run.halo.app.infra.ExternalUrlSupplier;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.attachment;
|
||||
package run.halo.app.core.attachment.extension;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.attachment;
|
||||
package run.halo.app.core.attachment.extension;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
|
|
@ -38,7 +38,7 @@ import run.halo.app.core.attachment.LocalThumbnailService;
|
|||
import run.halo.app.core.attachment.ThumbnailGenerator;
|
||||
import run.halo.app.core.attachment.ThumbnailSigner;
|
||||
import run.halo.app.core.attachment.ThumbnailSize;
|
||||
import run.halo.app.core.extension.attachment.LocalThumbnail;
|
||||
import run.halo.app.core.attachment.extension.LocalThumbnail;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.Metadata;
|
||||
|
|
|
@ -20,7 +20,7 @@ import run.halo.app.core.attachment.ThumbnailProvider.ThumbnailContext;
|
|||
import run.halo.app.core.attachment.ThumbnailService;
|
||||
import run.halo.app.core.attachment.ThumbnailSigner;
|
||||
import run.halo.app.core.attachment.ThumbnailSize;
|
||||
import run.halo.app.core.extension.attachment.Thumbnail;
|
||||
import run.halo.app.core.attachment.extension.Thumbnail;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.Metadata;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package run.halo.app.core.attachment.reconciler;
|
||||
|
||||
import static org.springframework.data.domain.Sort.Order.desc;
|
||||
import static run.halo.app.core.extension.attachment.LocalThumbnail.REQUEST_TO_GENERATE_ANNO;
|
||||
import static run.halo.app.core.attachment.extension.LocalThumbnail.REQUEST_TO_GENERATE_ANNO;
|
||||
import static run.halo.app.extension.MetadataUtil.nullSafeAnnotations;
|
||||
import static run.halo.app.extension.index.query.QueryFactory.and;
|
||||
import static run.halo.app.extension.index.query.QueryFactory.equal;
|
||||
|
@ -23,9 +23,9 @@ import run.halo.app.core.attachment.AttachmentRootGetter;
|
|||
import run.halo.app.core.attachment.AttachmentUtils;
|
||||
import run.halo.app.core.attachment.LocalThumbnailService;
|
||||
import run.halo.app.core.attachment.ThumbnailGenerator;
|
||||
import run.halo.app.core.attachment.extension.LocalThumbnail;
|
||||
import run.halo.app.core.extension.attachment.Attachment;
|
||||
import run.halo.app.core.extension.attachment.Constant;
|
||||
import run.halo.app.core.extension.attachment.LocalThumbnail;
|
||||
import run.halo.app.extension.ExtensionClient;
|
||||
import run.halo.app.extension.ExtensionUtil;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.springframework.web.reactive.socket.WebSocketHandler;
|
|||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.util.pattern.PathPattern;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.console.WebSocketUtils;
|
||||
import run.halo.app.infra.console.WebSocketUtils;
|
||||
|
||||
public class WebSocketHandlerMapping extends AbstractHandlerMapping
|
||||
implements WebSocketEndpointManager, InitializingBean {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
||||
|
@ -12,6 +12,7 @@ import org.springframework.web.reactive.function.server.ServerRequest;
|
|||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.AuthProvider;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.security.AuthProviderService;
|
||||
import run.halo.app.security.ListedAuthProvider;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.content.Builder.contentBuilder;
|
||||
|
@ -23,6 +23,7 @@ import run.halo.app.content.comment.ReplyRequest;
|
|||
import run.halo.app.content.comment.ReplyService;
|
||||
import run.halo.app.core.extension.content.Comment;
|
||||
import run.halo.app.core.extension.content.Reply;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.infra.utils.HaloUtils;
|
||||
import run.halo.app.infra.utils.IpAddressUtils;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
@ -9,6 +9,7 @@ import org.springframework.web.reactive.function.server.RequestPredicates;
|
|||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.GroupVersion;
|
||||
|
||||
public class CustomEndpointsBuilder {
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
|
@ -60,15 +60,16 @@ import reactor.core.scheduler.Schedulers;
|
|||
import reactor.util.retry.Retry;
|
||||
import run.halo.app.core.extension.Plugin;
|
||||
import run.halo.app.core.extension.Setting;
|
||||
import run.halo.app.core.extension.service.PluginService;
|
||||
import run.halo.app.core.extension.theme.SettingUtils;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.extension.router.IListRequest;
|
||||
import run.halo.app.extension.router.SortableRequest;
|
||||
import run.halo.app.infra.ReactiveUrlDataBufferFetcher;
|
||||
import run.halo.app.infra.utils.SettingUtils;
|
||||
import run.halo.app.plugin.PluginNotFoundException;
|
||||
import run.halo.app.plugin.PluginService;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.content.Builder.contentBuilder;
|
||||
|
@ -37,6 +37,7 @@ import run.halo.app.content.PostQuery;
|
|||
import run.halo.app.content.PostRequest;
|
||||
import run.halo.app.content.PostService;
|
||||
import run.halo.app.core.extension.content.Post;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.MetadataUtil;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
|
||||
|
@ -12,6 +12,7 @@ import run.halo.app.content.comment.ListedReply;
|
|||
import run.halo.app.content.comment.ReplyQuery;
|
||||
import run.halo.app.content.comment.ReplyService;
|
||||
import run.halo.app.core.extension.content.Reply;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ListResult;
|
||||
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.content.Builder.contentBuilder;
|
||||
|
@ -33,6 +33,7 @@ import run.halo.app.content.SinglePageRequest;
|
|||
import run.halo.app.content.SinglePageService;
|
||||
import run.halo.app.core.extension.content.Post;
|
||||
import run.halo.app.core.extension.content.SinglePage;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.MetadataUtil;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static run.halo.app.extension.index.query.QueryFactory.and;
|
||||
|
@ -15,6 +15,7 @@ import reactor.core.publisher.Mono;
|
|||
import run.halo.app.core.extension.Counter;
|
||||
import run.halo.app.core.extension.User;
|
||||
import run.halo.app.core.extension.content.Post;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.PageRequestImpl;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
|
@ -25,6 +25,7 @@ import org.springframework.web.server.ResponseStatusException;
|
|||
import org.springframework.web.server.ServerWebInputException;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.util.retry.Retry;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.infra.InitializationStateGetter;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
||||
|
@ -19,6 +19,7 @@ import org.springframework.web.reactive.function.server.ServerRequest;
|
|||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.content.Tag;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.PageRequestImpl;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.content.Builder.contentBuilder;
|
||||
|
@ -16,6 +16,7 @@ import org.springframework.web.reactive.function.server.RouterFunction;
|
|||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.event.post.DownvotedEvent;
|
||||
import run.halo.app.event.post.UpvotedEvent;
|
||||
import run.halo.app.event.post.VisitedEvent;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.endpoint;
|
||||
package run.halo.app.core.endpoint.console;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||
|
@ -70,10 +70,11 @@ import reactor.util.retry.Retry;
|
|||
import run.halo.app.core.extension.Role;
|
||||
import run.halo.app.core.extension.User;
|
||||
import run.halo.app.core.extension.attachment.Attachment;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.core.extension.service.AttachmentService;
|
||||
import run.halo.app.core.extension.service.EmailVerificationService;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.EmailVerificationService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.ListResult;
|
||||
import run.halo.app.extension.Metadata;
|
|
@ -1,8 +1,8 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
||||
import static run.halo.app.theme.endpoint.PublicApiUtils.toAnotherListResult;
|
||||
import static run.halo.app.core.endpoint.theme.PublicApiUtils.toAnotherListResult;
|
||||
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import lombok.RequiredArgsConstructor;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
import static org.apache.commons.lang3.BooleanUtils.isFalse;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import org.springdoc.core.fn.builders.operation.Builder;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
|
@ -30,9 +30,9 @@ import org.springframework.web.server.ServerWebInputException;
|
|||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.User;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.core.extension.service.EmailPasswordRecoveryService;
|
||||
import run.halo.app.core.extension.service.EmailVerificationService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.EmailPasswordRecoveryService;
|
||||
import run.halo.app.core.user.service.EmailVerificationService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.GroupVersion;
|
||||
import run.halo.app.infra.SystemConfigurableEnvironmentFetcher;
|
||||
import run.halo.app.infra.SystemSetting;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.theme.endpoint;
|
||||
package run.halo.app.core.endpoint.theme;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.endpoint.uc.content;
|
||||
package run.halo.app.core.endpoint.uc;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.endpoint.uc.content;
|
||||
package run.halo.app.core.endpoint.uc;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.endpoint.uc.content;
|
||||
package run.halo.app.core.endpoint.uc;
|
||||
|
||||
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static run.halo.app.extension.ExtensionUtil.addFinalizers;
|
||||
import static run.halo.app.extension.ExtensionUtil.removeFinalizers;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||
import static run.halo.app.extension.ExtensionUtil.addFinalizers;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Objects;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static run.halo.app.core.extension.Plugin.PluginStatus.nullSafeConditions;
|
||||
import static run.halo.app.extension.ExtensionUtil.addFinalizers;
|
||||
|
@ -44,7 +44,6 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
import run.halo.app.core.extension.Plugin;
|
||||
import run.halo.app.core.extension.ReverseProxy;
|
||||
import run.halo.app.core.extension.Setting;
|
||||
import run.halo.app.core.extension.theme.SettingUtils;
|
||||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.extension.ExtensionClient;
|
||||
import run.halo.app.extension.ExtensionUtil;
|
||||
|
@ -59,6 +58,7 @@ import run.halo.app.infra.Condition;
|
|||
import run.halo.app.infra.ConditionList;
|
||||
import run.halo.app.infra.ConditionStatus;
|
||||
import run.halo.app.infra.utils.PathUtils;
|
||||
import run.halo.app.infra.utils.SettingUtils;
|
||||
import run.halo.app.infra.utils.YamlUnstructuredLoader;
|
||||
import run.halo.app.plugin.PluginConst;
|
||||
import run.halo.app.plugin.PluginProperties;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static run.halo.app.extension.index.query.QueryFactory.startsWith;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.apache.commons.lang3.BooleanUtils.TRUE;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||
import static run.halo.app.extension.ExtensionUtil.addFinalizers;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static java.util.Objects.deepEquals;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.springframework.web.util.UriUtils.encodePath;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static run.halo.app.extension.ExtensionUtil.addFinalizers;
|
||||
import static run.halo.app.extension.ExtensionUtil.removeFinalizers;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||
|
||||
|
@ -17,7 +17,6 @@ import org.springframework.util.FileSystemUtils;
|
|||
import run.halo.app.core.extension.AnnotationSetting;
|
||||
import run.halo.app.core.extension.Setting;
|
||||
import run.halo.app.core.extension.Theme;
|
||||
import run.halo.app.core.extension.theme.SettingUtils;
|
||||
import run.halo.app.extension.ExtensionClient;
|
||||
import run.halo.app.extension.MetadataUtil;
|
||||
import run.halo.app.extension.controller.Controller;
|
||||
|
@ -30,6 +29,7 @@ import run.halo.app.infra.SystemVersionSupplier;
|
|||
import run.halo.app.infra.ThemeRootGetter;
|
||||
import run.halo.app.infra.exception.ThemeUninstallException;
|
||||
import run.halo.app.infra.utils.JsonUtils;
|
||||
import run.halo.app.infra.utils.SettingUtils;
|
||||
import run.halo.app.infra.utils.VersionUtils;
|
||||
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.reconciler;
|
||||
package run.halo.app.core.reconciler;
|
||||
|
||||
import static run.halo.app.extension.ExtensionUtil.addFinalizers;
|
||||
import static run.halo.app.extension.ExtensionUtil.defaultSort;
|
||||
|
@ -23,8 +23,8 @@ import run.halo.app.core.extension.User;
|
|||
import run.halo.app.core.extension.UserConnection;
|
||||
import run.halo.app.core.extension.attachment.Attachment;
|
||||
import run.halo.app.core.extension.service.AttachmentService;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.ExtensionClient;
|
||||
import run.halo.app.extension.ListOptions;
|
||||
import run.halo.app.extension.controller.Controller;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service;
|
||||
package run.halo.app.core.user.service;
|
||||
|
||||
import static run.halo.app.extension.ExtensionUtil.defaultSort;
|
||||
import static run.halo.app.extension.ExtensionUtil.notDeleting;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service;
|
||||
package run.halo.app.core.user.service;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.infra.exception.AccessDeniedException;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service;
|
||||
package run.halo.app.core.user.service;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.infra.exception.EmailVerificationFailed;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service;
|
||||
package run.halo.app.core.user.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service;
|
||||
package run.halo.app.core.user.service;
|
||||
|
||||
import java.util.Set;
|
||||
import reactor.core.publisher.Flux;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service;
|
||||
package run.halo.app.core.user.service;
|
||||
|
||||
import static org.springframework.data.domain.Sort.Order.asc;
|
||||
import static org.springframework.data.domain.Sort.Order.desc;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service.impl;
|
||||
package run.halo.app.core.user.service.impl;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service.impl;
|
||||
package run.halo.app.core.user.service.impl;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
@ -18,8 +18,8 @@ import reactor.util.retry.Retry;
|
|||
import run.halo.app.core.extension.User;
|
||||
import run.halo.app.core.extension.notification.Reason;
|
||||
import run.halo.app.core.extension.notification.Subscription;
|
||||
import run.halo.app.core.extension.service.EmailPasswordRecoveryService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.EmailPasswordRecoveryService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.GroupVersion;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.infra.ExternalLinkProcessor;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service.impl;
|
||||
package run.halo.app.core.user.service.impl;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
@ -19,8 +19,8 @@ import reactor.util.retry.Retry;
|
|||
import run.halo.app.core.extension.User;
|
||||
import run.halo.app.core.extension.notification.Reason;
|
||||
import run.halo.app.core.extension.notification.Subscription;
|
||||
import run.halo.app.core.extension.service.EmailVerificationService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.EmailVerificationService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.GroupVersion;
|
||||
import run.halo.app.extension.MetadataUtil;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
|
@ -26,9 +26,9 @@ public class DefaultSystemVersionSupplier implements SystemVersionSupplier {
|
|||
public Version get() {
|
||||
var properties = buildProperties.getIfUnique();
|
||||
if (properties == null) {
|
||||
return Version.valueOf(DEFAULT_VERSION);
|
||||
return Version.parse(DEFAULT_VERSION);
|
||||
}
|
||||
var projectVersion = Objects.toString(properties.getVersion(), DEFAULT_VERSION);
|
||||
return Version.valueOf(projectVersion);
|
||||
return Version.parse(projectVersion);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StreamUtils;
|
||||
import run.halo.app.core.extension.theme.ThemeService;
|
||||
import run.halo.app.infra.properties.HaloProperties;
|
||||
import run.halo.app.infra.properties.ThemeProperties;
|
||||
import run.halo.app.infra.utils.FileUtils;
|
||||
import run.halo.app.theme.service.ThemeService;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
|
|
@ -20,6 +20,8 @@ import org.springframework.context.ApplicationListener;
|
|||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
import run.halo.app.content.Stats;
|
||||
import run.halo.app.core.attachment.extension.LocalThumbnail;
|
||||
import run.halo.app.core.attachment.extension.Thumbnail;
|
||||
import run.halo.app.core.extension.AnnotationSetting;
|
||||
import run.halo.app.core.extension.AuthProvider;
|
||||
import run.halo.app.core.extension.Counter;
|
||||
|
@ -38,10 +40,8 @@ import run.halo.app.core.extension.UserConnection;
|
|||
import run.halo.app.core.extension.UserConnection.UserConnectionSpec;
|
||||
import run.halo.app.core.extension.attachment.Attachment;
|
||||
import run.halo.app.core.extension.attachment.Group;
|
||||
import run.halo.app.core.extension.attachment.LocalThumbnail;
|
||||
import run.halo.app.core.extension.attachment.Policy;
|
||||
import run.halo.app.core.extension.attachment.PolicyTemplate;
|
||||
import run.halo.app.core.extension.attachment.Thumbnail;
|
||||
import run.halo.app.core.extension.content.Category;
|
||||
import run.halo.app.core.extension.content.Comment;
|
||||
import run.halo.app.core.extension.content.Post;
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package run.halo.app.infra;
|
||||
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.web.reactive.HandlerResult;
|
||||
import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Secure request mapping handler adapter.
|
||||
*
|
||||
* @author johnniang
|
||||
* @since 2.20.0
|
||||
*/
|
||||
public class SecureRequestMappingHandlerAdapter extends RequestMappingHandlerAdapter {
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Mono<HandlerResult> handle(
|
||||
@NonNull ServerWebExchange exchange,
|
||||
@NonNull Object handler
|
||||
) {
|
||||
return super.handle(new SecureServerWebExchange(exchange), handler);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package run.halo.app.infra;
|
||||
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.support.ServerRequestWrapper;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
/**
|
||||
* Secure server request without application context available.
|
||||
*
|
||||
* @author johnniang
|
||||
* @since 2.20.0
|
||||
*/
|
||||
public class SecureServerRequest extends ServerRequestWrapper {
|
||||
|
||||
/**
|
||||
* Create a new {@code ServerRequestWrapper} that wraps the given request.
|
||||
*
|
||||
* @param delegate the request to wrap
|
||||
*/
|
||||
public SecureServerRequest(ServerRequest delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public ServerWebExchange exchange() {
|
||||
return new SecureServerWebExchange(super.exchange());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package run.halo.app.infra;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.ServerWebExchangeDecorator;
|
||||
|
||||
/**
|
||||
* Secure server web exchange without application context available.
|
||||
*
|
||||
* @author johnniang
|
||||
* @since 2.20.0
|
||||
*/
|
||||
public class SecureServerWebExchange extends ServerWebExchangeDecorator {
|
||||
|
||||
public SecureServerWebExchange(ServerWebExchange delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationContext getApplicationContext() {
|
||||
// Always return null to prevent access to application context
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.actuator;
|
||||
package run.halo.app.infra.actuator;
|
||||
|
||||
import io.r2dbc.spi.Connection;
|
||||
import io.r2dbc.spi.ConnectionFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.actuator;
|
||||
package run.halo.app.infra.actuator;
|
||||
|
||||
import static org.apache.commons.lang3.BooleanUtils.isTrue;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.actuator;
|
||||
package run.halo.app.infra.actuator;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.config;
|
||||
package run.halo.app.infra.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.config;
|
||||
package run.halo.app.infra.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.config;
|
||||
package run.halo.app.infra.config;
|
||||
|
||||
import static org.springdoc.core.utils.Constants.SPRINGDOC_ENABLED;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.config;
|
||||
package run.halo.app.infra.config;
|
||||
|
||||
import static org.springframework.util.ResourceUtils.FILE_URL_PREFIX;
|
||||
import static org.springframework.web.reactive.function.server.RequestPredicates.accept;
|
||||
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.web.WebProperties;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxRegistrations;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -33,18 +34,20 @@ import org.springframework.web.reactive.function.server.RouterFunction;
|
|||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import org.springframework.web.reactive.resource.EncodedResourceResolver;
|
||||
import org.springframework.web.reactive.resource.PathResourceResolver;
|
||||
import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter;
|
||||
import org.springframework.web.reactive.result.view.ViewResolutionResultHandler;
|
||||
import org.springframework.web.reactive.result.view.ViewResolver;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.console.ProxyFilter;
|
||||
import run.halo.app.console.WebSocketRequestPredicate;
|
||||
import run.halo.app.core.endpoint.WebSocketHandlerMapping;
|
||||
import run.halo.app.core.endpoint.console.CustomEndpointsBuilder;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpointsBuilder;
|
||||
import run.halo.app.infra.SecureRequestMappingHandlerAdapter;
|
||||
import run.halo.app.infra.console.ProxyFilter;
|
||||
import run.halo.app.infra.console.WebSocketRequestPredicate;
|
||||
import run.halo.app.infra.properties.AttachmentProperties;
|
||||
import run.halo.app.infra.properties.HaloProperties;
|
||||
import run.halo.app.infra.webfilter.AdditionalWebFilterChainProxy;
|
||||
import run.halo.app.plugin.extensionpoint.ExtensionGetter;
|
||||
import run.halo.app.webfilter.AdditionalWebFilterChainProxy;
|
||||
|
||||
@Configuration
|
||||
public class WebFluxConfig implements WebFluxConfigurer {
|
||||
|
@ -67,6 +70,19 @@ public class WebFluxConfig implements WebFluxConfigurer {
|
|||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Bean
|
||||
WebFluxRegistrations webFluxRegistrations() {
|
||||
return new WebFluxRegistrations() {
|
||||
@Override
|
||||
public RequestMappingHandlerAdapter getRequestMappingHandlerAdapter() {
|
||||
// Because we have no chance to customize ServerWebExchangeMethodArgumentResolver,
|
||||
// we have to use SecureRequestMappingHandlerAdapter to replace a secure
|
||||
// ServerWebExchange.
|
||||
return new SecureRequestMappingHandlerAdapter();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
ServerResponse.Context context(CodecConfigurer codec,
|
||||
ViewResolutionResultHandler resultHandler) {
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.config;
|
||||
package run.halo.app.infra.config;
|
||||
|
||||
import static org.springframework.security.config.Customizer.withDefaults;
|
||||
import static org.springframework.security.web.server.authentication.ServerWebExchangeDelegatingReactiveAuthenticationManagerResolver.builder;
|
||||
|
@ -22,8 +22,8 @@ import org.springframework.session.MapSession;
|
|||
import org.springframework.session.config.annotation.web.server.EnableSpringWebSession;
|
||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.infra.AnonymousUserConst;
|
||||
import run.halo.app.infra.properties.HaloProperties;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.console;
|
||||
package run.halo.app.infra.console;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
|
@ -1,6 +1,6 @@
|
|||
package run.halo.app.console;
|
||||
package run.halo.app.infra.console;
|
||||
|
||||
import static run.halo.app.console.WebSocketUtils.isWebSocketUpgrade;
|
||||
import static run.halo.app.infra.console.WebSocketUtils.isWebSocketUpgrade;
|
||||
|
||||
import org.springframework.web.reactive.function.server.RequestPredicate;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
|
@ -1,8 +1,8 @@
|
|||
package run.halo.app.console;
|
||||
package run.halo.app.infra.console;
|
||||
|
||||
import static org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher.MatchResult.match;
|
||||
import static org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher.MatchResult.notMatch;
|
||||
import static run.halo.app.console.WebSocketUtils.isWebSocketUpgrade;
|
||||
import static run.halo.app.infra.console.WebSocketUtils.isWebSocketUpgrade;
|
||||
|
||||
import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.console;
|
||||
package run.halo.app.infra.console;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.springframework.http.HttpHeaders;
|
|
@ -0,0 +1,62 @@
|
|||
package run.halo.app.infra.utils;
|
||||
|
||||
import java.time.Duration;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.lang.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Utility class for reactive.
|
||||
*
|
||||
* @author johnniang
|
||||
* @since 2.20.0
|
||||
*/
|
||||
public enum ReactiveUtils {
|
||||
;
|
||||
|
||||
private static final Duration DEFAULT_TIMEOUT = Duration.ofMinutes(1);
|
||||
|
||||
/**
|
||||
* Resolve reactive value by blocking operation.
|
||||
*
|
||||
* @param value the normal value or reactive value
|
||||
* @return the resolved value
|
||||
*/
|
||||
@Nullable
|
||||
public static Object blockReactiveValue(@Nullable Object value) {
|
||||
return blockReactiveValue(value, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve reactive value by blocking operation.
|
||||
*
|
||||
* @param value the normal value or reactive value
|
||||
* @param timeout the timeout of blocking operation
|
||||
* @return the resolved value
|
||||
*/
|
||||
@Nullable
|
||||
public static Object blockReactiveValue(@Nullable Object value, @NonNull Duration timeout) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
Class<?> clazz = value.getClass();
|
||||
if (Mono.class.isAssignableFrom(clazz)) {
|
||||
return ((Mono<?>) value).blockOptional(timeout).orElse(null);
|
||||
}
|
||||
if (Flux.class.isAssignableFrom(clazz)) {
|
||||
return ((Flux<?>) value).collectList().block(timeout);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the class is a reactive type.
|
||||
*
|
||||
* @param clazz the class to check
|
||||
* @return true if the class is a reactive type, false otherwise
|
||||
*/
|
||||
public static boolean isReactiveType(@NonNull Class<?> clazz) {
|
||||
return Mono.class.isAssignableFrom(clazz) || Flux.class.isAssignableFrom(clazz);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.theme;
|
||||
package run.halo.app.infra.utils;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||
|
||||
|
@ -21,8 +21,6 @@ import run.halo.app.core.extension.Setting;
|
|||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.extension.ExtensionClient;
|
||||
import run.halo.app.extension.Metadata;
|
||||
import run.halo.app.infra.utils.JsonParseException;
|
||||
import run.halo.app.infra.utils.JsonUtils;
|
||||
|
||||
@UtilityClass
|
||||
public class SettingUtils {
|
|
@ -41,7 +41,7 @@ public class VersionUtils {
|
|||
try {
|
||||
return StringUtils.isBlank(constraint)
|
||||
|| "*".equals(constraint)
|
||||
|| Version.valueOf(version).satisfies(constraint);
|
||||
|| Version.parse(version).satisfies(constraint);
|
||||
} catch (Exception e) {
|
||||
throw new ServerWebInputException("Illegal requires version expression.", null, e);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.webfilter;
|
||||
package run.halo.app.infra.webfilter;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.webfilter;
|
||||
package run.halo.app.infra.webfilter;
|
||||
|
||||
import static run.halo.app.theme.ThemeLocaleContextResolver.LANGUAGE_COOKIE_NAME;
|
||||
import static run.halo.app.theme.ThemeLocaleContextResolver.LANGUAGE_PARAMETER_NAME;
|
|
@ -7,8 +7,9 @@ import org.springframework.web.reactive.function.server.RouterFunctions;
|
|||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.endpoint.console.CustomEndpointsBuilder;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpointsBuilder;
|
||||
import run.halo.app.infra.SecureServerRequest;
|
||||
|
||||
/**
|
||||
* Aggregated router function built from all custom endpoints.
|
||||
|
@ -28,7 +29,7 @@ public class AggregatedRouterFunction implements RouterFunction<ServerResponse>
|
|||
|
||||
@Override
|
||||
public Mono<HandlerFunction<ServerResponse>> route(ServerRequest request) {
|
||||
return aggregated.route(request);
|
||||
return aggregated.route(new SecureServerRequest(request));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.springframework.web.reactive.function.server.ServerRequest;
|
|||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.infra.SecureServerRequest;
|
||||
|
||||
/**
|
||||
* A composite {@link RouterFunction} implementation for plugin.
|
||||
|
@ -31,8 +32,9 @@ public class DefaultPluginRouterFunctionRegistry
|
|||
@Override
|
||||
@NonNull
|
||||
public Mono<HandlerFunction<ServerResponse>> route(@NonNull ServerRequest request) {
|
||||
var secureRequest = new SecureServerRequest(request);
|
||||
return Flux.fromIterable(this.routerFunctions)
|
||||
.concatMap(routerFunction -> routerFunction.route(request))
|
||||
.concatMap(routerFunction -> routerFunction.route(secureRequest))
|
||||
.next();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service;
|
||||
package run.halo.app.plugin;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import org.springframework.core.io.Resource;
|
|
@ -1,4 +1,4 @@
|
|||
package run.halo.app.core.extension.service.impl;
|
||||
package run.halo.app.plugin;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static java.nio.file.StandardOpenOption.CREATE;
|
||||
|
@ -49,7 +49,6 @@ import reactor.core.scheduler.Scheduler;
|
|||
import reactor.core.scheduler.Schedulers;
|
||||
import reactor.util.retry.Retry;
|
||||
import run.halo.app.core.extension.Plugin;
|
||||
import run.halo.app.core.extension.service.PluginService;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.infra.SystemVersionSupplier;
|
||||
import run.halo.app.infra.exception.PluginAlreadyExistsException;
|
||||
|
@ -60,12 +59,6 @@ import run.halo.app.infra.exception.PluginInstallationException;
|
|||
import run.halo.app.infra.exception.UnsatisfiedAttributeValueException;
|
||||
import run.halo.app.infra.utils.FileUtils;
|
||||
import run.halo.app.infra.utils.VersionUtils;
|
||||
import run.halo.app.plugin.PluginConst;
|
||||
import run.halo.app.plugin.PluginUtils;
|
||||
import run.halo.app.plugin.PluginsRootGetter;
|
||||
import run.halo.app.plugin.SpringPluginManager;
|
||||
import run.halo.app.plugin.YamlPluginDescriptorFinder;
|
||||
import run.halo.app.plugin.YamlPluginFinder;
|
||||
import run.halo.app.plugin.resources.BundleResourceUtils;
|
||||
|
||||
@Slf4j
|
||||
|
@ -476,7 +469,7 @@ public class PluginServiceImpl implements PluginService, InitializingBean, Dispo
|
|||
Version version = systemVersion.get();
|
||||
// validate the plugin version
|
||||
// only use the nominal system version to compare, the format is like MAJOR.MINOR.PATCH
|
||||
String systemVersion = version.getNormalVersion();
|
||||
String systemVersion = version.toStableVersion().toString();
|
||||
String requires = newPlugin.getSpec().getRequires();
|
||||
if (!VersionUtils.satisfiesRequires(systemVersion, requires)) {
|
||||
throw new UnsatisfiedAttributeValueException(String.format(
|
|
@ -13,8 +13,8 @@ import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
|
|||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.infra.exception.UserNotFoundException;
|
||||
import run.halo.app.security.authentication.login.HaloUser;
|
||||
import run.halo.app.security.authentication.twofactor.TwoFactorUtils;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.web.reactive.function.server.ServerRequest;
|
|||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import org.springframework.web.server.ServerWebInputException;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
import run.halo.app.extension.ExtensionUtil;
|
||||
import run.halo.app.extension.Metadata;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.User;
|
||||
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||
import run.halo.app.core.extension.service.UserService;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.extension.GroupVersion;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
import run.halo.app.infra.ExternalUrlSupplier;
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
|
||||
/**
|
||||
* @author guqing
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.security.authorization.ReactiveAuthorizationManager;
|
|||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.server.authorization.AuthorizationContext;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.extension.service.RoleService;
|
||||
import run.halo.app.core.user.service.RoleService;
|
||||
|
||||
@Slf4j
|
||||
public class RequestInfoAuthorizationManager
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.Set;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.server.PathContainer;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import run.halo.app.console.WebSocketUtils;
|
||||
import run.halo.app.infra.console.WebSocketUtils;
|
||||
|
||||
/**
|
||||
* Creates {@link RequestInfo} from {@link ServerHttpRequest}.
|
||||
|
|
|
@ -6,11 +6,16 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import org.attoparser.ParseException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties;
|
||||
import org.springframework.boot.context.properties.PropertyMapper;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
import org.springframework.web.ErrorResponse;
|
||||
import org.springframework.web.reactive.result.view.View;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
@ -24,13 +29,16 @@ import run.halo.app.theme.finders.FinderRegistry;
|
|||
import run.halo.app.theme.router.ModelConst;
|
||||
|
||||
@Component("thymeleafReactiveViewResolver")
|
||||
public class HaloViewResolver extends ThymeleafReactiveViewResolver {
|
||||
public class HaloViewResolver extends ThymeleafReactiveViewResolver implements InitializingBean {
|
||||
|
||||
private final FinderRegistry finderRegistry;
|
||||
|
||||
public HaloViewResolver(FinderRegistry finderRegistry) {
|
||||
setViewClass(HaloView.class);
|
||||
private final ThymeleafProperties thymeleafProperties;
|
||||
|
||||
public HaloViewResolver(FinderRegistry finderRegistry,
|
||||
ThymeleafProperties thymeleafProperties) {
|
||||
this.finderRegistry = finderRegistry;
|
||||
this.thymeleafProperties = thymeleafProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,6 +52,37 @@ public class HaloViewResolver extends ThymeleafReactiveViewResolver {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
setViewClass(HaloView.class);
|
||||
var map = PropertyMapper.get();
|
||||
map.from(thymeleafProperties::getEncoding)
|
||||
.whenNonNull()
|
||||
.to(this::setDefaultCharset);
|
||||
map.from(thymeleafProperties::getExcludedViewNames)
|
||||
.whenNonNull()
|
||||
.to(this::setExcludedViewNames);
|
||||
map.from(thymeleafProperties::getViewNames)
|
||||
.whenNonNull()
|
||||
.to(this::setViewNames);
|
||||
|
||||
var reactive = thymeleafProperties.getReactive();
|
||||
map.from(reactive::getMediaTypes)
|
||||
.whenNonNull()
|
||||
.to(this::setSupportedMediaTypes);
|
||||
map.from(reactive::getFullModeViewNames)
|
||||
.whenNonNull()
|
||||
.to(this::setFullModeViewNames);
|
||||
map.from(reactive::getChunkedModeViewNames)
|
||||
.whenNonNull()
|
||||
.to(this::setChunkedModeViewNames);
|
||||
map.from(reactive::getMaxChunkSize)
|
||||
.asInt(DataSize::toBytes)
|
||||
.when(size -> size > 0)
|
||||
.to(this::setResponseMaxChunkSizeBytes);
|
||||
setOrder(Ordered.LOWEST_PRECEDENCE - 5);
|
||||
}
|
||||
|
||||
public static class HaloView extends ThymeleafReactiveView {
|
||||
|
||||
@Autowired
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue