fix: do not fail when one of the extension manifest files is not available
This commit is contained in:
parent
4efeae24d0
commit
032a000da7
2 changed files with 24 additions and 26 deletions
|
|
@ -80,10 +80,7 @@ async def extensions_install(
|
||||||
] = await InstallableExtension.get_installable_extensions()
|
] = await InstallableExtension.get_installable_extensions()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.warning(ex)
|
logger.warning(ex)
|
||||||
raise HTTPException(
|
extension_list = []
|
||||||
status_code=HTTPStatus.NOT_FOUND,
|
|
||||||
detail="Cannot fetch installable extension list",
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if deactivate:
|
if deactivate:
|
||||||
|
|
|
||||||
|
|
@ -225,27 +225,28 @@ class InstallableExtension(NamedTuple):
|
||||||
|
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
for url in settings.lnbits_extensions_manifests:
|
for url in settings.lnbits_extensions_manifests:
|
||||||
resp = await client.get(url)
|
try:
|
||||||
if resp.status_code != 200:
|
resp = await client.get(url)
|
||||||
raise HTTPException(
|
if resp.status_code != 200:
|
||||||
status_code=404,
|
logger.warning(f"Unable to fetch extension list for repository: {url}")
|
||||||
detail=f"Unable to fetch extension list for repository: {url}",
|
continue
|
||||||
)
|
for e in resp.json()["extensions"]:
|
||||||
for e in resp.json()["extensions"]:
|
extension_list += [
|
||||||
extension_list += [
|
InstallableExtension(
|
||||||
InstallableExtension(
|
id=e["id"],
|
||||||
id=e["id"],
|
name=e["name"],
|
||||||
name=e["name"],
|
archive=e["archive"],
|
||||||
archive=e["archive"],
|
hash=e["hash"],
|
||||||
hash=e["hash"],
|
short_description=e["shortDescription"],
|
||||||
short_description=e["shortDescription"],
|
details=e["details"] if "details" in e else "",
|
||||||
details=e["details"] if "details" in e else "",
|
icon=e["icon"],
|
||||||
icon=e["icon"],
|
dependencies=e["dependencies"]
|
||||||
dependencies=e["dependencies"]
|
if "dependencies" in e
|
||||||
if "dependencies" in e
|
else [],
|
||||||
else [],
|
)
|
||||||
)
|
]
|
||||||
]
|
except Exception as e:
|
||||||
|
logger.warning(e)
|
||||||
|
|
||||||
return extension_list
|
return extension_list
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue