for uninstalling wasm
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
from lnbits.core.db import db
|
from lnbits.core.db import db
|
||||||
from lnbits.core.models.extensions import (
|
from lnbits.core.models.extensions import (
|
||||||
InstallableExtension,
|
InstallableExtension,
|
||||||
@@ -49,7 +51,8 @@ async def drop_extension_db(ext_id: str, conn: Connection | None = None) -> None
|
|||||||
)
|
)
|
||||||
# Check that 'ext_id' is a valid extension id and not a malicious string
|
# Check that 'ext_id' is a valid extension id and not a malicious string
|
||||||
if not row:
|
if not row:
|
||||||
raise Exception(f"Extension '{ext_id}' db version cannot be found")
|
if not re.fullmatch(r"[a-zA-Z_][a-zA-Z0-9_]*", ext_id):
|
||||||
|
raise Exception(f"Extension '{ext_id}' db version cannot be found")
|
||||||
|
|
||||||
is_file_based_db = await Database.clean_ext_db_files(ext_id)
|
is_file_based_db = await Database.clean_ext_db_files(ext_id)
|
||||||
if is_file_based_db:
|
if is_file_based_db:
|
||||||
|
|||||||
@@ -873,3 +873,6 @@ def icon_to_github_url(source_repo: str, path: str | None) -> str:
|
|||||||
_, _, *rest = path.split("/")
|
_, _, *rest = path.split("/")
|
||||||
tail = "/".join(rest)
|
tail = "/".join(rest)
|
||||||
return f"https://github.com/{source_repo}/raw/main/{tail}"
|
return f"https://github.com/{source_repo}/raw/main/{tail}"
|
||||||
|
|
||||||
|
|
||||||
|
ExtensionConfig.update_forward_refs(ExtensionPermission=ExtensionPermission)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from lnbits.core.crud import (
|
|||||||
get_db_version,
|
get_db_version,
|
||||||
get_installed_extension,
|
get_installed_extension,
|
||||||
update_installed_extension_state,
|
update_installed_extension_state,
|
||||||
|
update_migration_version,
|
||||||
)
|
)
|
||||||
from lnbits.core.crud.extensions import (
|
from lnbits.core.crud.extensions import (
|
||||||
get_installed_extensions,
|
get_installed_extensions,
|
||||||
@@ -53,6 +54,9 @@ async def install_extension(
|
|||||||
else:
|
else:
|
||||||
await update_installed_extension(ext_info)
|
await update_installed_extension(ext_info)
|
||||||
|
|
||||||
|
if ext_info.meta and ext_info.meta.extension_type == "wasm":
|
||||||
|
await update_migration_version(None, ext_info.id, 0)
|
||||||
|
|
||||||
extension = Extension.from_installable_ext(ext_info)
|
extension = Extension.from_installable_ext(ext_info)
|
||||||
if extension.is_upgrade_extension:
|
if extension.is_upgrade_extension:
|
||||||
# call stop while the old routes are still active
|
# call stop while the old routes are still active
|
||||||
|
|||||||
Reference in New Issue
Block a user