- 后端Room和MessagePayload新增加入令牌字段,创建房间返回包含令牌 - 新增房间加入令牌验证接口,加入时需提供房间号和令牌 - 前端HomeView新增加入令牌输入框及验证逻辑 - Clipboard工具增加写入API支持及复制按钮 - FileDropZone支持选择文件夹批量上传 - FileMessage和ImageMessage新增分片进度提示及失败重试功能 - API层新增分块上传及断点续传实现,支持大文件分片上传 - 文件上传存储时计算文件sha256,响应中返回该值 - 下载接口支持断点续传,优化大文件下载体验 - README新增加入令牌安全说明及压力测试使用示例 - 资源清理与配置优化,添加磁盘使用水位阈值控制
71 lines
2.0 KiB
Java
71 lines
2.0 KiB
Java
package com.datatool.config;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
/**
|
|
* 文件传输配置:上传目录、单文件大小上限、房间过期时间。
|
|
*/
|
|
@Component
|
|
@ConfigurationProperties(prefix = "datatool.transfer")
|
|
public class TransferProperties {
|
|
|
|
private String uploadDir = "./data/uploads";
|
|
private long maxFileSize = 104_857_600L; // 100MB
|
|
private int roomExpireHours = 24;
|
|
/** 定时过期清理间隔(毫秒),默认 1 小时。 */
|
|
private long cleanupIntervalMs = 3600000L;
|
|
/** 磁盘使用率高水位(%):达到后触发按最旧目录回收。 */
|
|
private int diskHighWatermarkPercent = 80;
|
|
/** 磁盘回收目标水位(%):回收到低于该值即停止。 */
|
|
private int diskTargetWatermarkPercent = 70;
|
|
|
|
public String getUploadDir() {
|
|
return uploadDir;
|
|
}
|
|
|
|
public void setUploadDir(String uploadDir) {
|
|
this.uploadDir = uploadDir;
|
|
}
|
|
|
|
public long getMaxFileSize() {
|
|
return maxFileSize;
|
|
}
|
|
|
|
public void setMaxFileSize(long maxFileSize) {
|
|
this.maxFileSize = maxFileSize;
|
|
}
|
|
|
|
public int getRoomExpireHours() {
|
|
return roomExpireHours;
|
|
}
|
|
|
|
public void setRoomExpireHours(int roomExpireHours) {
|
|
this.roomExpireHours = roomExpireHours;
|
|
}
|
|
|
|
public long getCleanupIntervalMs() {
|
|
return cleanupIntervalMs;
|
|
}
|
|
|
|
public void setCleanupIntervalMs(long cleanupIntervalMs) {
|
|
this.cleanupIntervalMs = cleanupIntervalMs;
|
|
}
|
|
|
|
public int getDiskHighWatermarkPercent() {
|
|
return diskHighWatermarkPercent;
|
|
}
|
|
|
|
public void setDiskHighWatermarkPercent(int diskHighWatermarkPercent) {
|
|
this.diskHighWatermarkPercent = diskHighWatermarkPercent;
|
|
}
|
|
|
|
public int getDiskTargetWatermarkPercent() {
|
|
return diskTargetWatermarkPercent;
|
|
}
|
|
|
|
public void setDiskTargetWatermarkPercent(int diskTargetWatermarkPercent) {
|
|
this.diskTargetWatermarkPercent = diskTargetWatermarkPercent;
|
|
}
|
|
}
|