mirror of
https://github.com/KOHGYLW/kiftd-source.git
synced 2025-01-09 04:27:56 +08:00
update to v1.0.29-release 稳定性更新
This commit is contained in:
parent
7fe850feb4
commit
27f3a72caf
@ -72,5 +72,5 @@ _提示:源代码路径下包含了一些程序运行所需的非源代码资
|
||||
### 联系作者?
|
||||
如有任何需要(例如对该资源有疑问、意见或建议),请发件联系作者: kohgylw@163.com (青阳龙野),随时恭候您的来信!
|
||||
|
||||
青阳龙野@kohgylw by 2020年05月06日
|
||||
青阳龙野@kohgylw by 2020年05月12日
|
||||
|
||||
|
1
TODO.txt
1
TODO.txt
@ -145,4 +145,5 @@ test.auth.xxx=ucd
|
||||
【已完成】修复了上传文件夹功能无法上传Unix/Linux系统中的隐藏文件夹(以“.”开头)的问题。
|
||||
【已完成】修复了上传文件和上传文件夹功能在取消时会互相冲突的问题。
|
||||
【已完成】修复了一些情况下快捷键会失效或功能异常的问题。
|
||||
【已完成】(追加)修复了在“管理文件系统路径”窗口中修改文件系统存储路径时如果取消操作会导致所有按钮无法回弹的问题。
|
||||
【已完成】其他一些细节优化。
|
||||
|
@ -91,7 +91,7 @@ public class ExternalDownloadServiceImpl extends RangeFileStreamWriter implement
|
||||
if (target != null && target.isFile()) {
|
||||
String range = request.getHeader("Range");
|
||||
int status = writeRangeFileStream(request, response, target, f.getFileName(), CONTENT_TYPE,
|
||||
ConfigureReader.instance().getDownloadMaxRate(null), fbu.getETag(target));
|
||||
ConfigureReader.instance().getDownloadMaxRate(null), fbu.getETag(target), true);
|
||||
if (status == HttpServletResponse.SC_OK || (range != null && range.startsWith("bytes=0-"))) {
|
||||
this.lu.writeDownloadFileByKeyEvent(request, f);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class FileChainServiceImpl extends RangeFileStreamWriter implements FileC
|
||||
String range = request.getHeader("Range");
|
||||
int status = writeRangeFileStream(request, response, target, f.getFileName(),
|
||||
ctm.getContentType(suffix), ConfigureReader.instance().getDownloadMaxRate(null),
|
||||
fbu.getETag(target));
|
||||
fbu.getETag(target), false);
|
||||
if (status == HttpServletResponse.SC_OK
|
||||
|| (range != null && range.startsWith("bytes=0-"))) {
|
||||
this.lu.writeChainEvent(request, f);
|
||||
|
@ -332,7 +332,7 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
|
||||
final String range = request.getHeader("Range");
|
||||
if (fo != null) {
|
||||
int status = writeRangeFileStream(request, response, fo, f.getFileName(), CONTENT_TYPE,
|
||||
ConfigureReader.instance().getDownloadMaxRate(account), fbu.getETag(fo));
|
||||
ConfigureReader.instance().getDownloadMaxRate(account), fbu.getETag(fo), true);
|
||||
// 日志记录(仅针对一次下载)
|
||||
if (status == HttpServletResponse.SC_OK
|
||||
|| (range != null && range.startsWith("bytes=0-"))) {
|
||||
@ -500,7 +500,7 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
|
||||
String fname = "kiftd_" + ServerTimeUtil.accurateToDay() + "_\u6253\u5305\u4e0b\u8f7d.zip";
|
||||
if (zip.exists()) {
|
||||
writeRangeFileStream(request, response, zip, fname, CONTENT_TYPE,
|
||||
ConfigureReader.instance().getDownloadMaxRate(account), fbu.getETag(zip));
|
||||
ConfigureReader.instance().getDownloadMaxRate(account), fbu.getETag(zip), true);
|
||||
zip.delete();
|
||||
}
|
||||
}
|
||||
|
@ -44,10 +44,14 @@ public class RangeFileStreamWriter {
|
||||
* java.lang.String HTTP Content-Type类型(用于控制客户端行为)
|
||||
* @param maxRate
|
||||
* long 最大输出速率,以KB/s为单位,若为负数则不限制输出速率(用于限制客户端的下载速度)
|
||||
* @param eTag
|
||||
* java.lang.String 资源的唯一性标识,例如"aabbcc"
|
||||
* @param isAttachment
|
||||
* boolean 是否作为附件回传,若希望用户下载则应设置为true
|
||||
* @return int 操作结束时返回的状态码
|
||||
*/
|
||||
protected int writeRangeFileStream(HttpServletRequest request, HttpServletResponse response, File fo, String fname,
|
||||
String contentType, long maxRate, String eTag) {
|
||||
String contentType, long maxRate, String eTag, boolean isAttachment) {
|
||||
long fileLength = fo.length();// 文件总大小
|
||||
long startOffset = 0; // 起始偏移量
|
||||
boolean hasEnd = false;// 请求区间是否存在结束标识
|
||||
@ -95,14 +99,20 @@ public class RangeFileStreamWriter {
|
||||
response.setContentType(contentType);
|
||||
// 设置文件信息
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
if (request.getHeader("User-Agent").toLowerCase().indexOf("safari") >= 0) {
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\""
|
||||
+ new String(fname.getBytes(Charset.forName("UTF-8")), Charset.forName("ISO-8859-1"))
|
||||
+ "\"; filename*=utf-8''" + EncodeUtil.getFileNameByUTF8(fname));
|
||||
// 设置Content-Disposition信息
|
||||
if (isAttachment) {
|
||||
if (request.getHeader("User-Agent").toLowerCase().indexOf("safari") >= 0) {
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\""
|
||||
+ new String(fname.getBytes(Charset.forName("UTF-8")), Charset.forName("ISO-8859-1"))
|
||||
+ "\"; filename*=utf-8''" + EncodeUtil.getFileNameByUTF8(fname));
|
||||
} else {
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\"" + EncodeUtil.getFileNameByUTF8(fname) + "\"; filename*=utf-8''"
|
||||
+ EncodeUtil.getFileNameByUTF8(fname));
|
||||
}
|
||||
} else {
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + EncodeUtil.getFileNameByUTF8(fname)
|
||||
+ "\"; filename*=utf-8''" + EncodeUtil.getFileNameByUTF8(fname));
|
||||
response.setHeader("Content-Disposition", "inline");
|
||||
}
|
||||
// 设置支持断点续传功能
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
|
@ -42,7 +42,7 @@ public class FileSystemPathViewer extends KiftdDynamicWindow {
|
||||
private JButton changeBtn;// 修改按钮
|
||||
private JButton removeBtn;// 删除按钮
|
||||
private PathsTable pathsTable;// 文件列表对象
|
||||
private int maxExtendStoresNum;//最大扩展存储区数目
|
||||
private int maxExtendStoresNum;// 最大扩展存储区数目
|
||||
|
||||
private static FileSystemPathViewer fsv;// 该窗口的唯一实例
|
||||
private static List<FileSystemPath> paths;// 当前显示的视图
|
||||
@ -80,7 +80,7 @@ public class FileSystemPathViewer extends KiftdDynamicWindow {
|
||||
toolBar.addSeparator();
|
||||
c.add(toolBar, BorderLayout.NORTH);
|
||||
// 各个工具栏按钮的功能实现
|
||||
maxExtendStoresNum=SettingWindow.st==null?0:SettingWindow.st.getMaxExtendStoresNum();
|
||||
maxExtendStoresNum = SettingWindow.st == null ? 0 : SettingWindow.st.getMaxExtendStoresNum();
|
||||
addBtn.addActionListener((e) -> {
|
||||
disableAllButtons();
|
||||
if (SettingWindow.extendStores.size() < maxExtendStoresNum) {
|
||||
@ -127,78 +127,77 @@ public class FileSystemPathViewer extends KiftdDynamicWindow {
|
||||
changeBtn.addActionListener((e) -> {
|
||||
disableAllButtons();
|
||||
if (JOptionPane.showConfirmDialog(window, "确认要修改该存储路径么?警告:修改为新路径后,该存储区内原先存放的数据将会丢失。", "修改路径",
|
||||
JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
short index = pathsTable.getSelectFileSystemIndex();
|
||||
if (index == 0) {
|
||||
JFileChooser mainFileSystemPathChooer = new JFileChooser();
|
||||
mainFileSystemPathChooer.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
mainFileSystemPathChooer.setPreferredSize(fileChooerSize);
|
||||
if (SettingWindow.st != null) {
|
||||
File fileSystemPath = new File(SettingWindow.st.getFileSystemPath());
|
||||
if (fileSystemPath.isDirectory()) {
|
||||
mainFileSystemPathChooer.setCurrentDirectory(fileSystemPath);
|
||||
}
|
||||
}
|
||||
mainFileSystemPathChooer.setDialogTitle("请选择主文件系统存储路径");
|
||||
if (mainFileSystemPathChooer.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
||||
File selectPath = mainFileSystemPathChooer.getSelectedFile();
|
||||
if (selectPath.isDirectory() && selectPath.canWrite() && selectPath.canRead()) {
|
||||
if (!SettingWindow.extendStores.parallelStream()
|
||||
.anyMatch(f -> f.getPath().equals(selectPath))) {
|
||||
String pathName = selectPath.getAbsolutePath();
|
||||
if (new File(ConfigureReader.instance().getInitFileSystemPath()).equals(selectPath)
|
||||
|| (encoder.canEncode(pathName) && pathName.indexOf("\\:") < 0
|
||||
&& pathName.indexOf("\\\\") < 0)) {
|
||||
SettingWindow.chooserPath = mainFileSystemPathChooer.getSelectedFile();
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, INVALID_PATH_ALTER, "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径已被某个扩展存储区占用。", "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
short index = pathsTable.getSelectFileSystemIndex();
|
||||
if (index == 0) {
|
||||
JFileChooser mainFileSystemPathChooer = new JFileChooser();
|
||||
mainFileSystemPathChooer.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
mainFileSystemPathChooer.setPreferredSize(fileChooerSize);
|
||||
if (SettingWindow.st != null) {
|
||||
File fileSystemPath = new File(SettingWindow.st.getFileSystemPath());
|
||||
if (fileSystemPath.isDirectory()) {
|
||||
mainFileSystemPathChooer.setCurrentDirectory(fileSystemPath);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径不可用,必须选择可读写的文件夹。", "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
JFileChooser mainFileSystemPathChooer = new JFileChooser();
|
||||
mainFileSystemPathChooer.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
mainFileSystemPathChooer.setPreferredSize(fileChooerSize);
|
||||
FileSystemPath fsp = null;
|
||||
for (int i = 0; i < SettingWindow.extendStores.size(); i++) {
|
||||
if (SettingWindow.extendStores.get(i).getIndex() == index) {
|
||||
fsp = SettingWindow.extendStores.get(i);
|
||||
mainFileSystemPathChooer.setCurrentDirectory(fsp.getPath());
|
||||
mainFileSystemPathChooer.setDialogTitle("请选择扩展存储区路径");
|
||||
if (mainFileSystemPathChooer.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
||||
disableAllButtons();
|
||||
File selectPath = mainFileSystemPathChooer.getSelectedFile();
|
||||
if (selectPath.isDirectory() && selectPath.canWrite() && selectPath.canRead()) {
|
||||
if (fsp.getPath().equals(selectPath) || !SettingWindow.extendStores.parallelStream()
|
||||
.anyMatch(f -> f.getPath().equals(selectPath))) {
|
||||
String pathName = selectPath.getAbsolutePath();
|
||||
if (encoder.canEncode(pathName) && pathName.indexOf("\\:") < 0
|
||||
&& pathName.indexOf("\\\\") < 0) {
|
||||
fsp.setPath(mainFileSystemPathChooer.getSelectedFile());
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, INVALID_PATH_ALTER, "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
mainFileSystemPathChooer.setDialogTitle("请选择主文件系统存储路径");
|
||||
if (mainFileSystemPathChooer.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
||||
File selectPath = mainFileSystemPathChooer.getSelectedFile();
|
||||
if (selectPath.isDirectory() && selectPath.canWrite() && selectPath.canRead()) {
|
||||
if (!SettingWindow.extendStores.parallelStream()
|
||||
.anyMatch(f -> f.getPath().equals(selectPath))) {
|
||||
String pathName = selectPath.getAbsolutePath();
|
||||
if (new File(ConfigureReader.instance().getInitFileSystemPath()).equals(selectPath)
|
||||
|| (encoder.canEncode(pathName) && pathName.indexOf("\\:") < 0
|
||||
&& pathName.indexOf("\\\\") < 0)) {
|
||||
SettingWindow.chooserPath = mainFileSystemPathChooer.getSelectedFile();
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径已被其他扩展存储区占用。", "错误",
|
||||
JOptionPane.showMessageDialog(window, INVALID_PATH_ALTER, "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径不可用,必须选择可读写的文件夹。", "错误",
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径已被某个扩展存储区占用。", "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径不可用,必须选择可读写的文件夹。", "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
JFileChooser mainFileSystemPathChooer = new JFileChooser();
|
||||
mainFileSystemPathChooer.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
mainFileSystemPathChooer.setPreferredSize(fileChooerSize);
|
||||
FileSystemPath fsp = null;
|
||||
for (int i = 0; i < SettingWindow.extendStores.size(); i++) {
|
||||
if (SettingWindow.extendStores.get(i).getIndex() == index) {
|
||||
fsp = SettingWindow.extendStores.get(i);
|
||||
mainFileSystemPathChooer.setCurrentDirectory(fsp.getPath());
|
||||
mainFileSystemPathChooer.setDialogTitle("请选择扩展存储区路径");
|
||||
if (mainFileSystemPathChooer.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
||||
disableAllButtons();
|
||||
File selectPath = mainFileSystemPathChooer.getSelectedFile();
|
||||
if (selectPath.isDirectory() && selectPath.canWrite() && selectPath.canRead()) {
|
||||
if (fsp.getPath().equals(selectPath) || !SettingWindow.extendStores.parallelStream()
|
||||
.anyMatch(f -> f.getPath().equals(selectPath))) {
|
||||
String pathName = selectPath.getAbsolutePath();
|
||||
if (encoder.canEncode(pathName) && pathName.indexOf("\\:") < 0
|
||||
&& pathName.indexOf("\\\\") < 0) {
|
||||
fsp.setPath(mainFileSystemPathChooer.getSelectedFile());
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, INVALID_PATH_ALTER, "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径已被其他扩展存储区占用。", "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(window, "错误:该路径不可用,必须选择可读写的文件夹。", "错误",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Thu May 07 17:18:08 CST 2020
|
||||
#Tue May 12 10:14:44 CST 2020
|
||||
version=1.0.29-RELEASE
|
||||
groupId=kohgylw
|
||||
m2e.projectName=kiftd
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user