From 74852e34941f3d44f47934dcd8cde847ecef7b65 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Tue, 17 Mar 2026 21:41:17 +0000 Subject: [PATCH] feat: add disable option for LNURLw (#70) --- migrations.py | 6 +++++ models.py | 2 ++ static/js/index.js | 12 ++++++---- templates/withdraw/display.html | 9 ++++++- templates/withdraw/index.html | 42 +++++++++++++++++++++++++++++++++ views.py | 2 +- views_lnurl.py | 10 +++++++- 7 files changed, 76 insertions(+), 7 deletions(-) diff --git a/migrations.py b/migrations.py index 754a57f..e27af8a 100644 --- a/migrations.py +++ b/migrations.py @@ -139,3 +139,9 @@ async def m007_add_created_at_timestamp(db): "ALTER TABLE withdraw.withdraw_link " f"ADD COLUMN created_at TIMESTAMP DEFAULT {db.timestamp_column_default}" ) + + +async def m008_add_enabled_column(db): + await db.execute( + "ALTER TABLE withdraw.withdraw_link ADD COLUMN enabled BOOLEAN DEFAULT true;" + ) diff --git a/models.py b/models.py index 0b4b910..e888cdf 100644 --- a/models.py +++ b/models.py @@ -15,6 +15,7 @@ class CreateWithdrawData(BaseModel): webhook_headers: str = Query(None) webhook_body: str = Query(None) custom_url: str = Query(None) + enabled: bool = Query(True) class WithdrawLink(BaseModel): @@ -37,6 +38,7 @@ class WithdrawLink(BaseModel): webhook_body: str = Query(None) custom_url: str = Query(None) created_at: datetime + enabled: bool = Query(True) lnurl: str | None = Field( default=None, no_database=True, diff --git a/static/js/index.js b/static/js/index.js index a5f4dbf..0b42b40 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -68,7 +68,8 @@ window.app = Vue.createApp({ data: { is_unique: false, use_custom: false, - has_webhook: false + has_webhook: false, + enabled: true } }, simpleformDialog: { @@ -78,7 +79,8 @@ window.app = Vue.createApp({ use_custom: false, title: 'Vouchers', min_withdrawable: 0, - wait_time: 1 + wait_time: 1, + enabled: true } }, qrCodeDialog: { @@ -125,13 +127,15 @@ window.app = Vue.createApp({ this.formDialog.data = { is_unique: false, use_custom: false, - has_webhook: false + has_webhook: false, + enabled: true } }, simplecloseFormDialog() { this.simpleformDialog.data = { is_unique: false, - use_custom: false + use_custom: false, + enabled: true } }, openQrCodeDialog(linkId) { diff --git a/templates/withdraw/display.html b/templates/withdraw/display.html index f9fbd53..812c95f 100644 --- a/templates/withdraw/display.html +++ b/templates/withdraw/display.html @@ -7,6 +7,12 @@ Withdraw is spent. + Withdraw is spent. + Withdraw is disabled.