update to v1.0.28-release

This commit is contained in:
kohgylw@163.com 2020-02-07 09:34:21 +08:00
parent 09b184880b
commit 46c9c4e7f2
13 changed files with 81 additions and 49 deletions

View File

@ -1,7 +1,7 @@
## 欢迎访问kiftd源代码资源库
### Welcome to visit source of kiftd!
_当前版本v1.0.27-RELEASE_
_当前版本v1.0.28-RELEASE_
### 简介
_kiftd——一款便捷、开源、功能完善的个人&团队&小型团队网盘服务器系统。_
@ -72,5 +72,5 @@ _提示源代码路径下包含了一些程序运行所需的非源代码资
### 联系作者?
如有任何需要(例如对该资源有疑问、意见或建议),请发件联系作者: kohgylw@163.com (青阳龙野),随时恭候您的来信!
青阳龙野@kohgylw by 2020年01月02
青阳龙野@kohgylw by 2020年02月07

View File

@ -122,3 +122,8 @@ test.auth.xxx=ucd
【已完成】优化了当前端页面的显示机制,解决了当文件或文件夹名称中含有特殊字符时可能会出现的一些问题。
【已完成】优化了文件系统,进一步增强其稳定性和安全性。
【已完成】进一步完善了《kiftd说明文档》新增了关于“设置页面背景图片”和“备份文件系统数据”的相关介绍。
已完成 v1.0.28
--------------
【已完成】修正了部分启动命令存在提示内容错误的问题。
【已完成】进一步优化了命令模式下“文件管理”功能的命令检验和提示机制,使其更加便于使用。

View File

@ -4,7 +4,7 @@
<groupId>kohgylw</groupId>
<artifactId>kiftd</artifactId>
<version>1.0.27-RELEASE</version>
<version>1.0.28-RELEASE</version>
<packaging>jar</packaging>
<name>kiftd</name>

View File

