移除Minio的pre-sign-url的限流

This commit is contained in:
xxx 2023-08-27 13:41:21 +08:00
parent 1d31045807
commit 95e2652615
2 changed files with 13 additions and 1 deletions

View File

@ -30,6 +30,13 @@ public class BackendConstant {
}
};
public static final List<String> API_LIMIT_WHITELIST =
new ArrayList<>() {
{
add("/backend/v1/upload/minio/pre-sign-url");
}
};
public static final String RESOURCE_TYPE_VIDEO = "VIDEO";
public static final String RESOURCE_TYPE_IMAGE = "IMAGE";
public static final String RESOURCE_TYPE_PDF = "PDF";

View File

@ -26,6 +26,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
import xyz.playedu.common.bus.BackendBus;
import xyz.playedu.common.config.PlayEduConfig;
import xyz.playedu.common.constant.BackendConstant;
import xyz.playedu.common.context.BCtx;
import xyz.playedu.common.domain.AdminUser;
import xyz.playedu.common.service.AdminUserService;
@ -59,7 +60,11 @@ public class AdminInterceptor implements HandlerInterceptor {
public boolean preHandle(
HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
if ("OPTIONS".equals(request.getMethod())) {
// 当前api的请求路径
String path = request.getRequestURI();
// 白名单过滤
if (BackendConstant.API_LIMIT_WHITELIST.contains(path)
|| "OPTIONS".equals(request.getMethod())) {
return HandlerInterceptor.super.preHandle(request, response, handler);
}