first commit
This commit is contained in:
parent
ef6d4ed5af
commit
60c700451c
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.1.3</version>
|
<version>3.2.0</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.lion</groupId>
|
<groupId>com.lion</groupId>
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import com.lion.sns.util.Response;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.servlet.http.HttpSession;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.lion.sns.controller;
|
|||||||
|
|
||||||
import com.lion.sns.pojo.Site;
|
import com.lion.sns.pojo.Site;
|
||||||
import com.lion.sns.service.SiteService;
|
import com.lion.sns.service.SiteService;
|
||||||
import com.lion.sns.util.Response;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Update;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CustomConfigurationMapper {
|
public interface CustomConfigurationMapper {
|
||||||
static final String PATH = "path";
|
String PATH = "path";
|
||||||
|
|
||||||
|
|
||||||
@Select("select value from custom_configuration where key=#{key}")
|
@Select("select value from custom_configuration where key=#{key}")
|
||||||
|
|||||||
@ -12,8 +12,6 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Component
|
@Component
|
||||||
@ -25,7 +23,7 @@ public class Interceptor implements HandlerInterceptor {
|
|||||||
sessionId2user = new HashMap<>();
|
sessionId2user = new HashMap<>();
|
||||||
String path = customConfigurationMapper.selectValue(CustomConfigurationMapper.PATH);
|
String path = customConfigurationMapper.selectValue(CustomConfigurationMapper.PATH);
|
||||||
if(path == null || path.isEmpty())
|
if(path == null || path.isEmpty())
|
||||||
new Thread(() -> {CustomUtil.initSns(customConfigurationMapper, siteMapper, userMapper);}).start();
|
new Thread(() -> CustomUtil.initSns(customConfigurationMapper, siteMapper, userMapper)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
//需要鉴别管理员接口
|
//需要鉴别管理员接口
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import lombok.Data;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FileNode {
|
public class FileNode {
|
||||||
|
|||||||
@ -354,9 +354,7 @@ public class CommunicateService {
|
|||||||
}
|
}
|
||||||
case AbstractMessage.MOVE_FILE_REQUEST_MESSAGE -> {
|
case AbstractMessage.MOVE_FILE_REQUEST_MESSAGE -> {
|
||||||
MoveFileRequestMessage moveFileRequestMessage = (MoveFileRequestMessage) abstractMessage;
|
MoveFileRequestMessage moveFileRequestMessage = (MoveFileRequestMessage) abstractMessage;
|
||||||
threadPool.submit(() -> {
|
threadPool.submit(() -> receiveFile(ctx.channel(), moveFileRequestMessage));
|
||||||
receiveFile(ctx.channel(), moveFileRequestMessage);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
case AbstractMessage.MOVE_FILE_RESPONSE_MESSAGE -> {
|
case AbstractMessage.MOVE_FILE_RESPONSE_MESSAGE -> {
|
||||||
MoveFileResponseMessage moveFileResponseMessage = (MoveFileResponseMessage) abstractMessage;
|
MoveFileResponseMessage moveFileResponseMessage = (MoveFileResponseMessage) abstractMessage;
|
||||||
@ -382,9 +380,7 @@ public class CommunicateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case AbstractMessage.PAIR_MESSAGE -> {
|
case AbstractMessage.PAIR_MESSAGE -> proceedPair((PairMessage) abstractMessage, ctx.channel());
|
||||||
proceedPair((PairMessage) abstractMessage, ctx.channel());
|
|
||||||
}
|
|
||||||
case AbstractMessage.CONNECT_MESSAGE -> {
|
case AbstractMessage.CONNECT_MESSAGE -> {
|
||||||
String ip = ctx.channel().remoteAddress().toString().replace("/", "").split(":")[0];
|
String ip = ctx.channel().remoteAddress().toString().replace("/", "").split(":")[0];
|
||||||
Site site = siteMapper.selectSiteByIp(ip);
|
Site site = siteMapper.selectSiteByIp(ip);
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package com.lion.sns.service;
|
package com.lion.sns.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.lion.sns.dao.CustomConfigurationMapper;
|
import com.lion.sns.dao.CustomConfigurationMapper;
|
||||||
import com.lion.sns.dao.ShareFileMapper;
|
import com.lion.sns.dao.ShareFileMapper;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.lion.sns.service;
|
package com.lion.sns.service;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
|
||||||
import cn.hutool.core.io.file.PathUtil;
|
import cn.hutool.core.io.file.PathUtil;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.lion.sns.ScalableNetworkStorageApplication;
|
import com.lion.sns.ScalableNetworkStorageApplication;
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -18,13 +17,8 @@ public class TaskService {
|
|||||||
|
|
||||||
ScheduledExecutorService thread;
|
ScheduledExecutorService thread;
|
||||||
|
|
||||||
@Resource
|
|
||||||
WebSocketService webSocketService;
|
|
||||||
|
|
||||||
ReentrantLock lock;
|
ReentrantLock lock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HashMap<Integer, Integer> taskId2Site;
|
HashMap<Integer, Integer> taskId2Site;
|
||||||
|
|
||||||
public TaskService(){
|
public TaskService(){
|
||||||
|
|||||||
@ -123,7 +123,7 @@ public class WebSocketService implements WebSocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
|
public void handleTransportError(WebSocketSession session, Throwable exception){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import com.lion.sns.dao.UserMapper;
|
|||||||
import com.lion.sns.message.PairMessage;
|
import com.lion.sns.message.PairMessage;
|
||||||
import com.lion.sns.pojo.Site;
|
import com.lion.sns.pojo.Site;
|
||||||
import com.lion.sns.pojo.User;
|
import com.lion.sns.pojo.User;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.util.DigestUtils;
|
import org.springframework.util.DigestUtils;
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,10 @@ package com.lion.sns.util;
|
|||||||
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class Response {
|
public class Response {
|
||||||
// HashMap<String, String> result;
|
|
||||||
ObjectNode result;
|
ObjectNode result;
|
||||||
|
|
||||||
public Response(){
|
public Response(){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user