fix(plugins): use class with correct fields for plugins list entry
This commit is contained in:
@@ -15,6 +15,7 @@ import jadx.cli.LogHelper;
|
||||
import jadx.core.utils.StringUtils;
|
||||
import jadx.plugins.tools.JadxPluginsList;
|
||||
import jadx.plugins.tools.JadxPluginsTools;
|
||||
import jadx.plugins.tools.data.JadxPluginListEntry;
|
||||
import jadx.plugins.tools.data.JadxPluginMetadata;
|
||||
import jadx.plugins.tools.data.JadxPluginUpdate;
|
||||
|
||||
@@ -116,9 +117,9 @@ public class CommandPlugins implements ICommand {
|
||||
return;
|
||||
}
|
||||
if (available) {
|
||||
List<JadxPluginMetadata> availableList = JadxPluginsList.getInstance().get();
|
||||
List<JadxPluginListEntry> availableList = JadxPluginsList.getInstance().get();
|
||||
System.out.println("Available plugins: " + availableList.size());
|
||||
for (JadxPluginMetadata plugin : availableList) {
|
||||
for (JadxPluginListEntry plugin : availableList) {
|
||||
System.out.println(" - " + plugin.getName() + ": " + plugin.getDescription()
|
||||
+ " (" + plugin.getLocationId() + ")");
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package jadx.gui.settings.ui.plugins;
|
||||
|
||||
import jadx.plugins.tools.data.JadxPluginMetadata;
|
||||
import jadx.plugins.tools.data.JadxPluginListEntry;
|
||||
|
||||
public class AvailablePluginNode extends BasePluginListNode {
|
||||
|
||||
private final JadxPluginMetadata metadata;
|
||||
private final JadxPluginListEntry metadata;
|
||||
|
||||
public AvailablePluginNode(JadxPluginMetadata metadata) {
|
||||
public AvailablePluginNode(JadxPluginListEntry metadata) {
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import jadx.core.utils.files.FileUtils;
|
||||
import jadx.plugins.tools.data.JadxPluginListCache;
|
||||
import jadx.plugins.tools.data.JadxPluginMetadata;
|
||||
import jadx.plugins.tools.data.JadxPluginListEntry;
|
||||
import jadx.plugins.tools.resolvers.github.GithubTools;
|
||||
import jadx.plugins.tools.resolvers.github.LocationInfo;
|
||||
import jadx.plugins.tools.resolvers.github.data.Asset;
|
||||
@@ -34,7 +34,7 @@ public class JadxPluginsList {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JadxPluginsList.class);
|
||||
private static final JadxPluginsList INSTANCE = new JadxPluginsList();
|
||||
|
||||
private static final Type LIST_TYPE = new TypeToken<List<JadxPluginMetadata>>() {
|
||||
private static final Type LIST_TYPE = new TypeToken<List<JadxPluginListEntry>>() {
|
||||
}.getType();
|
||||
|
||||
private static final Type CACHE_TYPE = new TypeToken<JadxPluginListCache>() {
|
||||
@@ -59,7 +59,7 @@ public class JadxPluginsList {
|
||||
* <br>
|
||||
* Method call is blocking.
|
||||
*/
|
||||
public synchronized void get(Consumer<List<JadxPluginMetadata>> consumer) {
|
||||
public synchronized void get(Consumer<List<JadxPluginListEntry>> consumer) {
|
||||
if (loadedList != null) {
|
||||
consumer.accept(loadedList.getList());
|
||||
return;
|
||||
@@ -78,8 +78,8 @@ public class JadxPluginsList {
|
||||
}
|
||||
}
|
||||
|
||||
public List<JadxPluginMetadata> get() {
|
||||
AtomicReference<List<JadxPluginMetadata>> holder = new AtomicReference<>();
|
||||
public List<JadxPluginListEntry> get() {
|
||||
AtomicReference<List<JadxPluginListEntry>> holder = new AtomicReference<>();
|
||||
get(holder::set);
|
||||
return holder.get();
|
||||
}
|
||||
@@ -135,9 +135,9 @@ public class JadxPluginsList {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<JadxPluginMetadata> loadListBundle(Path tmpListFile) {
|
||||
private static List<JadxPluginListEntry> loadListBundle(Path tmpListFile) {
|
||||
Gson gson = buildGson();
|
||||
List<JadxPluginMetadata> entries = new ArrayList<>();
|
||||
List<JadxPluginListEntry> entries = new ArrayList<>();
|
||||
new ZipReader().visitEntries(tmpListFile.toFile(), entry -> {
|
||||
if (entry.getName().endsWith(".json")) {
|
||||
try (Reader reader = new InputStreamReader(entry.getInputStream())) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
public class JadxPluginListCache {
|
||||
private String version;
|
||||
private List<JadxPluginMetadata> list;
|
||||
private List<JadxPluginListEntry> list;
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
@@ -14,11 +14,11 @@ public class JadxPluginListCache {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public List<JadxPluginMetadata> getList() {
|
||||
public List<JadxPluginListEntry> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<JadxPluginMetadata> list) {
|
||||
public void setList(List<JadxPluginListEntry> list) {
|
||||
this.list = list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package jadx.plugins.tools.data;
|
||||
|
||||
public class JadxPluginListEntry {
|
||||
private String pluginId;
|
||||
private String locationId;
|
||||
private String name;
|
||||
private String description;
|
||||
private String homepage;
|
||||
private int revision;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getHomepage() {
|
||||
return homepage;
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage) {
|
||||
this.homepage = homepage;
|
||||
}
|
||||
|
||||
public String getLocationId() {
|
||||
return locationId;
|
||||
}
|
||||
|
||||
public void setLocationId(String locationId) {
|
||||
this.locationId = locationId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPluginId() {
|
||||
return pluginId;
|
||||
}
|
||||
|
||||
public void setPluginId(String pluginId) {
|
||||
this.pluginId = pluginId;
|
||||
}
|
||||
|
||||
public int getRevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
public void setRevision(int revision) {
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JadxPluginListEntry{"
|
||||
+ "description='" + description + '\''
|
||||
+ ", pluginId='" + pluginId + '\''
|
||||
+ ", locationId='" + locationId + '\''
|
||||
+ ", name='" + name + '\''
|
||||
+ ", homepage='" + homepage + '\''
|
||||
+ ", revision=" + revision
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user