Fake wallet fixes (#2983)

* Fake wallet fixes

LNBITS_DENOMINATION and LNBITS_DENOMINATION == 'sats' everywhere!

* added exception to "/api/v1/rate/{currency}"

* fix: create invoice dialog

* cleaning expansion items in wallet

* Revert "fix: create invoice dialog"

This reverts commit 2b550392ba.

* fix fakewallet mask break

* Fix formatted amount for fakewallet

* fixed wallet balance for fakewallet

* Wow, actually cleaning code, win!

* more cleaning

* For Vlad

* more cleaning

* make

* fix for sats

* bundle issue

* fix overflow in drawer for fat wallets and stupid long names

* make

* fixed adds

* fixed ad scale

* fundle

* fix

---------

Co-authored-by: Tiago Vasconcelos <talvasconcelos@gmail.com>
This commit is contained in:
Arc 2025-02-23 00:23:36 +00:00 committed by GitHub
parent b06c16ed57
commit eeca7de10d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 88 additions and 97 deletions

View file

@ -90,6 +90,12 @@
>
{{SITE_TAGLINE}}
</h6>
<p
class="q-my-sm"
v-if="'{{LNBITS_SHOW_HOME_PAGE_ELEMENTS}}' == 'True'"
>
{{SITE_DESCRIPTION}}
</p>
<!-- <div
class="gt-sm"
v-html="formatDescription"
@ -203,7 +209,10 @@
</q-card>
</div>
</div>
<div class="full-width q-mb-lg q-mt-sm">
<div
v-if="'{{ LNBITS_DENOMINATION }}' == 'sats'"
class="full-width q-mb-lg q-mt-sm"
>
<div class="flex flex-center q-gutter-md q-py-md">
<q-btn
outline
@ -228,35 +237,36 @@
</div>
</div>
{% if AD_SPACE %}
<div class="row justify-center q-mb-xl">
<div class="full-width text-center">
<span class="text-uppercase text-grey">{{ AD_SPACE_TITLE }}</span>
</div>
<div class="flex flex-center columm">
{% for ADS in AD_SPACE %} {% set AD = ADS.split(';') %}
<div class="flex flex-center column">
<a href="{{ AD[0] }}">
<img
v-if="($q.dark.isActive)"
src="{{ AD[1] }}"
style="max-width: 420px"
class="full-width"
/>
<img
v-else
src="{{ AD[2] }}"
style="max-width: 420px"
class="full-width"
/>
</a>
<div class="q-pt-md full-width">
<div class="row justify-center q-mb-xl">
<div class="full-width text-center">
<span class="text-uppercase text-grey">{{ AD_SPACE_TITLE }}</span>
</div>
<div class="flex flex-center columm">
{% for ADS in AD_SPACE %} {% set AD = ADS.split(';') %}
<div class="flex flex-center column q-pr-sm">
<a href="{{ AD[0] }}">
<img
v-if="($q.dark.isActive)"
src="{{ AD[1] }}"
style="max-width: 420px"
class="full-width"
/>
<img
v-else
src="{{ AD[2] }}"
style="max-width: 420px"
class="full-width"
/>
</a>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>
{% endif %}
<div class="full-width">
<div v-if="'{{ LNBITS_DENOMINATION }}' == 'sats'" class="full-width">
<div class="wrapper">
<div class="marquee">
<div class="marquee__group">

View file

@ -30,7 +30,11 @@
>
<q-card-section style="height: 130px">
<div class="row q-gutter-md">
<div class="col-1" style="max-width: 30px">
<div
v-if="'{{ LNBITS_DENOMINATION }}' == 'sats'"
class="col-1"
style="max-width: 30px"
>
<q-btn
v-if="g.fiatTracking"
@click="swapBalancePriority"
@ -56,8 +60,9 @@
<div class="row">
<div class="col-auto">
<div class="text-h3 q-my-none text-no-wrap">
<strong v-text="formattedBalance"></strong>
<small> {{LNBITS_DENOMINATION}}</small>
<strong
v-text="formatBalance(this.g.wallet.sat)"
></strong>
</div>
</div>
<div class="col-auto">
@ -122,7 +127,7 @@
<div
class="absolute-right q-pa-md"
v-if="$q.screen.gt.md && g.fiatTracking"
v-if="$q.screen.gt.md && g.fiatTracking && '{{ LNBITS_DENOMINATION }}' == 'sats'"
>
<div class="text-bold text-italic">BTC Price</div>
<span
@ -257,6 +262,7 @@
{% endif %}
<q-expansion-item
v-if="'{{ LNBITS_DENOMINATION }}' == 'sats'"
group="extras"
icon="phone_android"
:label="$t('access_wallet_on_mobile')"
@ -349,7 +355,9 @@
<div class="col-2"></div>
</div>
</q-card-section>
<q-card-section>
<q-card-section
v-if="'{{ LNBITS_DENOMINATION }}' == 'sats'"
>
<div class="row">
<div class="col-6">
<q-select
@ -466,7 +474,6 @@
style="display: inline-block"
href="{{ AD[0] }}"
class="q-ml-md q-mb-xs q-mr-md"
style="max-width: 80%"
>
<img
style="max-width: 100%; height: auto"
@ -577,7 +584,7 @@
<q-input
filled
dense
v-model.number="receive.data.amount"
v-model="receive.data.amount"
:label="$t('amount')+' ({{LNBITS_DENOMINATION}}) *'"
mask="#.##"
fill-mask="0"
@ -696,24 +703,8 @@
<div v-if="parse.invoice">
<div class="column content-center text-center q-mb-md">
<div v-if="!isFiatPriority">
<h4
v-if="'{{LNBITS_DENOMINATION}}' != 'sats'"
class="q-my-none text-bold"
>
<span
v-text="parseFloat(String(parse.invoice.fsat).replaceAll(',', '')) / 100"
></span>
<span
class="text-h5"
v-text="'{{LNBITS_DENOMINATION}}'"
></span>
</h4>
<h4 v-else class="q-my-none text-bold">
<span v-text="parse.invoice.fsat"></span>
<span
class="text-h5"
v-text="'{{LNBITS_DENOMINATION}}'"
></span>
<h4 class="q-my-none text-bold">
<span v-text="formatBalance(parse.invoice.sat)"></span>
</h4>
</div>
<div v-else>
@ -732,34 +723,20 @@
color="primary"
></q-btn>
</div>
<div v-if="!isFiatPriority">
<div class="text-h5 text-italic">
<span
v-text="parse.invoice.fiatAmount"
style="opacity: 0.75"
></span>
<div v-if="g.fiatTracking">
<div v-if="isFiatPriority">
<div class="text-h5 text-italic">
<span
v-text="parse.invoice.fiatAmount"
style="opacity: 0.75"
></span>
</div>
</div>
<div v-else style="opacity: 0.75">
<h5 class="q-my-none text-bold">
<span v-text="formatBalance(parse.invoice.sat)"></span>
</h5>
</div>
</div>
<div v-else style="opacity: 0.75">
<h5
v-if="'{{LNBITS_DENOMINATION}}' != 'sats'"
class="q-my-none text-bold"
>
<span
v-text="parseFloat(String(parse.invoice.fsat).replaceAll(',', '')) / 100"
></span>
<span
class="text-h6"
v-text="'{{LNBITS_DENOMINATION}}'"
></span>
</h5>
<h5 v-else class="q-my-none text-bold">
<span v-text="parse.invoice.fsat"></span>
<span
class="text-h6"
v-text="'{{LNBITS_DENOMINATION}}'"
></span>
</h5>
</div>
</div>
<q-separator></q-separator>

File diff suppressed because one or more lines are too long

View file

@ -585,6 +585,13 @@ window.windowMixin = {
window.history.replaceState({}, '', url.toString())
}
},
formatBalance(amount) {
if (LNBITS_DENOMINATION != 'sats') {
return LNbits.utils.formatCurrency(amount / 100, LNBITS_DENOMINATION)
} else {
return LNbits.utils.formatSat(amount) + ' sats'
}
},
changeTheme(newValue) {
document.body.setAttribute('data-theme', newValue)
if (this.themeSelection) {

View file

@ -128,7 +128,10 @@ window.WalletPageLogic = {
computed: {
formattedBalance() {
if (LNBITS_DENOMINATION != 'sats') {
return this.g.wallet.sat / 100
return LNbits.utils.formatCurrency(
this.g.wallet.sat / 100,
LNBITS_DENOMINATION
)
} else {
return LNbits.utils.formatSat(this.g.wallet.sat)
}
@ -138,10 +141,12 @@ window.WalletPageLogic = {
return this.parse.invoice.sat <= this.g.wallet.sat
},
formattedAmount() {
if (this.receive.unit != 'sat') {
if (this.receive.unit != 'sat' || LNBITS_DENOMINATION != 'sats') {
return LNbits.utils.formatCurrency(
Number(this.receive.data.amount).toFixed(2),
this.receive.unit
LNBITS_DENOMINATION != 'sats'
? LNBITS_DENOMINATION
: this.receive.unit
)
} else {
return LNbits.utils.formatMsat(this.receive.amountMsat) + ' sat'
@ -831,7 +836,7 @@ window.WalletPageLogic = {
createdTasks() {
this.update.name = this.g.wallet.name
this.receive.units = ['sat', ...(window.currencies || [])]
if (this.g.wallet.currency != '') {
if (this.g.wallet.currency != '' && LNBITS_DENOMINATION == 'sats') {
this.g.fiatTracking = true
this.updateFiatBalance(this.g.wallet.currency)
} else {

View file

@ -326,8 +326,7 @@
</div>
<div class="row items-center q-pt-sm">
<h6 class="q-my-none ellipsis full-width">
<strong v-text="wallet.fsat"></strong>
<small> {{LNBITS_DENOMINATION}}</small>
<strong v-text="formatBalance(wallet.sat)"></strong>
</h6>
</div>
</q-card-section>

View file

@ -29,22 +29,15 @@
>
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-section
style="max-width: 100px"
class="q-my-none ellipsis full-width"
>
<q-item-label lines="1"
><span v-text="walletRec.name"></span
></q-item-label>
<q-item-label v-if="LNBITS_DENOMINATION != 'sats'" caption>
<span
v-text="
parseFloat(String(walletRec.fsat).replaceAll(',', '')) / 100
"
></span
>&nbsp;
<span v-text="LNBITS_DENOMINATION"></span>
</q-item-label>
<q-item-label v-else caption>
<span v-text="walletRec.fsat"></span>&nbsp;
<span v-text="LNBITS_DENOMINATION"></span>
<q-item-label class="q-my-none ellipsis full-width" caption>
<strong v-text="formatBalance(walletRec.sat)"></strong>
</q-item-label>
</q-item-section>
<q-item-section side v-show="g.wallet && g.wallet.id === walletRec.id">