mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Fix configuration for marketplace-services (#3357)
Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
+2
-1
@@ -137,7 +137,8 @@ public class JsonAddonService extends AbstractRemoteAddonService {
|
||||
|
||||
@Override
|
||||
public @Nullable Addon getAddon(String id, @Nullable Locale locale) {
|
||||
return cachedAddons.stream().filter(e -> id.equals(e.getUid())).findAny().orElse(null);
|
||||
String queryId = id.startsWith(ADDON_ID_PREFIX) ? id : ADDON_ID_PREFIX + id;
|
||||
return cachedAddons.stream().filter(e -> queryId.equals(e.getUid())).findAny().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+20
-2
@@ -301,7 +301,16 @@ public class AddonResource implements RESTResource {
|
||||
public Response getConfiguration(final @PathParam("addonId") @Parameter(description = "addon ID") String addonId,
|
||||
@QueryParam("serviceId") @Parameter(description = "service ID") @Nullable String serviceId) {
|
||||
try {
|
||||
AddonInfo addonInfo = addonInfoRegistry.getAddonInfo(addonId);
|
||||
AddonService addonService = (serviceId != null) ? getServiceById(serviceId) : getDefaultService();
|
||||
if (addonService == null) {
|
||||
return Response.status(Status.NOT_FOUND).build();
|
||||
}
|
||||
Addon addon = addonService.getAddon(addonId, null);
|
||||
if (addon == null) {
|
||||
return Response.status(Status.NOT_FOUND).build();
|
||||
}
|
||||
String infoUid = addon.getType() + "-" + addon.getId();
|
||||
AddonInfo addonInfo = addonInfoRegistry.getAddonInfo(infoUid);
|
||||
if (addonInfo == null) {
|
||||
return Response.status(Status.NOT_FOUND).build();
|
||||
}
|
||||
@@ -327,7 +336,16 @@ public class AddonResource implements RESTResource {
|
||||
@QueryParam("serviceId") @Parameter(description = "service ID") @Nullable String serviceId,
|
||||
@Nullable Map<String, Object> configuration) {
|
||||
try {
|
||||
AddonInfo addonInfo = addonInfoRegistry.getAddonInfo(addonId);
|
||||
AddonService addonService = (serviceId != null) ? getServiceById(serviceId) : getDefaultService();
|
||||
if (addonService == null) {
|
||||
return Response.status(Status.NOT_FOUND).build();
|
||||
}
|
||||
Addon addon = addonService.getAddon(addonId, null);
|
||||
if (addon == null) {
|
||||
return Response.status(Status.NOT_FOUND).build();
|
||||
}
|
||||
String infoUid = addon.getType() + "-" + addon.getId();
|
||||
AddonInfo addonInfo = addonInfoRegistry.getAddonInfo(infoUid);
|
||||
if (addonInfo == null) {
|
||||
return Response.status(Status.NOT_FOUND).build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user