From f7dd533daa16fae46c9701aa7cd56ec1dc80be95 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Thu, 1 Dec 2022 22:16:55 +0000 Subject: [PATCH] make ad space as a CSV formatted string --- .env.example | 2 +- lnbits/extensions/admin/models.py | 2 +- .../admin/templates/admin/_tab_theme.html | 17 +---------------- .../extensions/admin/templates/admin/index.html | 13 ------------- lnbits/settings.py | 4 ++-- 5 files changed, 5 insertions(+), 33 deletions(-) diff --git a/.env.example b/.env.example index 0a3f8f14..13765574 100644 --- a/.env.example +++ b/.env.example @@ -22,7 +22,7 @@ LNBITS_DEFAULT_WALLET_NAME="LNbits wallet" # Ad space description # LNBITS_AD_SPACE_TITLE="Supported by" # csv ad space, format ";;, ;;", extensions can choose to honor -# LNBITS_AD_SPACE="" +# LNBITS_AD_SPACE="https://shop.lnbits.com/;https://raw.githubusercontent.com/lnbits/lnbits/main/lnbits/static/images/lnbits-shop-light.png;https://raw.githubusercontent.com/lnbits/lnbits/main/lnbits/static/images/lnbits-shop-dark.png" # Hides wallet api, extensions can choose to honor LNBITS_HIDE_API=false diff --git a/lnbits/extensions/admin/models.py b/lnbits/extensions/admin/models.py index dc665531..36f99bf3 100644 --- a/lnbits/extensions/admin/models.py +++ b/lnbits/extensions/admin/models.py @@ -23,7 +23,7 @@ class UpdateSettings(BaseModel): lnbits_denomination: str = Query(None) lnbits_theme: str = Query(None) lnbits_custom_logo: str = Query(None) - lnbits_ad_space: List[str] = Query(None) + lnbits_ad_space: str = Query(None) lnbits_ad_space_title: str = Query(None) # funding sources diff --git a/lnbits/extensions/admin/templates/admin/_tab_theme.html b/lnbits/extensions/admin/templates/admin/_tab_theme.html index 77d3a170..c63ea220 100644 --- a/lnbits/extensions/admin/templates/admin/_tab_theme.html +++ b/lnbits/extensions/admin/templates/admin/_tab_theme.html @@ -98,27 +98,12 @@

Advertisement Slots

- -
- {% raw %} - - {{ space.slice(0, 8) + " ... " + space.slice(-8) }} - - {% endraw %} -

diff --git a/lnbits/extensions/admin/templates/admin/index.html b/lnbits/extensions/admin/templates/admin/index.html index ba8b49c0..de84ff9c 100644 --- a/lnbits/extensions/admin/templates/admin/index.html +++ b/lnbits/extensions/admin/templates/admin/index.html @@ -364,19 +364,6 @@ u => u !== user ) }, - addAdSpace() { - let adSpace = this.formData.ad_space_add - let spaces = this.settings.lnbits_ad_space - if (adSpace.length && !spaces.includes(adSpace)) { - spaces.push(adSpace) - this.settings.lnbits_ad_space = spaces - this.formData.ad_space_add = '' - } - }, - removeAdSpace(ad) { - let spaces = this.settings.lnbits_ad_space - this.settings.lnbits_ad_space = spaces.filter(s => s !== ad) - }, restartServer() { LNbits.api .request('GET', '/admin/api/v1/restart/?usr=' + this.g.user.id) diff --git a/lnbits/settings.py b/lnbits/settings.py index edaab7d9..86ab9db3 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -62,7 +62,7 @@ class Settings(BaseSettings): default=["classic", "flamingo", "mint", "salvador", "monochrome", "autumn"] ) lnbits_custom_logo: str = Field(default=None) - lnbits_ad_space: List[str] = Field(default=[]) + lnbits_ad_space: str = Field(default="") lnbits_ad_space_title: str = Field(default="") # ops @@ -136,7 +136,7 @@ class Settings(BaseSettings): "lnbits_admin_users", "lnbits_allowed_users", "lnbits_theme_options", - "lnbits_ad_space", + # "lnbits_ad_space", "lnbits_admin_extensions", "lnbits_disabled_extensions", "lnbits_allowed_funding_sources",