Skip to content

Commit

Permalink
Merge pull request #259 from rememberber/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rememberber authored Feb 21, 2021
2 parents 696b477 + 3ee3c95 commit 8ffb8e5
Show file tree
Hide file tree
Showing 28 changed files with 315 additions and 134 deletions.
3 changes: 3 additions & 0 deletions download.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<details>
<summary>Windows</summary>

[WePush-v4.4.0_210221-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.4.0_210221-x64-Setup.exe)
[WePush-v4.3.0_210123-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.3.0_210123-x64-Setup.exe)
[WePush-v4.2.5_210117-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.5_210117-x64-Setup.exe)
[WePush-v4.2.4_201222-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.4_201222-x64-Setup.exe)
Expand Down Expand Up @@ -80,6 +81,7 @@
<details>
<summary>Mac OS</summary>

[v_4.4.0_210221.app](http://download.zhoubochina.com/mac/4.4.0.zip)
[v_4.3.0_210123.app](http://download.zhoubochina.com/mac/4.3.0.zip)
[v_4.2.5_210117.app](http://download.zhoubochina.com/mac/4.2.5.zip)
[v_4.2.4_201222.app](http://download.zhoubochina.com/mac/4.2.4.zip)
Expand Down Expand Up @@ -137,6 +139,7 @@
<details>
<summary>Portable(各系统通用绿色便携版32/64位)</summary>

[v4.4.0_210221](http://download.zhoubochina.com/linux/WePush-4.4.0.zip)
[v4.3.0_210123](http://download.zhoubochina.com/linux/WePush-4.3.0.zip)
[v4.2.5_210117](http://download.zhoubochina.com/linux/WePush-4.2.5.zip)
[v4.2.4_201222](http://download.zhoubochina.com/linux/WePush-4.2.4.zip)
Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<aliyun-java-sdk-dysmsapi.version>1.1.0</aliyun-java-sdk-dysmsapi.version>
<bce-java-sdk.version>0.10.134</bce-java-sdk.version>
<qiniu-java-sdk.version>7.3.0</qiniu-java-sdk.version>
<flatlaf.version>1.0-rc1</flatlaf.version>
<flatlaf.version>1.0</flatlaf.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -387,6 +387,10 @@
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>hbase-client</artifactId>
<groupId>org.apache.hbase</groupId>
</exclusion>
</exclusions>
</dependency>

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/fangxuele/tool/push/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public static void main(String[] args) {
mainFrame.init();
JPanel loadingPanel = new LoadingForm().getLoadingPanel();
mainFrame.add(loadingPanel);
mainFrame.pack();
mainFrame.setVisible(true);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
if (screenSize.getWidth() <= 1366) {
if (config.isDefaultMaxWindow() || screenSize.getWidth() <= 1366) {
// 低分辨率下自动最大化窗口
mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
mainFrame.pack();
mainFrame.setVisible(true);
UpgradeUtil.smoothUpgrade();

mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
Expand All @@ -56,7 +56,7 @@ public static void main(String[] args) {
Init.initOthers();
mainFrame.addListeners();
mainFrame.remove(loadingPanel);
Init.initFontSize();
Init.fontSizeGuide();
Init.initTray();
}
}
4 changes: 3 additions & 1 deletion src/main/java/com/fangxuele/tool/push/bean/MailMsg.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import lombok.Setter;
import lombok.ToString;

import java.io.File;
import java.io.Serializable;
import java.util.List;

/**
* <pre>
Expand Down Expand Up @@ -34,7 +36,7 @@ public class MailMsg implements Serializable {
/**
* 附件
*/
private String mailFiles;
private List<File> mailFiles;

/**
* 内容
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/fangxuele/tool/push/logic/PushControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static void savePushData() throws IOException {
PushData.toSendList = new ArrayList<>(PushData.toSendConcurrentLinkedQueue);
}
MessageEditForm messageEditForm = MessageEditForm.getInstance();
File pushHisDir = new File(SystemUtil.configHome + "data" + File.separator + "push_his");
File pushHisDir = new File(SystemUtil.CONFIG_HOME + "data" + File.separator + "push_his");
if (!pushHisDir.exists()) {
boolean mkdirs = pushHisDir.mkdirs();
}
Expand All @@ -295,7 +295,7 @@ static void savePushData() throws IOException {
List<File> fileList = new ArrayList<>();
// 保存已发送
if (PushData.sendSuccessList.size() > 0) {
File sendSuccessFile = new File(SystemUtil.configHome + "data" +
File sendSuccessFile = new File(SystemUtil.CONFIG_HOME + "data" +
File.separator + "push_his" + File.separator + MessageTypeEnum.getName(msgType) + "-" + msgName +
"-发送成功-" + nowTime + ".csv");
FileUtil.touch(sendSuccessFile);
Expand Down Expand Up @@ -334,7 +334,7 @@ static void savePushData() throws IOException {
}

if (PushData.toSendList.size() > 0) {
File unSendFile = new File(SystemUtil.configHome + "data" + File.separator +
File unSendFile = new File(SystemUtil.CONFIG_HOME + "data" + File.separator +
"push_his" + File.separator + MessageTypeEnum.getName(msgType) + "-" + msgName + "-未发送-" + nowTime +
".csv");
FileUtil.touch(unSendFile);
Expand All @@ -350,7 +350,7 @@ static void savePushData() throws IOException {

// 保存发送失败
if (PushData.sendFailList.size() > 0) {
File failSendFile = new File(SystemUtil.configHome + "data" + File.separator +
File failSendFile = new File(SystemUtil.CONFIG_HOME + "data" + File.separator +
"push_his" + File.separator + MessageTypeEnum.getName(msgType) + "-" + msgName + "-发送失败-" + nowTime + ".csv");
FileUtil.touch(failSendFile);
writer = new CSVWriter(new FileWriter(failSendFile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import com.fangxuele.tool.push.util.TemplateUtil;
import org.apache.velocity.VelocityContext;

import java.io.File;
import java.util.List;

/**
* <pre>
* E-Mail加工器
Expand All @@ -17,7 +20,7 @@ public class MailMsgMaker extends BaseMsgMaker implements IMsgMaker {

public static String mailTitle;
public static String mailCc;
public static String mailFiles;
public static List<File> mailFiles;
public static String mailContent;

/**
Expand All @@ -27,7 +30,7 @@ public class MailMsgMaker extends BaseMsgMaker implements IMsgMaker {
public void prepare() {
mailTitle = MailMsgForm.getInstance().getMailTitleTextField().getText();
mailCc = MailMsgForm.getInstance().getMailCcTextField().getText();
mailFiles = MailMsgForm.getInstance().getMailFilesTextField().getText();
mailFiles = MailMsgForm.getInstance().getAttachmentFiles();
mailContent = MailMsgForm.getInstance().getMailContentPane().getText();
}

Expand All @@ -43,11 +46,10 @@ public MailMsg makeMsg(String[] msgData) {
VelocityContext velocityContext = getVelocityContext(msgData);
String title = TemplateUtil.evaluate(mailTitle, velocityContext);
String cc = TemplateUtil.evaluate(mailCc, velocityContext);
String files = TemplateUtil.evaluate(mailFiles, velocityContext);
String content = TemplateUtil.evaluate(mailContent, velocityContext);
mailMsg.setMailTitle(title);
mailMsg.setMailCc(cc);
mailMsg.setMailFiles(files);
mailMsg.setMailFiles(mailFiles);
mailMsg.setMailContent(content);
return mailMsg;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.fangxuele.tool.push.logic.msgsender;

import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;
import com.fangxuele.tool.push.App;
import com.fangxuele.tool.push.bean.MailMsg;
import com.fangxuele.tool.push.logic.PushControl;
import com.fangxuele.tool.push.logic.msgmaker.MailMsgMaker;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
Expand Down Expand Up @@ -52,10 +52,10 @@ public SendResult send(String[] msgData) {
ccList = Lists.newArrayList();
ccList.add(mailMsg.getMailCc());
}
if (StringUtils.isEmpty(mailMsg.getMailFiles())) {
if (CollectionUtils.isEmpty(mailMsg.getMailFiles())) {
MailUtil.send(mailAccount, tos, ccList, null, mailMsg.getMailTitle(), mailMsg.getMailContent(), true);
} else {
MailUtil.send(mailAccount, tos, ccList, null, mailMsg.getMailTitle(), mailMsg.getMailContent(), true, FileUtil.file(mailMsg.getMailFiles()));
MailUtil.send(mailAccount, tos, ccList, null, mailMsg.getMailTitle(), mailMsg.getMailContent(), true, mailMsg.getMailFiles().toArray(new File[0]));
}
sendResult.setSuccess(true);
}
Expand Down
48 changes: 41 additions & 7 deletions src/main/java/com/fangxuele/tool/push/ui/Init.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.fangxuele.tool.push.ui.form.PushHisForm;
import com.fangxuele.tool.push.ui.form.ScheduleForm;
import com.fangxuele.tool.push.ui.form.SettingForm;
import com.fangxuele.tool.push.ui.form.UserCaseForm;
import com.fangxuele.tool.push.ui.listener.AboutListener;
import com.fangxuele.tool.push.util.SystemUtil;
import com.fangxuele.tool.push.util.UIUtil;
Expand Down Expand Up @@ -53,7 +52,7 @@ public class Init {
/**
* 字号初始化KEY
*/
private static final String FONT_SIZE_INIT_PROP = "fontSizeInit";
public static final String FONT_SIZE_INIT_PROP = "fontSizeInit";

/**
* 设置全局字体
Expand All @@ -74,6 +73,7 @@ public static void initGlobalFont() {
fontSize = (int) (UIUtil.getScreenScale() * fontSize);
}
App.config.setFontSize(fontSize);
App.config.save();
}

Font font = new Font(App.config.getFont(), Font.PLAIN, App.config.getFontSize());
Expand All @@ -100,7 +100,7 @@ public static void initOthers() {
* 初始化look and feel
*/
public static void initTheme() {
if (SystemUtil.isMacM1()) {
if (SystemUtil.isMacM1() || SystemUtil.isLinuxOs()) {
try {
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
logger.warn("FlatDarculaLaf theme set.");
Expand All @@ -125,35 +125,69 @@ public static void initTheme() {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
break;
case "weblaf":
case "Darcula(推荐)":
case "Darcula":
JFrame.setDefaultLookAndFeelDecorated(false);
JDialog.setDefaultLookAndFeelDecorated(false);
UIManager.setLookAndFeel("com.bulenkov.darcula.DarculaLaf");
break;
case "Flat Light":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
FlatLightLaf.install();
break;
case "Flat IntelliJ":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatIntelliJLaf");
break;
case "Flat Dark":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarkLaf");
break;
case "Flat Darcula":
case "Flat Darcula(推荐)":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
break;
case "Dark purple":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
IntelliJTheme.install(App.class.getResourceAsStream(
"/theme/DarkPurple.theme.json"));
break;
case "IntelliJ Cyan":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
IntelliJTheme.install(App.class.getResourceAsStream(
"/theme/Cyan.theme.json"));
break;
case "IntelliJ Light":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
IntelliJTheme.install(App.class.getResourceAsStream(
"/theme/Light.theme.json"));
break;

default:
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
}
} catch (Exception e) {
Expand All @@ -168,7 +202,7 @@ public static void initAllTab() {
ThreadUtil.execute(AboutForm::init);
MessageTypeForm.init();
ThreadUtil.execute(HelpForm::init);
ThreadUtil.execute(UserCaseForm::init);
// ThreadUtil.execute(UserCaseForm::init);
ThreadUtil.execute(() -> MessageEditForm.init(null));
ThreadUtil.execute(MessageManageForm::init);
ThreadUtil.execute(MemberForm::init);
Expand All @@ -191,7 +225,7 @@ public static void initAllTab() {
/**
* 引导用户调整字号
*/
public static void initFontSize() {
public static void fontSizeGuide() {
if (StringUtils.isEmpty(App.config.getProps(FONT_SIZE_INIT_PROP))) {
FontSizeAdjustDialog fontSizeAdjustDialog = new FontSizeAdjustDialog();
fontSizeAdjustDialog.pack();
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class UiConsts {
* 软件名称,版本
*/
public final static String APP_NAME = "WePush";
public final static String APP_VERSION = "v_4.3.0_210123";
public final static String APP_VERSION = "v_4.4.0_210221";

/**
* Logo-1024*1024
Expand Down Expand Up @@ -104,11 +104,6 @@ public class UiConsts {
*/
public final static String INTRODUCE_QRCODE_URL = "http://download.zhoubochina.com/qrcode/introduce-wepush-qrcode.png";

/**
* 日志文件路径
*/
public final static String LOG_DIR = "./logs/";

/**
* 多账号切换账号类型:公众号
*/
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/com/fangxuele/tool/push/ui/form/MainWindow.form
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,6 @@
<border type="none"/>
<children/>
</grid>
<grid id="eb537" binding="userCasePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="10" right="0"/>
<constraints>
<tabbedpane title="他们都在用"/>
</constraints>
<properties>
<minimumSize width="-1" height="-1"/>
</properties>
<border type="none"/>
<children/>
</grid>
</children>
</tabbedpane>
</children>
Expand Down
Loading

0 comments on commit 8ffb8e5

Please sign in to comment.