Skip to content

Commit

Permalink
更新至2.33
Browse files Browse the repository at this point in the history
1.百度云解压修复算法修复,并把递归改成循环避免栈溢出
2.启动证书安装检查bug修复
3.火狐浏览器不支持根证书的bug修复
  • Loading branch information
monkeyWie committed Mar 6, 2018
1 parent 85747f9 commit 827a4d4
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 26 deletions.
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>proxyee-down</artifactId>
<groupId>lee.study</groupId>
<version>2.32</version>
<version>2.33</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
47 changes: 32 additions & 15 deletions common/src/main/java/lee/study/down/io/BdyZip.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,41 @@ private static long fixedEntrySize(FileChannel fileChannel, BdyZipEntry zipEntry
ZIP_ENTRY_FILE_HEARD, ZIP_ENTRY_DIR_HEARD);
BdyZipEntry nextEntry = getNextBdyZipEntry(fileChannel,
zipEntry.getFileStartPosition() + fixedSize);
//修复长度后下个文件目录没对上
if (!Arrays.equals(nextEntry.getHeader(), Arrays.copyOfRange(ZIP_ENTRY_DIR_HEARD, 0, 4))
&& !isRight(dirList, nextEntry)) {
return fixedEntrySize(fileChannel, zipEntry, fixedSize + ZIP_ENTRY_FILE_HEARD.length,
dirList, callback);
//修复长度后下个文件没对上
if (!isRight(dirList, nextEntry)) {
while (fixedSize != -1) {
long nextSize = fixedSize + ZIP_ENTRY_FILE_HEARD.length;
if (callback != null) {
callback.onFix(fileChannel.size(), zipEntry.getFileStartPosition() + nextSize);
}
fixedSize = ByteUtil
.getNextTokenSize(fileChannel, zipEntry.getFileStartPosition(),
zipEntry.getFileStartPosition() + nextSize,
ZIP_ENTRY_FILE_HEARD, ZIP_ENTRY_DIR_HEARD);
nextEntry = getNextBdyZipEntry(fileChannel,
zipEntry.getFileStartPosition() + fixedSize);
if (isRight(dirList, nextEntry)) {
break;
}
}
return fixedSize;
} else {
return fixedSize;
}
}

private static boolean isRight(List<String> dirList, BdyZipEntry nextEntry) {
if (Arrays.equals(nextEntry.getHeader(), Arrays.copyOfRange(ZIP_ENTRY_DIR_HEARD, 0, 4))) {
return true;
} else {
if (nextEntry.isDir()) {
return inDirList(dirList, nextEntry.getFileName());
} else {
return nextEntry.getFileName().matches("^" + dirList.get(dirList.size() - 1) + "[^/]*$");
}
}
}

public static List<BdyZipEntry> getFixedEntryList(FileChannel fileChannel,
BdyUnzipCallback callback) throws IOException {
List<BdyZipEntry> list = new ArrayList<>();
Expand Down Expand Up @@ -198,14 +223,6 @@ private static boolean inDirList(List<String> dirList, String dir) {
return false;
}

private static boolean isRight(List<String> dirList, BdyZipEntry nextEntry) {
if (nextEntry.isDir()) {
return inDirList(dirList, nextEntry.getFileName());
} else {
return nextEntry.getFileName().matches("^" + dirList.get(dirList.size() - 1) + "[^/]*$");
}
}

public static void unzip(String path, String toPath, BdyUnzipCallback callback)
throws IOException {
try {
Expand Down Expand Up @@ -268,7 +285,7 @@ public static void unzip(String path, String toPath)
}

public static void main(String[] args) throws IOException {
unzip("f:/down/test2测试.zip", "f:/down/test2测试", new TestUnzipCallback());
unzip("f:/down/win7pack.zip", "f:/down/win7pack", new TestUnzipCallback());
}

/**
Expand Down Expand Up @@ -342,7 +359,7 @@ public void onEntryWrite(long totalSize, long writeSize) {

@Override
public void onDone() {

System.out.println("onDone");
}

@Override
Expand Down
11 changes: 7 additions & 4 deletions common/src/main/java/lee/study/down/util/OsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,19 @@ public static String getRemoteInterfaceName() throws IOException {
*/
public static boolean existsCert(String name, String sha1) throws IOException {
if (OsUtil.isWindows()) {
if (findCertList(name, true).toUpperCase().indexOf(": " + sha1.toUpperCase()) != -1) {
if (findCertList(name, true).toUpperCase().replaceAll("\\s", "")
.indexOf(":" + sha1.toUpperCase()) != -1) {
return true;
} else {
if (findCertList(name, false).toUpperCase().indexOf(": " + sha1.toUpperCase()) != -1) {
if (findCertList(name, false).toUpperCase().replaceAll("\\s", "")
.indexOf(":" + sha1.toUpperCase()) != -1) {
return true;
}
}
return false;
} else if (OsUtil.isMac()) {
if (findCertList(name).toUpperCase().indexOf(": " + sha1.toUpperCase()) != -1) {
if (findCertList(name).toUpperCase().replaceAll("\\s", "").indexOf(":" + sha1.toUpperCase())
!= -1) {
return true;
} else {
return false;
Expand Down Expand Up @@ -313,7 +316,7 @@ public static void uninstallCert(String name) throws IOException {
String certList = findCertList(name, false);
Matcher matcher = pattern.matcher(certList);
while (matcher.find()) {
String hash = matcher.group(1);
String hash = matcher.group(1).replaceAll("\\s", "");
Runtime.getRuntime().exec("certutil "
+ "-delstore "
+ "-user "
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>proxyee-down</artifactId>
<groupId>lee.study</groupId>
<version>2.32</version>
<version>2.33</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>lee.study</groupId>
<artifactId>proxyee-down</artifactId>
<version>2.32</version>
<version>2.33</version>
<packaging>pom</packaging>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion sniff/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>proxyee-down</artifactId>
<groupId>lee.study</groupId>
<version>2.32</version>
<version>2.33</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>proxyee-down</artifactId>
<groupId>lee.study</groupId>
<version>2.32</version>
<version>2.33</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app.version=2.32
app.version=2.33
spring.profiles.active=prd
view.server.port = 8999
tomcat.server.port = 26339
Expand Down
2 changes: 1 addition & 1 deletion update/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>lee.study</groupId>
<artifactId>proxyee-down-update</artifactId>
<packaging>jar</packaging>
<version>2.32</version>
<version>2.33</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down

0 comments on commit 827a4d4

Please sign in to comment.