Browse Source

Pull request #4860: REPORT-54817 内网环境下该迭代功能应当不生效

Merge in DESIGN/design from ~LANLAN/design:release/10.0 to release/10.0

* commit 'da9c757c29a2c584316bc307cb9b88f543631a54':
  REPORT-54817 内网环境下该迭代功能应当不生效
zheng-1641779399395
Lanlan 4 years ago
parent
commit
56a63094ac
  1. 4
      designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java
  2. 6
      designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java
  3. 3
      designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java
  4. 19
      designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java

4
designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java

@ -20,6 +20,10 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
String url = getJumpUrl(); String url = getJumpUrl();
if (!DesignerLoginUtils.isOnline()) {
BrowseUtils.browser(url);
return;
}
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
int uid = manager.getDesignerLoginUid(); int uid = manager.getDesignerLoginUid();
if (uid > 0) { if (uid > 0) {

6
designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java

@ -4,9 +4,13 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.update.push.DesignerPushUpdateManager; import com.fr.design.update.push.DesignerPushUpdateManager;
import com.fr.general.CloudCenter;
import com.fr.general.CloudCenterConfig;
import com.fr.general.http.HttpToolbox;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
@ -35,7 +39,7 @@ public class DesignerGuideHelper {
public static void prepareShowGuideDialog() { public static void prepareShowGuideDialog() {
// 如果存在更新升级的弹窗,则不显示引导页面 // 如果存在更新升级的弹窗,则不显示引导页面
if (!SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) { if (!DesignerLoginUtils.isOnline() || !SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) {
return; return;
} }
if (isActivatedForOneWeek()) { if (isActivatedForOneWeek()) {

3
designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java

@ -51,6 +51,9 @@ public class DesignerMessageHelper {
} }
public void prepareShowMessage() { public void prepareShowMessage() {
if (!DesignerLoginUtils.isOnline()) {
return;
}
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() {
@Override @Override
public void designerOpened() { public void designerOpened() {

19
designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java

@ -3,10 +3,13 @@ package com.fr.design.login.utils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil; import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.CloudCenterConfig;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.http.HttpToolbox;
import com.fr.general.log.MessageFormatter; import com.fr.general.log.MessageFormatter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.org.bouncycastle.util.encoders.Hex; import com.fr.third.org.bouncycastle.util.encoders.Hex;
import java.awt.Window; import java.awt.Window;
import java.security.SecureRandom; import java.security.SecureRandom;
@ -49,6 +52,9 @@ public class DesignerLoginUtils {
} }
public static String generateDesignerSSOUrl(String referrer) { public static String generateDesignerSSOUrl(String referrer) {
if (!DesignerLoginUtils.isOnline()) {
return referrer;
}
String ssoTemplate = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}"); String ssoTemplate = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}");
try { try {
String code = generateLoginCode(); String code = generateLoginCode();
@ -60,6 +66,19 @@ public class DesignerLoginUtils {
return referrer; return referrer;
} }
public static boolean isOnline() {
if (CloudCenterConfig.getInstance().isOnline()) {
String ping = CloudCenter.getInstance().acquireConf("ping", StringUtils.EMPTY);
if (StringUtils.isNotEmpty(ping)) {
try {
return StringUtils.isEmpty(HttpToolbox.get(ping));
} catch (Exception ignore) {
}
}
}
return false;
}
private static String generateLoginCode() throws Exception { private static String generateLoginCode() throws Exception {
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
JSONObject jo = JSONObject.create(); JSONObject jo = JSONObject.create();

Loading…
Cancel
Save