feat: stub for extension versions

This commit is contained in:
Vlad Stan 2023-01-16 12:07:46 +02:00
parent 0b49541c15
commit a73e8ae44d
3 changed files with 25 additions and 2 deletions

View File

@ -313,9 +313,16 @@
this.showUninstallDialog = true
},
showUpgrade: function (extension) {
showUpgrade: async function (extension) {
console.log('### showUpgrade')
this.selectedExtension = extension
this.showUpgradeDialog = true
const releases = await LNbits.api.request(
'GET',
`/api/v1/extension/${extension.id}/releases?usr=${this.g.user.id}`,
this.g.user.wallets[0].adminkey
)
console.log('### releases', releases)
},
showExtensionDetails: function (extension) {

View File

@ -795,3 +795,19 @@ async def api_uninstall_extension(ext_id: str, user: User = Depends(check_admin)
raise HTTPException(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR, detail=str(ex)
)
@core_app.get("/api/v1/extension/{ext_id}/releases")
async def get_extension_releases(ext_id: str, user: User = Depends(check_admin)):
try:
installable_extensions: List[
InstallableExtension
] = await InstallableExtension.get_installable_extensions()
extensions = [e for e in installable_extensions if e.id == ext_id]
return extensions
except Exception as ex:
raise HTTPException(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR, detail=str(ex)
)

View File

@ -127,7 +127,7 @@ class ExtensionRelease(BaseModel):
class InstallableExtension(BaseModel):
id: str
name: str
archive: str
archive: str #todo: move to installed_release
hash: str
short_description: Optional[str] = None
details: Optional[str] = None