Skip to content

Native API for retrieving plugins#2037

Open
RohitKushvaha01 wants to merge 7 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:fetch_plugin_api
Open

Native API for retrieving plugins#2037
RohitKushvaha01 wants to merge 7 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:fetch_plugin_api

Conversation

@RohitKushvaha01
Copy link
Copy Markdown
Member

@RohitKushvaha01 RohitKushvaha01 commented Apr 16, 2026

Usage

const filter = {
  "type": "orderBy",
  "value": "top_rated",
  "nextPage": 1
}

const result = await cordova.exec(console.log, console.error, "Authenticator", "retrieveFilteredPlugins", [filter]);

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 16, 2026

Greptile Summary

This PR introduces a native Android API for fetching and filtering acode.app plugins from the existing Authenticator Cordova plugin. It adds PluginRetriever.java with two static methods — getAllPlugins for simple page-based retrieval and retrieveFilteredPlugins for client-side filtering by author, keywords, verified status, search text, or ordering — and wires them through two new execute action handlers in Authenticator.java.

Several P1 findings from prior review rounds (unbounded fetch loop, missing pagination state in the buffered path response, /plugin URL typo for non-top_rated orderBy, and unencoded orderBy value in the query string) remain unaddressed and continue to affect core functionality.

Confidence Score: 3/5

Not safe to merge — multiple prior P1 findings remain unresolved, leaving the buffered filter path unable to paginate and the non-top_rated orderBy path returning empty results.

The orderBy path for values other than top_rated always hits a 404 (the /plugin vs /plugins typo), the buffered filter path never returns filterState so pagination is impossible after the first call, an unbounded HTTP loop can exhaust the thread pool on restrictive filters, and the orderBy value is interpolated directly into the URL without encoding. These are all P1 issues raised in previous review rounds that have not been addressed.

src/plugins/auth/src/android/PluginRetriever.java requires the most attention — all unresolved P1 findings are concentrated there.

Important Files Changed

Filename Overview
src/plugins/auth/src/android/PluginRetriever.java New file implementing plugin retrieval; contains previously flagged unresolved issues: missing filterState return in the buffered filter path, /plugin URL typo for non-top_rated orderBy, unbounded page-fetch loop, and unencoded value in URL query strings.
src/plugins/auth/src/android/Authenticator.java Adds getAllPlugins and retrieveFilteredPlugins action handlers; getAllPlugins accesses args.getInt(0) inside the background-thread lambda without a pre-flight length check, while retrieveFilteredPlugins consistently pre-parses args on the calling thread. Both dispatch to the thread pool correctly and catch errors.
src/plugins/auth/plugin.xml Registers the new PluginRetriever.java source file with the Cordova build; change is correct and minimal.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[JS Caller] -->|getAllPlugins / retrieveFilteredPlugins| B[Authenticator.java]
    B --> C[ThreadPool]
    C --> D[PluginRetriever.java]
    D --> E{filter type}
    E -->|orderBy top_rated| F[GET /plugins explore=random]
    E -->|orderBy other| G[GET /plugin orderBy=value]
    E -->|author / keywords / verified / search| H[Loop: GET /plugins paginated]
    F --> I[Return items + hasMore + filterState]
    G --> J[Return empty - 404 from URL typo]
    H --> K[matchesFilter each plugin]
    K --> L[Return items + hasMore only - filterState missing]
Loading

Reviews (3): Last reviewed commit: "feat: add filterstate" | Re-trigger Greptile

Comment thread src/plugins/auth/src/android/PluginRetriever.java Outdated
Comment thread src/plugins/auth/src/android/PluginRetriever.java
Comment thread src/plugins/auth/src/android/PluginRetriever.java
Comment thread src/plugins/auth/src/android/PluginRetriever.java
Comment thread src/plugins/auth/src/android/PluginRetriever.java Outdated
@RohitKushvaha01
Copy link
Copy Markdown
Member Author

@greptileai

Comment thread src/plugins/auth/src/android/PluginRetriever.java
@RohitKushvaha01
Copy link
Copy Markdown
Member Author

@greptileai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant