Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
#89
Browse files Browse the repository at this point in the history
  • Loading branch information
4ra1n committed Jan 10, 2023
1 parent c721290 commit 04b1dca
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,5 @@ Others:

更新内容:
- [important] 支持xray 1.9.4版本 #91
- [important] 指定多个POC #92
- [important] 指定多个POC #92
- [bug] 从下载面板得到的xray无法保存设置 #89
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![](https://img.shields.io/github/v/release/4ra1n/super-xray)](https://github.com/4ra1n/super-xray/releases/latest)
![](https://img.shields.io/github/downloads/4ra1n/super-xray/total)
![](https://img.shields.io/badge/build-JDK8-orange)
![](https://img.shields.io/badge/Java%20Code%20Lines-5978-orange)
![](https://img.shields.io/badge/Java%20Code%20Lines-5991-orange)

[English Version](doc/README.md)

Expand Down
2 changes: 1 addition & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![](https://img.shields.io/github/v/release/4ra1n/super-xray)](https://github.com/4ra1n/super-xray/releases/latest)
![](https://img.shields.io/github/downloads/4ra1n/super-xray/total)
![](https://img.shields.io/badge/build-JDK8-orange)
![](https://img.shields.io/badge/Java%20Code%20Lines-5978-orange)
![](https://img.shields.io/badge/Java%20Code%20Lines-5991-orange)

## Introduce

Expand Down
20 changes: 17 additions & 3 deletions src/main/java/com/chaitin/xray/form/XrayDownForm.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.chaitin.xray.form;

import com.chaitin.xray.model.DB;
import com.chaitin.xray.utils.ExecUtil;
import com.chaitin.xray.utils.OSUtil;
import com.chaitin.xray.utils.StringUtil;
Expand Down Expand Up @@ -42,7 +43,7 @@ public class XrayDownForm {
private JButton saveButton;
private static boolean finish = false;
public static final String xrayDownBase = "https://download.xray.cool/xray";
private static String savePath = ".";
private static String savePath = "./xray-bin/";
private static final String xrayVersion = "1.9.4";
private static String osType = "xray_windows_amd64.exe.zip";

Expand Down Expand Up @@ -73,6 +74,11 @@ private void initLang() {
}

private void initSavePath() {
savePathText.setText(savePath);
try {
Files.createDirectories(Paths.get(savePath));
} catch (Exception ignored) {
}
saveButton.addActionListener(e -> {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Expand Down Expand Up @@ -202,9 +208,9 @@ private void initUnzip() {
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
outPath = Paths.get(outPath).toAbsolutePath().toString();
if (!OSUtil.isWindows()) {
String absOutPath = Paths.get(outPath).toAbsolutePath().toString();
ExecUtil.chmod(absOutPath);
ExecUtil.chmod(outPath);
}
if (MainForm.LANG == MainForm.CHINESE) {
JOptionPane.showMessageDialog(xrayDownPanel, "文件位置:" + outPath);
Expand All @@ -225,6 +231,14 @@ private void initLoad() {
loadButton.addActionListener(e -> {
if (StringUtil.notEmpty(outPath)) {
MainForm.instance.loadXray(outPath);

DB data = new DB();
data.setLastXrayPath(outPath);
try {
Files.write(Paths.get("super-xray.db"), data.getDB().getBytes());
} catch (Exception ex) {
ex.printStackTrace();
}
} else {
if (MainForm.LANG == MainForm.CHINESE) {
JOptionPane.showMessageDialog(xrayDownPanel, "文件不存在");
Expand Down

0 comments on commit 04b1dca

Please sign in to comment.