Skip to content

Commit

Permalink
修复MAC下代理设置失败导致托盘无法加载的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Mar 5, 2018
1 parent 975f68a commit 5ea87aa
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions ui/src/main/java/lee/study/down/gui/HttpDownApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ private void afterTrayInit() {
.getEncoded());
if (OsUtil.existsCert(HttpDownConstant.CA_SUBJECT)) {
//重新生成卸载之前的证书
if (OsUtil.isWindows() && OsUtil.existsWindowsCert(HttpDownConstant.CA_SUBJECT,false)) { //admin权限静默卸载
if (OsUtil.isWindows() && OsUtil
.existsWindowsCert(HttpDownConstant.CA_SUBJECT, false)) { //admin权限静默卸载
showMsg("检测到系统存在旧的证书,请按确定再根据引导进行删除");
}
OsUtil.uninstallCert(HttpDownConstant.CA_SUBJECT);
Expand Down Expand Up @@ -282,17 +283,21 @@ private void addTray() {
mig.add(globalProxyItem);
mig.add(bdyProxyItem);
mig.add(disableProxyItem);
//默认选中
if (ContentManager.CONFIG.get().getSniffModel() == 1) {
mig.selectItem(globalProxyItem);
OsUtil.enabledHTTPProxy("127.0.0.1", ContentManager.CONFIG.get().getProxyPort());
} else if (ContentManager.CONFIG.get().getSniffModel() == 2) {
mig.selectItem(bdyProxyItem);
OsUtil.enabledPACProxy(
"http://127.0.0.1:" + ConfigUtil.getValue("tomcat.server.port")
+ "/res/pd.pac?t=" + System.currentTimeMillis());
} else {
mig.selectItem(disableProxyItem);
try {
//默认选中
if (ContentManager.CONFIG.get().getSniffModel() == 1) {
mig.selectItem(globalProxyItem);
OsUtil.enabledHTTPProxy("127.0.0.1", ContentManager.CONFIG.get().getProxyPort());
} else if (ContentManager.CONFIG.get().getSniffModel() == 2) {
mig.selectItem(bdyProxyItem);
OsUtil.enabledPACProxy(
"http://127.0.0.1:" + ConfigUtil.getValue("tomcat.server.port")
+ "/res/pd.pac?t=" + System.currentTimeMillis());
} else {
mig.selectItem(disableProxyItem);
}
} catch (Exception e) {
LOGGER.error("set proxy error", e);
}
mig.addActionListener(event -> {
try {
Expand Down

0 comments on commit 5ea87aa

Please sign in to comment.