|
|
@ -1,11 +1,14 @@ |
|
|
|
package com.fr.design.extra; |
|
|
|
package com.fr.design.extra; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.extra.exe.callback.*; |
|
|
|
import com.fr.design.extra.exe.callback.*; |
|
|
|
import com.fr.design.extra.exe.extratask.InstallPluginTask; |
|
|
|
import com.fr.design.extra.exe.extratask.InstallPluginTask; |
|
|
|
import com.fr.design.extra.exe.extratask.UpdatePluginTask; |
|
|
|
import com.fr.design.extra.exe.extratask.UpdatePluginTask; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
|
|
|
|
import com.fr.general.SiteCenter; |
|
|
|
|
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.plugin.context.PluginContext; |
|
|
|
import com.fr.plugin.context.PluginContext; |
|
|
|
import com.fr.plugin.context.PluginMarker; |
|
|
|
import com.fr.plugin.context.PluginMarker; |
|
|
@ -17,6 +20,7 @@ import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import javafx.scene.web.WebEngine; |
|
|
|
import javafx.scene.web.WebEngine; |
|
|
|
import netscape.javascript.JSObject; |
|
|
|
import netscape.javascript.JSObject; |
|
|
|
|
|
|
|
import org.json.JSONArray; |
|
|
|
import sun.plugin2.main.server.Plugin; |
|
|
|
import sun.plugin2.main.server.Plugin; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
@ -96,6 +100,83 @@ public class PluginOperateUtils { |
|
|
|
PluginManager.getController().uninstall(pluginMarker, isForce, new UnistallPluginCallback()); |
|
|
|
PluginManager.getController().uninstall(pluginMarker, isForce, new UnistallPluginCallback()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void readUpdateOnline(JSCallback jsCallback){ |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
String [] plugins = PluginReaderForDesigner.readPluginsForUpdate(); |
|
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray(); |
|
|
|
|
|
|
|
for (String plugin : plugins) { |
|
|
|
|
|
|
|
org.json.JSONObject jsonObject = new org.json.JSONObject(); |
|
|
|
|
|
|
|
jsonObject.put("pluginid", plugin); |
|
|
|
|
|
|
|
jsonArray.put(jsonObject); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String result = jsonArray.toString(); |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void searchPlugin(String keyword, JSCallback jsCallback) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.plist") + "&keyword=" + keyword); |
|
|
|
|
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void getPluginFromStore(String category, String seller, String fee, JSCallback jsCallback){ |
|
|
|
|
|
|
|
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist"); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(plistUrl)) { |
|
|
|
|
|
|
|
StringBuilder url = new StringBuilder(); |
|
|
|
|
|
|
|
url.append(plistUrl); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(category)) { |
|
|
|
|
|
|
|
url.append("&cid=").append(category.split("-")[1]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(seller)) { |
|
|
|
|
|
|
|
url.append("&seller=").append(seller.split("-")[1]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(fee)) { |
|
|
|
|
|
|
|
url.append("&fee=").append(fee.split("-")[1]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HttpClient httpClient = new HttpClient(url.toString()); |
|
|
|
|
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String result = PluginConstants.CONNECTION_404; |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void getPluginCategories(JSCallback jsCallback){ |
|
|
|
|
|
|
|
String result; |
|
|
|
|
|
|
|
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category"); |
|
|
|
|
|
|
|
if (url != null) { |
|
|
|
|
|
|
|
HttpClient httpClient = new HttpClient(url); |
|
|
|
|
|
|
|
result = httpClient.getResponseText(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
result = PluginConstants.CONNECTION_404; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void getLoginInfo(JSCallback jsCallback){ |
|
|
|
|
|
|
|
String username = BBSPluginLogin.getInstance().getUserInfo().getUserName(); |
|
|
|
|
|
|
|
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName(); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
String result = StringUtils.isEmpty(inShowUsername) ? username : inShowUsername; |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static String[] jsObjectToStringArray(JSObject obj) { |
|
|
|
private static String[] jsObjectToStringArray(JSObject obj) { |
|
|
|
if (obj == null) { |
|
|
|
if (obj == null) { |
|
|
|
return ArrayUtils.EMPTY_STRING_ARRAY; |
|
|
|
return ArrayUtils.EMPTY_STRING_ARRAY; |
|
|
|