@ -6,8 +6,6 @@ import kohgylw.kiftd.server.exception.FoldersTotalOutOfLimitException;
import kohgylw.kiftd.server.model.Node;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.sql.SQLException;
import java.util.List;
import java.util.NoSuchElementException;
@ -91,8 +89,7 @@ public class ConsoleRunner {
break;
}
default: {
Printer.instance
.print("kiftd:无效的指令,使用控制台模式启动请输入参数 -console备份文件请输入参数 -backup {本地备份路径}使用UI模式启动请不传入任何参数。");
Printer.instance.print("kiftd:无效的指令,使用控制台模式启动请输入参数 -console直接启动服务器引擎请输入参数 -start使用UI模式启动请不要传入任何参数。");
break;
}
}
@ -193,7 +190,7 @@ public class ConsoleRunner {
try {
while (true) {
Printer.instance.print("kiftd: console$ ");
String command = new String(reader.nextLine().getBytes("UTF-8"), "UTF-8");
String command = reader.nextLine();
switch (command) {
case "-start":
startServer();
@ -245,7 +242,8 @@ public class ConsoleRunner {
Printer.instance.print("已进入文件管理功能。");
try {
FileNodeUtil.initNodeTableToDataBase();
if (currentFolder == null) {
if (currentFolder == null || currentFolder.getCurrent() == null || FileSystemManager.getInstance()
.selectFolderById(currentFolder.getCurrent().getFolderId()) == null) {
getFolderView("root");
}
} catch (Exception e) {
@ -255,8 +253,8 @@ public class ConsoleRunner {
System.out.println("命令帮助:\r\n" + fsCommandTips + "\r\n");
try {
while (true) {
System.out.print("kiftd: " + currentFolder.getCurrent().getFolderName() + "$ ");
String command = new String(reader.nextLine().getBytes("UTF-8"), "UTF-8");
System.out.println("kiftd: " + currentFolder.getCurrent().getFolderName() + "$ ");
String command = reader.nextLine();
// 针对一些带参数指令的操作
if (command.startsWith("cd ")) {
gotoFolder(command.substring(3));
@ -313,6 +311,7 @@ public class ConsoleRunner {
currentFolder = FileSystemManager.getInstance().getFolderView(folderId);
} catch (SQLException e) {
openFolderError();
return;
}
List<Folder> fls = currentFolder.getFolders();
int index = 1;
@ -332,13 +331,10 @@ public class ConsoleRunner {
private void gotoFolder(String fname) {
try {
currentFolder = FileSystemManager.getInstance().getFolderView(currentFolder.getCurrent().getFolderId());
try {
String fid = getSelectFolderOrFileId(fname);
if (fid != null) {
getFolderView(fid);
}
String fid = getSelectFolderId(fname);
if (fid != null) {
getFolderView(fid);
return;
} catch (NoSuchElementException e) {
}
Printer.instance.print("错误:该文件夹不存在或其不是一个文件夹(" + fname + ")。");
} catch (SQLException e) {
@ -371,7 +367,39 @@ public class ConsoleRunner {
return null;
}
// 根据用户输入的序号或者名称得到相应的ID
// 根据用户输入的序号或者名称得到相应的文件夹ID
private String getSelectFolderId(String fname) {
if ("../".equals(fname) || "..".equals(fname)) {
if (currentFolder.getCurrent().getFolderId().equals("root")) {
return "root";
} else {
return currentFolder.getCurrent().getFolderParent();
}
}
if ("./".equals(fname) || ".".equals(fname)) {
return currentFolder.getCurrent().getFolderId();
}
if (fname.startsWith("--")) {
int index = Integer.parseInt(fname.substring(2));
try {
if (index >= 1 && index <= currentFolder.getFolders().size()) {
return currentFolder.getFolders().get(index - 1).getFolderId();
}
} catch (Exception e) {
}
return null;
}
try {
return currentFolder.getFolders().parallelStream().filter((e) -> e.getFolderName().equals(fname))
.findFirst().get().getFolderId();
} catch (NoSuchElementException e) {
}
return null;
}
// 根据用户输入的序号或者名称得到相应的文件或文件夹ID不区分文件夹或文件
private String getSelectFolderOrFileId(String fname) {
if ("../".equals(fname) || "..".equals(fname)) {
if (currentFolder.getCurrent().getFolderId().equals("root")) {
@ -489,7 +517,7 @@ public class ConsoleRunner {
if (FileSystemManager.getInstance().hasExistsFilesOrFolders(importFiles, targetFolder) > 0) {
System.out.println("提示:该路径下已经存在同名文件或文件夹(" + f.getName() + "),您希望?[C]取消 [V]覆盖 [B]保留两者");
q: while (true) {
String command = new String(reader.nextLine().getBytes("UTF-8"), "UTF-8");
String command = reader.nextLine();
switch (command) {
case "C":
Printer.instance.print("导入被取消。");
@ -636,7 +664,7 @@ public class ConsoleRunner {
if (FileSystemManager.getInstance().hasExistsFilesOrFolders(foldersId, filesId, targetPath) > 0) {
System.out.println("提示:该路径下已经存在同名文件或文件夹(" + targetPath.getName() + "),您希望?[C]取消 [V]覆盖 [B]保留两者");
q: while (true) {
String command2 = new String(reader.nextLine().getBytes("UTF-8"), "UTF-8");
String command2 = reader.nextLine();
switch (command2) {
case "C":
Printer.instance.print("导出被取消。");
@ -719,21 +747,16 @@ public class ConsoleRunner {
private boolean confirmOpt(String tip) {
System.out.println("提示:" + tip + " [Y/N]");
while (true) {
String command;
try {
System.out.print("> ");
command = new String(reader.nextLine().getBytes("UTF-8"), "UTF-8");
switch (command) {
case "Y":
return true;
case "N":
return false;
default:
System.out.println("必须正确输入Y或N");
break;
}
} catch (UnsupportedEncodingException e) {
System.out.println("错误:无法识别输入的内容,重新输入。");
System.out.print("> ");
String command = reader.nextLine();
switch (command) {
case "Y":
return true;
case "N":
return false;
default:
System.out.println("必须正确输入Y或N");
break;
}
}
}
@ -765,7 +788,7 @@ public class ConsoleRunner {
private void openFolderError() {
Printer.instance.print("错误:无法读取指定文件夹,是否返回根目录?[Y/N]");
System.out.print("> ");
String command = new String(reader.nextLine().getBytes(Charset.forName("UTF-8")), Charset.forName("UTF-8"));
String command = reader.nextLine();
while (true) {
switch (command) {
case "Y":
@ -776,7 +799,6 @@ public class ConsoleRunner {
}
return;
case "N":
Printer.instance.print("错误:无法读取指定文件夹,请重试。");
return;
default:
System.out.println("请输入Y或N");

View File

@ -139,11 +139,16 @@ public class FileSystemManager {
* 获取失败
*/
public FolderView getFolderView(String folderId) throws SQLException {
FolderView fv = new FolderView();
fv.setCurrent(selectFolderById(folderId));
fv.setFiles(selectNodesByFolderId(folderId));
fv.setFolders(getFoldersByParentId(folderId));
return fv;
Folder target = selectFolderById(folderId);
if(target != null) {
FolderView fv = new FolderView();
fv.setCurrent(target);
fv.setFiles(selectNodesByFolderId(folderId));
fv.setFolders(getFoldersByParentId(folderId));
return fv;
}else {
throw new SQLException();
}
}
/**
@ -415,7 +420,7 @@ public class FileSystemManager {
// 将一个本地文件导入到文件系统中注意导入的必须是文件而不是文件夹
private void importFileInto(File f, String folderId, String type) throws Exception {
if (f.isFile()) {
String name = new String(f.getName().getBytes("UTF-8"), "UTF-8");
String name = f.getName();
String newName = name;
per = 0;
message = "正在导入文件:" + name;
@ -488,7 +493,7 @@ public class FileSystemManager {
// 将一个本地文件夹导入至文件系统必须是文件夹而不是文件它会自动将其中的文件和文件夹也一并导入
private void importFolderInto(File f, String folderId, String type) throws Exception {
if (f.isDirectory()) {
String name = new String(f.getName().getBytes("UTF-8"), "UTF-8");
String name = f.getName();
String newName = name;
per = 0;
message = "正在导入文件夹:" + name;

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0
Implementation-Title: kiftd
Implementation-Version: 1.0.27-RELEASE
Implementation-Version: 1.0.28-RELEASE
Built-By: kohgylw
Implementation-Vendor-Id: kohgylw
Class-Path: libs/spring-boot-starter-web-2.0.2.RELEASE.jar libs/spring

View File

@ -1,6 +1,6 @@
#Generated by Maven Integration for Eclipse
#Sat Jan 04 20:46:59 CST 2020
version=1.0.27-RELEASE
#Fri Feb 07 09:33:11 CST 2020
version=1.0.28-RELEASE
groupId=kohgylw
m2e.projectName=kiftd
m2e.projectLocation=/Users/kohgylw/program/java-workspace/kiftd

View File

@ -4,7 +4,7 @@
<groupId>kohgylw</groupId>
<artifactId>kiftd</artifactId>
<version>1.0.27-RELEASE</version>
<version>1.0.28-RELEASE</version>
<packaging>jar</packaging>
<name>kiftd</name>

View File

@ -1,5 +1,5 @@
<!doctype html>
<!-- 青阳网络文件传输系统 kiftd v1.0.27-RELEASE -->
<!-- 青阳网络文件传输系统 kiftd v1.0.28-RELEASE -->
<!-- 欢迎访问主界面 -->
<!-- by 青阳龙野kohgylw@163.com -->
<html>