Skip to content

Commit

Permalink
javafx native package config
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Jul 18, 2018
1 parent 10ab01d commit a125aec
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
log/
!.mvn/wrapper/maven-wrapper.jar

### STS ###
Expand Down
56 changes: 2 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,9 @@
# HTTP下载器
使用本地http代理服务器方式嗅探下载请求,支持所有操作系统和大部分主流浏览器,支持分段下载和断点下载。
## 使用教程
### 下载
- [OneDrive](https://imhx-my.sharepoint.com/:f:/g/personal/pd_imhx_onmicrosoft_com/EnPrybHS3rVFuy_HdcP7RLoBwhb0k5ayJdIzwjU0hCM9-A?e=he0oIz)(推荐)
- [百度云](https://pan.baidu.com/s/1fgBnWJ0gl6ZkneGkVDIEfQ) 提取码:d92x
### 安装
1. [Windows安装教程](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/windows/read.md)
2. [MAC安装教程](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/mac/read.md)
3. [Linux安装教程](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/linux/read.md)
### 安装成功
在安装成功之后,**进入浏览器**下载资源时会跳转到创建任务页面,然后选择保存的路径和分段数进行创建下载任务。
![新建任务](https://github.com/monkeyWie/proxyee-down/raw/master/.guide/common/new-task.png)
## 常见问题(**必看**)
在开始使用前务必看一遍[常见问题列表](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/FAQ.md),可以解决你使用proxyee-down下载遇到的绝大多数问题。
## 常用功能
### 手动创建任务
可以根据链接来创建一个任务,支持自定义请求头和请求体,具体请[查看](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/common/create/read.md)
### 刷新任务下载链接
当任务下载链接失效了,下载没速度或失败则可以使用刷新下载链接的功能,使用新的链接继续下载,具体请[查看](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/common/refresh/read.md)
### 百度云破解
#### 2018-03-29更新
百度云近期对**批量下载**的并发连接数做了限制,如果选择的文件里包含文件夹,分段数需要建议不要超过64,否则可能会导致任务下载失败或下载速度慢。
#### 功能介绍
百度云大文件、合并下载限制突破,成功安装下载器后,打开百度云页面会有如下提示,然后在选择文件后点击下载按钮即可调用proxyee-down下载
![百度云破解](https://github.com/monkeyWie/proxyee-down/raw/master/.guide/common/bdy-hook.png)
### 百度云解压工具
由于百度批量下载的zip压缩包不是zip64格式,在压缩包里有超过4G文件的时候普通的解压工具并不能正确的识别文件大小从而导致压缩失败,遇到这种情况时可以在下载器左侧**工具**栏目里找到百度云解压工具进行解压
![百度云解压](https://github.com/monkeyWie/proxyee-down/raw/master/.guide/common/bdy-unzip.png)
## 其他
### SwitchyOmega插件安装与设置
[查看](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/common/switchy/read.md)
### 手动安装证书
[查看](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/common/ca/read.md)
### 开放接口
[查看](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/common/api/read.md)
### QQ群
1群**11352304**、2群**20236964**、3群**20233754**、4群**737991056**
### 支持
感谢 [惶心|技术博客](https://tech.hxco.de) 提供下载服务
# 开发
本项目依赖[proxyee](https://github.com/monkeyWie/proxyee),因为还没上传maven中央仓库,需自行编译打包至本地仓库。
导入IDE里时需要安装lombok插件。
## 环境
![](https://img.shields.io/badge/JAVA-1.8%2B-brightgreen.svg) ![](https://img.shields.io/badge/maven-3.0%2B-brightgreen.svg) ![](https://img.shields.io/badge/node.js-8.0%2B-brightgreen.svg)

## 编译
```
#proxyee依赖编译
git clone https://github.com/monkeyWie/proxyee.git
cd proxyee
mvn clean install
#proxyee-down编译
git clone https://github.com/monkeyWie/proxyee-down.git
cd proxyee-down/ui/view
npm install
npm run build
cd ../..
cd proxyee-down/main
mvn clean package
```
## 运行
Expand Down
17 changes: 11 additions & 6 deletions main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@
</dependencies>

<build>
<finalName>proxyee-down-main</finalName>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.2.RELEASE</version>
<configuration>
<mainClass>org.pdown.gui.DownApplication</mainClass>
<vendor>pdown</vendor>
<!-- <bundleArguments>
<icon>${project.basedir}/src/main/resources/logo.ico</icon>
</bundleArguments>-->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
11 changes: 9 additions & 2 deletions main/src/main/java/org/pdown/gui/DownApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javafx.scene.image.Image;
import javafx.stage.Screen;
import javafx.stage.Stage;
import org.pdown.core.util.OsUtil;
import org.pdown.gui.com.Browser;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
Expand All @@ -22,7 +23,9 @@
@ComponentScan(basePackages = "org.pdown.rest")
public class DownApplication extends AbstractJavaFxApplicationSupport {

private static final String ICON_NAME = "icon.png";
private static final String OS = OsUtil.isWindows() ? "windows"
: (OsUtil.isMac() ? "mac" : "linux");
private static final String ICON_NAME = OS + "/logo.png";

private Stage stage;
private Browser browser;
Expand All @@ -36,6 +39,7 @@ public void start(Stage primaryStage) throws Exception {
loadBrowser();
loadWindow();
show();
trayIcon.displayMessage("提示", System.getProperty("user.dir") + "\t" + System.getProperty("java.home"), TrayIcon.MessageType.INFO);
}

//加载托盘
Expand All @@ -55,7 +59,10 @@ private void loadTray() throws AWTException {
MenuItem showItem = new MenuItem("显示");
showItem.addActionListener(event -> Platform.runLater(() -> show()));
MenuItem closeItem = new MenuItem("退出");
closeItem.addActionListener(event -> System.exit(0));
closeItem.addActionListener(event -> {
Platform.exit();
System.exit(0);
});
popupMenu.add(showItem);
popupMenu.add(closeItem);
trayIcon.setPopupMenu(popupMenu);
Expand Down
8 changes: 8 additions & 0 deletions main/src/main/resources/banner.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_
| |
_ __ _ __ ___ __ __ _ _ ___ ___ ______ __| | ___ __ __ _ __
| '_ \ | '__| / _ \ \ \/ /| | | | / _ \ / _ \|______| / _` | / _ \ \ \ /\ / /| '_ \
| |_) || | | (_) | > < | |_| || __/| __/ | (_| || (_) | \ V V / | | | |
| .__/ |_| \___/ /_/\_\ \__, | \___| \___| \__,_| \___/ \_/\_/ |_| |_|
| | __/ |
|_| |___/
Binary file added main/src/main/resources/linux/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed main/src/main/resources/logo.ico
Binary file not shown.
Binary file added main/src/main/resources/mac/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/src/main/resources/windows/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 51 additions & 2 deletions runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,59 @@
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.8.3</version>
<configuration>
<mainClass>org.pdown.gui.DownApplication</mainClass>
<vendor>ProxyeeDown</vendor>
<mainClass>org.pdown.gui.Runner</mainClass>
<vendor>pdown.org</vendor>
<title>proxyee-down</title>
<appName>proxyee-down</appName>
<nativeReleaseVersion>${project.version}</nativeReleaseVersion>
<!--<bundleArguments>
<runtime/>
</bundleArguments>-->
</configuration>
<executions>
<execution>
<id>jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>native</id>
<phase>package</phase>
<goals>
<goal>native</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>copy-java</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<sourceFile>${JAVA_HOME}/bin/java.exe</sourceFile>
<destinationFile>${project.build.directory}/jfx/native/proxyee-down/runtime/bin/java.exe</destinationFile>
</fileSet>
<fileSet>
<sourceFile>../main/target/proxyee-down-main.jar</sourceFile>
<destinationFile>${project.build.directory}/jfx/native/proxyee-down/main/proxyee-down-main.jar</destinationFile>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
Binary file not shown.
15 changes: 14 additions & 1 deletion runner/src/main/java/org/pdown/gui/Runner.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
package org.pdown.gui;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;

public class Runner {

private static final String SHELL_PARAMS = " -Dfile.encoding=GBK -Xms128m -Xmx256m -jar ";
// private static final String MAIN_PATH = System.getProperty("user.dir") + File.separator + "main/target" + File.separator;
private static final String CORE_PATH = "../main/proxyee-down-main.jar";

private static String SHELL;

static {
String execPath = File.separator + "bin" + File.separator + "java";
String javaHome = System.getProperty("java.home") + execPath;
SHELL = "\"" + javaHome + "\"" + SHELL_PARAMS + "\"" + CORE_PATH + "\"";
}

public static void main(String[] args) throws IOException {
Process process = Runtime.getRuntime().exec("./main/proxyee-down-main");
Process process = Runtime.getRuntime().exec(SHELL);
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
Expand Down

0 comments on commit a125aec

Please sign in to comment.