mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 11:06:32 +00:00
update store API
This commit is contained in:
parent
08af296c86
commit
381b73b4b8
@ -516,6 +516,8 @@ class RestAPI(CoreSysAttributes):
|
||||
web.get("/store/addons/{addon}/{version}", api_store.addons_addon_info),
|
||||
web.get("/store/addons/{addon}/icon", api_store.addons_addon_icon),
|
||||
web.get("/store/addons/{addon}/logo", api_store.addons_addon_logo),
|
||||
web.get("/store/addons/{addon}/icon", api_store.addons_addon_dark_icon),
|
||||
web.get("/store/addons/{addon}/logo", api_store.addons_addon_dark_logo),
|
||||
web.get(
|
||||
"/store/addons/{addon}/changelog", api_store.addons_addon_changelog
|
||||
),
|
||||
@ -554,8 +556,6 @@ class RestAPI(CoreSysAttributes):
|
||||
web.post("/addons/reload", api_store.reload),
|
||||
web.post("/addons/{addon}/install", api_store.addons_addon_install),
|
||||
web.post("/addons/{addon}/update", api_store.addons_addon_update),
|
||||
web.get("/addons/{addon}/icon", api_store.addons_addon_icon),
|
||||
web.get("/addons/{addon}/logo", api_store.addons_addon_logo),
|
||||
web.get("/addons/{addon}/changelog", api_store.addons_addon_changelog),
|
||||
web.get(
|
||||
"/addons/{addon}/documentation",
|
||||
|
@ -217,6 +217,20 @@ class APIStore(CoreSysAttributes):
|
||||
with addon.path_icon.open("rb") as png:
|
||||
return png.read()
|
||||
|
||||
@api_process_raw(CONTENT_TYPE_PNG)
|
||||
async def addons_addon_dark_icon(self, request: web.Request) -> bytes:
|
||||
"""Return dark icon from add-on."""
|
||||
addon = self._extract_addon(request)
|
||||
if not addon.with_icon:
|
||||
raise APIError(f"No icon found for add-on {addon.slug}!")
|
||||
|
||||
if addon.with_dark_icon:
|
||||
with addon.path_dark_icon.open("rb") as png:
|
||||
return png.read()
|
||||
|
||||
with addon.path_icon.open("rb") as png:
|
||||
return png.read()
|
||||
|
||||
@api_process_raw(CONTENT_TYPE_PNG)
|
||||
async def addons_addon_logo(self, request: web.Request) -> bytes:
|
||||
"""Return logo from add-on."""
|
||||
@ -227,6 +241,20 @@ class APIStore(CoreSysAttributes):
|
||||
with addon.path_logo.open("rb") as png:
|
||||
return png.read()
|
||||
|
||||
@api_process_raw(CONTENT_TYPE_PNG)
|
||||
async def addons_addon_dark_logo(self, request: web.Request) -> bytes:
|
||||
"""Return dark logo from add-on."""
|
||||
addon = self._extract_addon(request)
|
||||
if not addon.with_logo:
|
||||
raise APIError(f"No logo found for add-on {addon.slug}!")
|
||||
|
||||
if addon.with_dark_logo:
|
||||
with addon.path_dark_logo.open("rb") as png:
|
||||
return png.read()
|
||||
|
||||
with addon.path_logo.open("rb") as png:
|
||||
return png.read()
|
||||
|
||||
@api_process_raw(CONTENT_TYPE_TEXT)
|
||||
async def addons_addon_changelog(self, request: web.Request) -> str:
|
||||
"""Return changelog from add-on."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user