chore: cleanup LNBITS_DENOMINATION global var (#3580)

This commit is contained in:
dni ⚡ 2025-11-26 15:15:20 +01:00 committed by GitHub
parent da31e3caaa
commit c6c67c52db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 18 additions and 32 deletions

File diff suppressed because one or more lines are too long

View file

@ -58,11 +58,6 @@ window.app.component('lnbits-payment-details', {
template: '#lnbits-payment-details', template: '#lnbits-payment-details',
props: ['payment'], props: ['payment'],
mixins: [window.windowMixin], mixins: [window.windowMixin],
data() {
return {
LNBITS_DENOMINATION: LNBITS_DENOMINATION
}
},
computed: { computed: {
hasPreimage() { hasPreimage() {
return ( return (
@ -364,9 +359,6 @@ window.app.component('lnbits-update-balance', {
mixins: [window.windowMixin], mixins: [window.windowMixin],
props: ['wallet_id', 'small_btn'], props: ['wallet_id', 'small_btn'],
computed: { computed: {
denomination() {
return LNBITS_DENOMINATION
},
admin() { admin() {
return user.super_user return user.super_user
} }

View file

@ -2,9 +2,6 @@ window.app.component('lnbits-header', {
template: '#lnbits-header', template: '#lnbits-header',
mixins: [window.windowMixin], mixins: [window.windowMixin],
computed: { computed: {
denomination() {
return this.LNBITS_DENOMINATION || 'sat'
},
hasServiceFeeMax() { hasServiceFeeMax() {
return ( return (
this.g.user && this.g.user &&

View file

@ -95,7 +95,7 @@ window.app.component('lnbits-home-logos', {
computed: { computed: {
showLogos() { showLogos() {
return ( return (
this.LNBITS_DENOMINATION == 'sats' && this.g.isSatsDenomination &&
this.SITE_TITLE == 'LNbits' && this.SITE_TITLE == 'LNbits' &&
this.LNBITS_SHOW_HOME_PAGE_ELEMENTS == true this.LNBITS_SHOW_HOME_PAGE_ELEMENTS == true
) )

View file

@ -4,7 +4,6 @@ window.app.component('lnbits-payment-list', {
mixins: [window.windowMixin], mixins: [window.windowMixin],
data() { data() {
return { return {
denomination: LNBITS_DENOMINATION,
payments: [], payments: [],
paymentsTable: { paymentsTable: {
columns: [ columns: [
@ -18,7 +17,7 @@ window.app.component('lnbits-payment-list', {
{ {
name: 'amount', name: 'amount',
align: 'right', align: 'right',
label: this.$t('amount') + ' (' + LNBITS_DENOMINATION + ')', label: this.$t('amount'),
field: 'sat', field: 'sat',
sortable: true sortable: true
} }
@ -67,14 +66,14 @@ window.app.component('lnbits-payment-list', {
{ {
name: 'amount', name: 'amount',
align: 'right', align: 'right',
label: this.$t('amount') + ' (' + LNBITS_DENOMINATION + ')', label: this.$t('amount'),
field: 'sat', field: 'sat',
sortable: true sortable: true
}, },
{ {
name: 'fee', name: 'fee',
align: 'right', align: 'right',
label: this.$t('fee') + ' (m' + LNBITS_DENOMINATION + ')', label: this.$t('fee'),
field: 'fee' field: 'fee'
}, },
{ {

View file

@ -57,7 +57,7 @@ window.PageHome = {
}, },
lnbitsBannerEnabled() { lnbitsBannerEnabled() {
return ( return (
this.LNBITS_DENOMINATION == 'sats' && this.isSatsDenomination &&
this.SITE_TITLE == 'LNbits' && this.SITE_TITLE == 'LNbits' &&
this.LNBITS_SHOW_HOME_PAGE_ELEMENTS == true this.LNBITS_SHOW_HOME_PAGE_ELEMENTS == true
) )

View file

@ -91,14 +91,14 @@ window.PageNode = {
{ {
name: 'sat', name: 'sat',
align: 'right', align: 'right',
label: this.$t('amount') + ' (' + LNBITS_DENOMINATION + ')', label: this.$t('amount'),
field: row => this.formatMsat(row.amount), field: row => this.formatMsat(row.amount),
sortable: true sortable: true
}, },
{ {
name: 'fee', name: 'fee',
align: 'right', align: 'right',
label: this.$t('fee') + ' (m' + LNBITS_DENOMINATION + ')', label: this.$t('fee'),
field: 'fee' field: 'fee'
}, },
{ {
@ -144,7 +144,7 @@ window.PageNode = {
}, },
{ {
name: 'amount', name: 'amount',
label: this.$t('amount') + ' (' + LNBITS_DENOMINATION + ')', label: this.$t('amount'),
field: row => this.formatMsat(row.amount), field: row => this.formatMsat(row.amount),
sortable: true sortable: true
}, },

View file

@ -75,12 +75,10 @@ window.PageWallet = {
return this.parse.invoice.sat <= this.g.wallet.sat return this.parse.invoice.sat <= this.g.wallet.sat
}, },
formattedAmount() { formattedAmount() {
if (this.receive.unit != 'sat' || LNBITS_DENOMINATION != 'sats') { if (this.receive.unit != 'sat' || !this.g.isSatsDenomination) {
return LNbits.utils.formatCurrency( return LNbits.utils.formatCurrency(
Number(this.receive.data.amount).toFixed(2), Number(this.receive.data.amount).toFixed(2),
LNBITS_DENOMINATION != 'sats' !this.g.isSatsDenomination ? this.g.denomination : this.receive.unit
? LNBITS_DENOMINATION
: this.receive.unit
) )
} else { } else {
return LNbits.utils.formatMsat(this.receive.amountMsat) + ' sat' return LNbits.utils.formatMsat(this.receive.amountMsat) + ' sat'
@ -148,7 +146,7 @@ window.PageWallet = {
}, },
createInvoice() { createInvoice() {
this.receive.status = 'loading' this.receive.status = 'loading'
if (LNBITS_DENOMINATION != 'sats') { if (!this.g.isSatsDenomination) {
this.receive.data.amount = this.receive.data.amount * 100 this.receive.data.amount = this.receive.data.amount * 100
} }

View file

@ -136,7 +136,7 @@ include('components/lnbits-wallet-extra.vue') %}
<q-item-label v-text="$t('amount')"></q-item-label> <q-item-label v-text="$t('amount')"></q-item-label>
<q-item-label caption> <q-item-label caption>
<span v-text="(payment.amount / 1000).toFixed(3)"></span> <span v-text="(payment.amount / 1000).toFixed(3)"></span>
<span v-text="LNBITS_DENOMINATION"></span> <span v-text="g.denomination"></span>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
@ -145,7 +145,7 @@ include('components/lnbits-wallet-extra.vue') %}
<q-item-label v-text="$t('fee')"></q-item-label> <q-item-label v-text="$t('fee')"></q-item-label>
<q-item-label caption> <q-item-label caption>
<span v-text="(payment.fee / 1000).toFixed(3)"></span> <span v-text="(payment.fee / 1000).toFixed(3)"></span>
<span v-text="LNBITS_DENOMINATION"></span> <span v-text="g.denomination"></span>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
@ -460,7 +460,7 @@ include('components/lnbits-wallet-extra.vue') %}
<q-popup-edit class="text-white" v-slot="scope" v-model="credit"> <q-popup-edit class="text-white" v-slot="scope" v-model="credit">
<q-input <q-input
filled filled
:label="$t('credit_label', {denomination: denomination})" :label="$t('credit_label', {denomination: g.denomination})"
v-model="scope.value" v-model="scope.value"
dense dense
autofocus autofocus
@ -484,7 +484,7 @@ include('components/lnbits-wallet-extra.vue') %}
<q-popup-edit class="text-white" v-slot="scope" v-model="credit"> <q-popup-edit class="text-white" v-slot="scope" v-model="credit">
<q-input <q-input
filled filled
:label="$t('credit_label', {denomination: denomination})" :label="$t('credit_label', {denomination: g.denomination})"
v-model="scope.value" v-model="scope.value"
type="number" type="number"
dense dense

View file

@ -55,7 +55,7 @@
$t('service_fee_max_badge', { $t('service_fee_max_badge', {
amount: serviceFee, amount: serviceFee,
max: serviceFeeMax, max: serviceFeeMax,
denom: denomination denom: g.denomination
}) })
" "
></span> ></span>

View file

@ -317,9 +317,9 @@
</template> </template>
</q-td> </q-td>
<q-td <q-td
v-if="g.isSatsDenomination"
auto-width auto-width
key="amount" key="amount"
v-if="denomination != 'sats'"
:props="props" :props="props"
class="col1" class="col1"
v-text="parseFloat(String(props.row.fsat).replaceAll(',', '')) / 100" v-text="parseFloat(String(props.row.fsat).replaceAll(',', '')) / 100"