|
|
@ -16,14 +16,11 @@ import com.fr.plugin.manage.PluginManager; |
|
|
|
import com.fr.plugin.manage.bbs.BBSPluginLogin; |
|
|
|
import com.fr.plugin.manage.bbs.BBSPluginLogin; |
|
|
|
import com.fr.plugin.manage.control.PluginTaskCallback; |
|
|
|
import com.fr.plugin.manage.control.PluginTaskCallback; |
|
|
|
import com.fr.plugin.view.PluginView; |
|
|
|
import com.fr.plugin.view.PluginView; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import netscape.javascript.JSObject; |
|
|
|
|
|
|
|
import org.json.JSONArray; |
|
|
|
import org.json.JSONArray; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -79,7 +76,7 @@ public class PluginOperateUtils { |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
PluginContext plugin = PluginManager.getContext(pluginMarker); |
|
|
|
PluginContext plugin = PluginManager.getContext(pluginMarker); |
|
|
|
boolean active = plugin.isActive(); |
|
|
|
boolean active = plugin.isActive(); |
|
|
|
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active); |
|
|
|
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); |
|
|
|
if (active) { |
|
|
|
if (active) { |
|
|
|
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); |
|
|
|
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -89,7 +86,7 @@ public class PluginOperateUtils { |
|
|
|
|
|
|
|
|
|
|
|
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, JSCallback jsCallback) { |
|
|
|
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, JSCallback jsCallback) { |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
PluginManager.getController().uninstall(pluginMarker, isForce, new UnistallPluginCallback()); |
|
|
|
PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(jsCallback)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void readUpdateOnline(JSCallback jsCallback) { |
|
|
|
public static void readUpdateOnline(JSCallback jsCallback) { |
|
|
@ -120,30 +117,36 @@ public class PluginOperateUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void getPluginFromStore(String category, String seller, String fee, JSCallback jsCallback) { |
|
|
|
public static void getPluginFromStore(String category, String seller, String fee, JSCallback jsCallback) { |
|
|
|
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist"); |
|
|
|
new Thread(new Runnable() { |
|
|
|
if (StringUtils.isNotBlank(plistUrl)) { |
|
|
|
@Override |
|
|
|
StringBuilder url = new StringBuilder(); |
|
|
|
public void run() { |
|
|
|
url.append(plistUrl); |
|
|
|
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist"); |
|
|
|
if (StringUtils.isNotBlank(category)) { |
|
|
|
if (StringUtils.isNotBlank(plistUrl)) { |
|
|
|
url.append("&cid=").append(category.split("-")[1]); |
|
|
|
StringBuilder url = new StringBuilder(); |
|
|
|
} |
|
|
|
url.append(plistUrl); |
|
|
|
if (StringUtils.isNotBlank(seller)) { |
|
|
|
if (StringUtils.isNotBlank(category)) { |
|
|
|
url.append("&seller=").append(seller.split("-")[1]); |
|
|
|
url.append("&cid=").append(category.split("-")[1]); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(fee)) { |
|
|
|
if (StringUtils.isNotBlank(seller)) { |
|
|
|
url.append("&fee=").append(fee.split("-")[1]); |
|
|
|
url.append("&seller=").append(seller.split("-")[1]); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
if (StringUtils.isNotBlank(fee)) { |
|
|
|
HttpClient httpClient = new HttpClient(url.toString()); |
|
|
|
url.append("&fee=").append(fee.split("-")[1]); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
} |
|
|
|
jsCallback.execute(result); |
|
|
|
try { |
|
|
|
} catch (Exception e) { |
|
|
|
HttpClient httpClient = new HttpClient(url.toString()); |
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String result = PluginConstants.CONNECTION_404; |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
}).start(); |
|
|
|
String result = PluginConstants.CONNECTION_404; |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void getPluginCategories(JSCallback jsCallback) { |
|
|
|
public static void getPluginCategories(JSCallback jsCallback) { |
|
|
@ -176,4 +179,4 @@ public class PluginOperateUtils { |
|
|
|
&& StringUtils.isNotEmpty(pluginView.getEnvVersion()); |
|
|
|
&& StringUtils.isNotEmpty(pluginView.getEnvVersion()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|