diff --git a/Q-Apps.md b/Q-Apps.md index a51818ed..d2196d44 100644 --- a/Q-Apps.md +++ b/Q-Apps.md @@ -299,7 +299,8 @@ let res = await qortalRequest({ let res = await qortalRequest({ action: "LIST_QDN_RESOURCES", service: "THUMBNAIL", - identifier: "qortal_avatar", // Optional + name: "QortalDemo", // Optional (exact match) + identifier: "qortal_avatar", // Optional (exact match) default: true, // Optional includeStatus: false, // Optional - will take time to respond, so only request if necessary includeMetadata: false, // Optional - will take time to respond, so only request if necessary diff --git a/src/main/java/org/qortal/api/resource/ArbitraryResource.java b/src/main/java/org/qortal/api/resource/ArbitraryResource.java index 8dbf467d..062419fa 100644 --- a/src/main/java/org/qortal/api/resource/ArbitraryResource.java +++ b/src/main/java/org/qortal/api/resource/ArbitraryResource.java @@ -96,6 +96,7 @@ public class ArbitraryResource { @ApiErrors({ApiError.REPOSITORY_ISSUE}) public List getResources( @QueryParam("service") Service service, + @QueryParam("name") String name, @QueryParam("identifier") String identifier, @Parameter(description = "Default resources (without identifiers) only") @QueryParam("default") Boolean defaultResource, @Parameter(ref = "limit") @QueryParam("limit") Integer limit, @@ -118,9 +119,14 @@ public class ArbitraryResource { throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "identifier cannot be specified when requesting a default resource"); } - // Load filter from list if needed + // Set up name filters if supplied List names = null; - if (nameFilter != null) { + if (name != null) { + // Filter using single name + names = Arrays.asList(name); + } + else if (nameFilter != null) { + // Filter using supplied list of names names = ResourceListManager.getInstance().getStringsInList(nameFilter); if (names.isEmpty()) { // List doesn't exist or is empty - so there will be no matches diff --git a/src/main/resources/q-apps/q-apps.js b/src/main/resources/q-apps/q-apps.js index 7a5df87f..9948dd9e 100644 --- a/src/main/resources/q-apps/q-apps.js +++ b/src/main/resources/q-apps/q-apps.js @@ -166,6 +166,7 @@ window.addEventListener("message", (event) => { case "LIST_QDN_RESOURCES": url = "/arbitrary/resources?"; if (data.service != null) url = url.concat("&service=" + data.service); + if (data.name != null) url = url.concat("&name=" + data.name); if (data.identifier != null) url = url.concat("&identifier=" + data.identifier); if (data.default != null) url = url.concat("&default=" + new Boolean(data.default).toString()); if (data.includeStatus != null) url = url.concat("&includestatus=" + new Boolean(data.includeStatus).toString());