Browse Source

INO-12903 外网权限细粒度控制-更新升级+插件管理+图表资源 控制

feature/x
zack 3 years ago
parent
commit
641290016a
  1. 11
      designer-base/src/main/java/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java
  2. 13
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  3. 28
      designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java

11
designer-base/src/main/java/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java

@ -1,15 +1,21 @@
package com.fr.design.extra.exe;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginsReaderFromStore;
import com.fr.design.extra.Process;
import com.fr.design.i18n.Toolkit;
import com.fr.general.SiteBlockedException;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import java.util.List;
import static com.fr.design.dialog.FineJOptionPane.OPTION_OK_CANCEL;
/**
* Created by vito on 16/4/19.
*/
@ -41,6 +47,11 @@ public class ReadUpdateOnlineExecutor implements Executor {
jsonArray.put(jsonObject);
}
result = jsonArray.toString();
} catch (SiteBlockedException e1) {
FineJOptionPane.showConfirmDialog(null,
e1.getMessage(),
Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.DEFAULT_OPTION,
FineJOptionPane.WARNING_MESSAGE, null, OPTION_OK_CANCEL, null);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

13
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -56,6 +56,7 @@ import java.util.*;
import java.util.List;
import java.util.concurrent.ExecutionException;
import static com.fr.design.dialog.FineJOptionPane.OPTION_OK_CANCEL;
import static java.nio.charset.StandardCharsets.*;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
@ -350,7 +351,17 @@ public class UpdateMainDialog extends UIDialog {
new SwingWorker<JSONObject, Void>() {
@Override
protected JSONObject doInBackground() throws Exception {
return new JSONObject(HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar11.update")));
try {
String url = CloudCenter.getInstance().acquireUrlByKind("jar11.update");
return new JSONObject(HttpToolbox.get(url));
} catch (SiteBlockedException e) {
stopLoading();
FineJOptionPane.showConfirmDialog(null,
e.getMessage(),
Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.DEFAULT_OPTION,
FineJOptionPane.WARNING_MESSAGE, null, OPTION_OK_CANCEL, null);
}
return null;
}
@Override

28
designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java

@ -5,9 +5,11 @@ import com.fr.design.RestartHelper;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import com.fr.general.SiteBlockedException;
import com.fr.general.http.HttpClient;
import com.fr.plugin.chart.DownloadSourcesEvent;
import com.fr.stable.CommonUtils;
@ -33,6 +35,8 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import static com.fr.design.dialog.FineJOptionPane.OPTION_OK_CANCEL;
/**
* Created by shine on 2017/8/21.
*/
@ -69,7 +73,15 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
//本地有这个资源,不下载
return;
}
httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteKind));
try {
httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteKind));
} catch (SiteBlockedException e) {
FineJOptionPane.showConfirmDialog(null,
e.getMessage(),
Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.DEFAULT_OPTION,
FineJOptionPane.WARNING_MESSAGE, null, OPTION_OK_CANCEL, null);
return;
}
if (httpClient.getResponseCode() != HttpURLConnection.HTTP_OK) {
//服务器连不上,不下载
return;
@ -116,12 +128,22 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
private void downloadAndInstallPluginDependenceFile() {
try {
double currentBytesRead = 0;
result = false;
for (int i = 0; i < list.size(); i++) {
SiteInfo siteInfo = list.get(i);
httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteInfo.siteKind));
try {
httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteInfo.siteKind));
} catch (SiteBlockedException e) {
FineJOptionPane.showConfirmDialog(null,
e.getMessage(),
Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.DEFAULT_OPTION,
FineJOptionPane.WARNING_MESSAGE, null, OPTION_OK_CANCEL, null);
result = false;
return;
}
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
result = true;
String temp = StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE);
File file = new File(temp);
StableUtils.makesureFileExist(file);

Loading…
Cancel
Save