From 4c28c0e3229e687c696c5adc43a50829e377984c Mon Sep 17 00:00:00 2001 From: octopusYan <935540320@qq.com> Date: Sat, 23 Apr 2022 18:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9A=A7=E9=81=93=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=A7=86=E5=9B=BE=20=E6=B7=BB=E5=8A=A0=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 44 ++++---- pom.xml | 2 +- .../top/octopusyan/base/BaseController.java | 2 +- .../top/octopusyan/config/ProxyConfig.java | 6 +- .../top/octopusyan/config/TextValidate.java | 2 +- .../octopusyan/controller/MainController.java | 101 +++++++++-------- .../top/octopusyan/manager/FrpManager.java | 13 ++- .../top/octopusyan/manager/ProxyManager.java | 4 +- .../java/top/octopusyan/manager/http/Api.java | 2 +- .../octopusyan/view/ProxyListItemView.java | 80 ++++++++++++++ src/main/resources/css/main.css | 18 +--- src/main/resources/fxml/main.fxml | 102 +++++++++--------- src/main/resources/fxml/proxyItem.fxml | 37 +++++-- src/main/resources/fxml/register.fxml | 56 +++++----- src/main/resources/logback.xml | 101 ++++++++++------- 15 files changed, 340 insertions(+), 230 deletions(-) create mode 100644 src/main/java/top/octopusyan/view/ProxyListItemView.java diff --git a/README.md b/README.md index f72cde7..995a85a 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,42 @@ -# Yan Frp +# YanFrp 基于javafx开发的 frp 客户端 -后台管理面板使用的是开源的 frp 管理面板 [SakuraPanel](https://github.com/ZeroDream-CN/SakuraPanel) - - ps:为了适配 yanfrp 我自己修改了些面板代码,如果想自己搭建需要改造 - - 管理面板网址:https://frp.octopusyan.top/?page=login -# 说明: +### 说明: - 1. +- 后台管理面板使用的是开源的 frp 管理面板 [SakuraPanel](https://github.com/ZeroDream-CN/SakuraPanel) +- ps:为了适配 yanfrp 我自己修改了些面板代码,如果想自己搭建需要改造 +- 管理面板网址:https://frp.octopusyan.top/?page=login -# 后续开发计划 +### 安装教程 -- ~~HTTP Basic Auth~~ (已完成) -- ~~添加p2p连接方式(xtcp,stcp)~~ (已完成) -- 删除 +1. git clone https://gitee.com/octopus_yan/yan-frp.git +2. mvn jfx:jar + +### 后续? + +- ~~HTTP Basic Auth~~ +- ~~添加连接方式(xtcp,stcp)~~ +- ~~删除隧道~~ - HTTP URL路由 - 待添加... -# 界面: -登录 +#### 参与贡献 +1. 有实际需要的朋友,请留言联系哈 + + +### 界面: + +#### 登录 ![Image text](https://git.octopusyan.top/octopus_yan/YanFrp/raw/branch/master/readme/login.png) -注册 - +#### 注册 ![Image text](https://git.octopusyan.top/octopus_yan/YanFrp/raw/branch/master/readme/register.png) -主界面 - +#### 主界面 ![Image text](https://git.octopusyan.top/octopus_yan/YanFrp/raw/branch/master/readme/main.png) -主界面-运行 - +#### 主界面-运行 ![Image text](https://git.octopusyan.top/octopus_yan/YanFrp/raw/branch/master/readme/main-run.png) diff --git a/pom.xml b/pom.xml index f3f1127..f0ee9d4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ top.octopusyan yanfrp - 1.1.3 + 1.1.4 yanfrp diff --git a/src/main/java/top/octopusyan/base/BaseController.java b/src/main/java/top/octopusyan/base/BaseController.java index bc88f64..0e47b3c 100644 --- a/src/main/java/top/octopusyan/base/BaseController.java +++ b/src/main/java/top/octopusyan/base/BaseController.java @@ -82,7 +82,7 @@ public abstract class BaseController

