Skip to content

Commit 226fc1f

Browse files
committed
增加加速器
1 parent 4b6cf20 commit 226fc1f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

conf/nbs.db

0 Bytes
Binary file not shown.

src/main/java/io/nbs/client/listener/IPFSFileUploader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class IPFSFileUploader {
3939
private static Logger logger = LoggerFactory.getLogger(IPFSFileUploader.class);
4040
private static IPFS ipfs;
4141
private AttachmentInfoService service;
42-
public static long MAX_SIZE = 3000*1024*1024;
42+
public static long MAX_SIZE = 2000*1024*1024;
4343
private PeerInfo cureent;
4444
private MessagePanel messagePanel;
4545
private List<MessageItem> messageItems;
@@ -66,7 +66,7 @@ public MerkleNode addFileToIPFS(File file) throws FileTooLargeException {
6666
String name = file.getName();
6767
long size = file.length();
6868
if(size>MAX_SIZE){
69-
throw new FileTooLargeException("上传文件【"+name+"】超过"+DataSizeFormatUtil.formatDataSize((long)MAX_SIZE)+"限制.");
69+
throw new FileTooLargeException("上传文件【"+name+"】超过"+DataSizeFormatUtil.formatDataSize(MAX_SIZE)+"限制.");
7070
}
7171
try {
7272
NamedStreamable.FileWrapper fileWrapper = new NamedStreamable.FileWrapper(file);

src/main/java/io/nbs/client/ui/panels/im/IMFileActionListener.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@ public void actionPerformed(ActionEvent e) {
4747
File selection = jFileChooser.getSelectedFile();
4848
if(selection==null)return;
4949
logger.info(selection.getAbsolutePath());
50-
50+
if(selection.length()>200*1024*1024){
51+
JOptionPane.showMessageDialog(MainFrame.getContext(),"成功加入分享任务,由于文件较大需要稍等一会儿返回唯一串码.");
52+
}
5153
new Thread(()->{
5254
try {
5355
MerkleNode node = fileUploader.addFileToIPFS(selection);
56+
logger.info("添加文件成功.{}",selection.getName());
5457
new Thread(()->{
5558
saveUploadFileInfo2DB(node);
5659
}).start();
5760
} catch (FileTooLargeException e1) {
5861
logger.error("删除文件失败,{}-{}",e1.getMessage(),e1.getCause());
59-
JOptionPane.showMessageDialog(MainFrame.getContext(),"文件太大,最大只能上传["+DataSizeFormatUtil.formatDataSize((long)IPFSFileUploader.MAX_SIZE)+"]文件。");
62+
JOptionPane.showMessageDialog(MainFrame.getContext(),"文件太大,最大只能上传["+DataSizeFormatUtil.formatDataSize(IPFSFileUploader.MAX_SIZE)+"]文件。");
6063

6164
}
6265
}).start();

0 commit comments

Comments
 (0)