Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lnbits/core/services/funding_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ async def check_balance_delta_changed():
if settings.latest_balance_delta_sats is None:
settings.latest_balance_delta_sats = status.delta_sats
return
if status.delta_sats != settings.latest_balance_delta_sats:
delta_change = abs(status.delta_sats - settings.latest_balance_delta_sats)
if delta_change >= settings.notification_balance_delta_threshold_sats:
enqueue_admin_notification(
NotificationType.balance_delta,
{
Expand Down
2 changes: 1 addition & 1 deletion lnbits/core/services/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def _is_message_type_enabled(message_type: NotificationType) -> bool:
if message_type == NotificationType.watchdog_check:
return settings.lnbits_notification_watchdog
if message_type == NotificationType.balance_delta:
return settings.notification_balance_delta_changed
return settings.notification_balance_delta_threshold_sats > 0
if message_type == NotificationType.server_start_stop:
return settings.lnbits_notification_server_start_stop
if message_type == NotificationType.server_status:
Expand Down
2 changes: 1 addition & 1 deletion lnbits/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def run_by_the_minute_tasks() -> None:
while settings.lnbits_running:
status_minutes = settings.lnbits_notification_server_status_hours * 60

if settings.notification_balance_delta_changed:
if settings.notification_balance_delta_threshold_sats > 0:
try:
# runs by default every minute, the delta should not change that often
await check_balance_delta_changed()
Expand Down
13 changes: 7 additions & 6 deletions lnbits/core/templates/admin/_tab_notifications.html
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,14 @@ <h6 class="q-mb-sm">
v-text="$t('notification_balance_delta_changed_desc')"
></q-item-label>
</q-item-section>

<q-item-section avatar>
<q-toggle
size="md"
v-model="formData.notification_balance_delta_changed"
checked-icon="check"
color="green"
unchecked-icon="clear"
<q-input
class="flow-right"
type="number"
min="0"
filled
v-model="formData.notification_balance_delta_threshold_sats"
/>
</q-item-section>
</q-item>
Expand Down
2 changes: 1 addition & 1 deletion lnbits/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ class NotificationsSettings(LNbitsSettings):

lnbits_notification_settings_update: bool = Field(default=True)
lnbits_notification_credit_debit: bool = Field(default=True)
notification_balance_delta_changed: bool = Field(default=True)
notification_balance_delta_threshold_sats: int = Field(default=1, ge=0)
lnbits_notification_server_start_stop: bool = Field(default=True)
lnbits_notification_watchdog: bool = Field(default=False)
lnbits_notification_server_status_hours: int = Field(default=24, gt=0)
Expand Down
2 changes: 1 addition & 1 deletion lnbits/static/bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lnbits/static/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ window.localisation.en = {

notification_balance_delta_changed: 'Balance Delta Changed',
notification_balance_delta_changed_desc:
'Notify when the diference between the node balance and the LNbits balance has changed even by 1 sat. This runs every minute.',
'Notify when the difference between the node balance and the LNbits balance has changed by more than the specified amount (in sats). Set to 0 to disable. This runs every minute.',

enable_watchdog: 'Enable Watchdog Switch',
enable_watchdog_desc:
Expand Down