implements Initializable { } // app 版本信息 - if (getAppVersionLabel() != null) getAppVersionLabel().setText("version : v" + ApplicatonStore.APP_VERSION); + if (getAppVersionLabel() != null) getAppVersionLabel().setText("v" + ApplicatonStore.APP_VERSION); // 这个位置的左边第一个 JFXBtn 会莫名其妙会的焦点效果,启动时禁用焦点,取消按钮效果 if (getFirstBtn() != null) getFirstBtn().setDisableVisualFocus(true); diff --git a/src/main/java/top/octopusyan/config/ProxyConfig.java b/src/main/java/top/octopusyan/config/ProxyConfig.java index d6484bf..43c970e 100644 --- a/src/main/java/top/octopusyan/config/ProxyConfig.java +++ b/src/main/java/top/octopusyan/config/ProxyConfig.java @@ -29,9 +29,9 @@ public class ProxyConfig { serverIp.put("上海", "127.0.0.1"); typePort.put("http", 80); - typePort.put("https", 80); - typePort.put("tcp", 0); - typePort.put("udp", 0); + typePort.put("https", 443); + typePort.put("tcp", 25565); + typePort.put("udp", 53); } diff --git a/src/main/java/top/octopusyan/config/TextValidate.java b/src/main/java/top/octopusyan/config/TextValidate.java index c0ea21c..85e7731 100644 --- a/src/main/java/top/octopusyan/config/TextValidate.java +++ b/src/main/java/top/octopusyan/config/TextValidate.java @@ -88,7 +88,7 @@ public class TextValidate { static { EmailFormat.setRegexPattern("^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"); AccoountValidator.setRegexPattern("^[a-zA-Z0-9_-]*$"); - PortFormat.setRegexPattern("^([0-9]|[1-9]\\d{1,3}|[1-5]\\d{4}|6[0-4]\\d{4}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$"); + PortFormat.setRegexPattern("^([1-9]|[1-9]\\d{1,3}|[1-5]\\d{4}|6[0-4]\\d{4}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$"); IpFormat.setRegexPattern("^(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\" + ".(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])$"); HttpUserFormat.setRegexPattern("^[a-zA-Z0-9_-]*$"); diff --git a/src/main/java/top/octopusyan/controller/MainController.java b/src/main/java/top/octopusyan/controller/MainController.java index 7be0705..d68d997 100644 --- a/src/main/java/top/octopusyan/controller/MainController.java +++ b/src/main/java/top/octopusyan/controller/MainController.java @@ -5,17 +5,12 @@ import com.alibaba.fastjson.JSONObject; import com.jfoenix.controls.*; import com.jfoenix.validation.base.ValidatorBase; import javafx.application.Platform; -import javafx.beans.InvalidationListener; -import javafx.beans.Observable; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.ObservableValue; import javafx.collections.ObservableList; -import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; -import javafx.scene.control.Button; -import javafx.scene.control.Label; import javafx.scene.control.*; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; @@ -35,9 +30,9 @@ import top.octopusyan.manager.http.request.ProxySetup; import top.octopusyan.model.ApplicatonStore; import top.octopusyan.model.ProxySetupModel; import top.octopusyan.utils.*; +import top.octopusyan.view.ProxyListItemView; import java.io.IOException; -import java.util.List; import java.util.*; import static top.octopusyan.model.ApplicatonStore.*; @@ -51,9 +46,6 @@ import static top.octopusyan.model.ApplicatonStore.*; public class MainController extends BaseController implements Initializable { public static final String PROXY_LIST_ITEM_CLASS = "proxyListItem"; - public static final String PROXY_LIST_ITEM_STOP_CLASS = "proxyListItem-stop"; - public static final String PROXY_LIST_ITEM_RUN_CLASS = "proxyListItem-run"; - public static final String PROXY_LIST_ITEM_CLOSE_CLASS = "proxyListItem-close"; public static final String PROXY_LIST_ITEM_SELECT_CLASS = "proxyListItem-select"; @@ -88,7 +80,7 @@ public class MainController extends BaseController implements Initial public JFXButton copyDomainBtn; /* 隧道列表控件 */ - public JFXListView

true:run false:stop null:disable + * + * @param status 运行状态 + */ + public void setStatus(Boolean status) { + // 初始化样式 + if (style == null) style = statusIcon.getStyle(); + + if (status == null) { + statusIcon.setStyle(style + "-fx-icon-color: linear-gradient(grey, #524e50);"); + } else if (status) { + statusIcon.setStyle(style + "-fx-icon-color: linear-gradient(#95f257, #91e5ac);"); + } else { + statusIcon.setStyle(style + "-fx-icon-color: linear-gradient(#f25757, #e591b1);"); + } + } + + public void setName(String proxyName) { + this.proxyName.setText(proxyName); + } + + public StringProperty textProperty() { + return proxyName.textProperty(); + } + + public Label getProxyName() { + return proxyName; + } + + public JFXButton getDeleteBtn() { + return deleteBtn; + } + + public enum Status { + RUN, STOP, DISABLED + } +} diff --git a/src/main/resources/css/main.css b/src/main/resources/css/main.css index cd7ca99..d05351a 100644 --- a/src/main/resources/css/main.css +++ b/src/main/resources/css/main.css @@ -51,26 +51,10 @@ -fx-opacity: 0.7; -fx-background-color: linear-gradient(#9198e5, #57b4f2); } -#proxyListView .list-cell:hover lable, #proxyListView .list-cell:selected label, .proxyListItem-select{ +#proxyListView .list-cell:hover lable, #proxyListView .list-cell:selected label, .proxyListItem-select label{ -fx-text-fill: white; } -.proxyListItemLabel { - -fx-font-size: 16px; -} -.proxyListItemIcon { - -fx-font-size: 14px; -} - -.proxyListItem-run FontIcon { - -fx-icon-color: linear-gradient(#95f257, #91e5ac); -} -.proxyListItem-stop FontIcon { - -fx-icon-color: linear-gradient(#f25757, #e591b1); -} -.proxyListItem-close FontIcon { - -fx-icon-color: linear-gradient(grey, #524e50); -} /* 面板背景 */ #proxySetupPane, #proxyListPane, .whitePane { diff --git a/src/main/resources/fxml/main.fxml b/src/main/resources/fxml/main.fxml index 65351ee..6bae540 100644 --- a/src/main/resources/fxml/main.fxml +++ b/src/main/resources/fxml/main.fxml @@ -157,7 +157,7 @@ - + @@ -190,37 +190,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +