fix: handle first time install different than subsequent updates
This commit is contained in:
parent
a2d35f65c9
commit
0d61db13ec
|
@ -798,19 +798,23 @@ async def api_install_extension(
|
|||
with zipfile.ZipFile(ext_zip_file, "r") as zip_ref:
|
||||
zip_ref.extractall("lnbits/extensions")
|
||||
|
||||
ext_upgrade_dir = os.path.join("lnbits/upgrades", f"{extension.id}-{extension.hash}")
|
||||
ext_upgrade_dir = os.path.join(
|
||||
"lnbits/upgrades", f"{extension.id}-{extension.hash}"
|
||||
)
|
||||
os.makedirs("lnbits/upgrades", exist_ok=True)
|
||||
shutil.rmtree(ext_upgrade_dir, True)
|
||||
with zipfile.ZipFile(ext_zip_file, "r") as zip_ref:
|
||||
zip_ref.extractall(ext_upgrade_dir)
|
||||
|
||||
module_name = f"lnbits.extensions.{ext_id}"
|
||||
module_installed = module_name in sys.modules
|
||||
# todo: is admin only
|
||||
ext = Extension(
|
||||
code=extension.id,
|
||||
is_valid=True,
|
||||
is_admin_only=False,
|
||||
name=extension.name,
|
||||
hash=extension.hash,
|
||||
hash=extension.hash if module_installed else "",
|
||||
)
|
||||
|
||||
current_versions = await get_dbversions()
|
||||
|
|
Loading…
Reference in New Issue
Block a user