update modules/core: mod 2 files

This commit is contained in:
jack ning
2025-07-24 11:36:03 +08:00
parent b09738dc5e
commit b82da2dfb4
2 changed files with 6 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-12-24 17:44:12
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-05-21 15:14:32
* @LastEditTime: 2025-07-24 11:35:31
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -25,7 +25,7 @@ import com.bytedesk.core.ip.IpUtils;
public class IpAccessInterceptor implements HandlerInterceptor {
@Autowired
private IpAccessRestService ipAccessService;
private IpAccessRestService ipAccessRestService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
@@ -33,14 +33,14 @@ public class IpAccessInterceptor implements HandlerInterceptor {
String endpoint = request.getRequestURI();
// 检查是否被封禁
if (ipAccessService.isIpBlocked(ip)) {
if (ipAccessRestService.isIpBlocked(ip)) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
response.getWriter().write("IP has been blocked due to excessive requests");
return false;
}
// 记录访问
ipAccessService.recordAccess(ip, endpoint, request.getQueryString());
ipAccessRestService.recordAccess(ip, endpoint, request.getQueryString());
return true;
}

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-12-24 17:44:03
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-07-04 12:58:09
* @LastEditTime: 2025-07-24 11:36:00
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -221,7 +221,7 @@ public class IpAccessRestService extends BaseRestService<IpAccessEntity, IpAcces
Assert.notNull(ip, "IP address must not be null");
Assert.notNull(endpoint, "Endpoint must not be null");
//
if (endpoint.equals("/visitor/api/v1/ping")) {
if (endpoint.contains("/visitor/api/v1/ping")) {
return;
}
//