Skip to content

Commit

Permalink
优化assets
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberber committed Aug 1, 2023
1 parent fe9910f commit 27a60ea
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 8 deletions.
5 changes: 5 additions & 0 deletions assets/files/download_links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"windows": "https://gitee.com/zhoubochina/WePush/releases/download/v4.5.1/WePush-4.5.1-windows.exe",
"mac": "https://gitee.com/zhoubochina/WePush/releases/download/v4.5.1/WePush_4.5.1.dmg",
"linux": "https://gitee.com/zhoubochina/WePush/releases/download/v4.5.1/WePush_4.5.1.deb"
}
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"currentVersion": "v_4.5.1_230413",
"currentVersion": "v_4.5.2_230731",
"versionIndex": {
"v_1.1.0_170701": "0",
"v_1.2.0_170831": "1",
Expand Down Expand Up @@ -51,7 +51,8 @@
"v_4.4.1_210323": "47",
"v_4.4.2_210628": "48",
"v_4.5.0_220107": "49",
"v_4.5.1_230413": "50"
"v_4.5.1_230413": "50",
"v_4.5.2_230731": "51"
},
"versionDetailList": [
{
Expand Down Expand Up @@ -308,6 +309,11 @@
"version": "v_4.5.1_230413",
"title": "修复ssl的问题",
"log": "● 修复ssl的问题\n● 升级了weixin-java依赖\n"
},
{
"version": "v_4.5.2_230731",
"title": "UI细节调整,优化依赖和资源链接",
"log": "● UI细节调整\n● 优化了maven依赖\n● 调整了资源链接\n"
}
]
}
Binary file added assets/files/wx-zanshang.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<flatlaf.version>3.1.1</flatlaf.version>
<flatlaf-extras.version>3.1.1</flatlaf-extras.version>
<flatlaf-intellij-themes.version>3.1.1</flatlaf-intellij-themes.version>
<json-path.version>2.6.0</json-path.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -412,6 +413,18 @@
<version>${flatlaf-intellij-themes.version}</version>
</dependency>

<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>${json-path.version}</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>

</dependencies>

<build>
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,22 @@ public class UiConsts {
/**
* 软件版本检查url
*/
public final static String CHECK_VERSION_URL = "https://gitee.com/zhoubochina/WePush/raw/master/src/main/resources/version_summary.json";
public final static String CHECK_VERSION_URL = "https://gitee.com/zhoubochina/WePush/raw/5.x/assets/files/version_summary.json";

/**
* 用户案例url
*/
public final static String USER_CASE_URL = "http://download.zhoubochina.com/file/user_case.json";
public final static String USER_CASE_URL = "https://gitee.com/zhoubochina/WePush/raw/5.x/assets/files/user_case.json";

/**
* 二维码url
*/
public final static String QR_CODE_URL = "http://download.zhoubochina.com/file/wepush_qrcode.json";
public final static String QR_CODE_URL = "https://gitee.com/zhoubochina/WePush/raw/5.x/assets/files/wx-zanshang.jpg";

/**
* 介绍二维码URL
*/
public final static String INTRODUCE_QRCODE_URL = "http://download.zhoubochina.com/qrcode/introduce-wepush-qrcode.png";
public final static String INTRODUCE_QRCODE_URL = "https://gitee.com/zhoubochina/WePush/raw/5.x/assets/files/introduce-wepush-qrcode.png";

/**
* 多账号切换账号类型:公众号
Expand All @@ -115,4 +115,5 @@ public class UiConsts {
* 多账号切换账号类型:小程序
*/
public static final String WX_ACCOUNT_TYPE_MA = "ma";
public static final String DOWNLOAD_LINK_INFO_URL = "https://gitee.com/zhoubochina/WePush/raw/5.x/assets/files/download_links.json";
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.http.HttpUtil;
import com.fangxuele.tool.push.App;
import com.fangxuele.tool.push.ui.UiConsts;
import com.fangxuele.tool.push.util.ComponentUtil;
import com.fangxuele.tool.push.util.SystemUtil;
import com.formdev.flatlaf.util.SystemInfo;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
import org.apache.commons.lang3.StringUtils;

import javax.swing.*;
import java.awt.*;
Expand Down Expand Up @@ -88,7 +92,25 @@ public void downLoad(String newVersion) {
buttonOK.setEnabled(false);
ThreadUtil.execute(
() -> {
String fileUrl = "http://download.zhoubochina.com/exe/WePush-" + newVersion.replace("v_", "v") + "-x64-Setup.exe";
String fileUrl = "";
// 从github获取最新版本相关信息
String downloadLinkInfo = HttpUtil.get(UiConsts.DOWNLOAD_LINK_INFO_URL);
if (StringUtils.isEmpty(downloadLinkInfo) || downloadLinkInfo.contains("404: Not Found")) {
JOptionPane.showMessageDialog(App.mainFrame,
"获取下载链接失败,请关注Gitee Release!", "网络错误",
JOptionPane.INFORMATION_MESSAGE);
return;
} else {
DocumentContext parse = JsonPath.parse(downloadLinkInfo);
if (SystemUtil.isWindowsOs()) {
fileUrl = parse.read("$.windows");
} else if (SystemUtil.isMacOs()) {
fileUrl = parse.read("$.mac");
} else if (SystemUtil.isLinuxOs()) {
fileUrl = parse.read("$.linux");
}
}

String fileName = FileUtil.getName(fileUrl);
URL url;
try {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/fangxuele/tool/push/util/SystemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class SystemUtil {
*/
public final static String LOG_DIR = USER_HOME + File.separator + ".wepush" + File.separator + "logs" + File.separator;

public static boolean isWindowsOs() {
return OS_NAME.contains("Windows");
}
public static boolean isMacOs() {
return OS_NAME.contains("Mac");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static void smoothUpgrade() {
}

// 然后取两个版本对应的索引
String versionSummaryJsonContent = FileUtil.readString(UiConsts.class.getResource("/version_summary.json"), CharsetUtil.UTF_8);
String versionSummaryJsonContent = HttpUtil.get(UiConsts.CHECK_VERSION_URL);
versionSummaryJsonContent = versionSummaryJsonContent.replace("\n", "");
VersionSummary versionSummary = JSON.parseObject(versionSummaryJsonContent, VersionSummary.class);
String versionIndex = versionSummary.getVersionIndex();
Expand Down

0 comments on commit 27a60ea

Please sign in to comment.