make ad space as a CSV formatted string

This commit is contained in:
Tiago Vasconcelos 2022-12-01 22:16:55 +00:00
parent 0a47b63597
commit f7dd533daa
5 changed files with 5 additions and 33 deletions

View File

@ -22,7 +22,7 @@ LNBITS_DEFAULT_WALLET_NAME="LNbits wallet"
# Ad space description
# LNBITS_AD_SPACE_TITLE="Supported by"
# csv ad space, format "<url>;<img-light>;<img-dark>, <url>;<img-light>;<img-dark>", 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

View File

@ -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

View File

@ -98,27 +98,12 @@
<p>Advertisement Slots</p>
<q-input
filled
v-model="formData.ad_space_add"
v-model="formData.lnbits_ad_space"
type="text"
label="url;img_light_url;img_dark_url, url..."
hint="Ad url and image filepaths in CSV format, extensions can choose to honor"
>
<!-- <q-btn @click="addAdSpace" dense flat icon="add"></q-btn> -->
</q-input>
<div>
{% raw %}
<q-chip
v-for="space in settings.lnbits_ad_space"
:key="space"
removable
@remove="removeAdSpace(space)"
color="primary"
text-color="white"
>
{{ space.slice(0, 8) + " ... " + space.slice(-8) }}
</q-chip>
{% endraw %}
</div>
<br />
</div>
</div>

View File

@ -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)

View File

@ -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",