From 697fc1260d15433cd49fbe669f4944e646784519 Mon Sep 17 00:00:00 2001 From: Ben Weeks Date: Sun, 21 Dec 2025 17:47:48 +0000 Subject: [PATCH] fix: respect admin-configured allowed currencies in dropdowns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use window.g.allowedCurrencies instead of fetching all currencies from the API, so currency dropdowns only show currencies configured by the admin in LNbits settings. Closes #116 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 4.5 --- static/components/shipping-zones.js | 17 ++++------------- static/components/stall-list.js | 20 +++++--------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/static/components/shipping-zones.js b/static/components/shipping-zones.js index 742021a..17a4a1e 100644 --- a/static/components/shipping-zones.js +++ b/static/components/shipping-zones.js @@ -162,22 +162,13 @@ window.app.component('shipping-zones', { LNbits.utils.notifyApiError(error) } }, - async getCurrencies() { - try { - const {data} = await LNbits.api.request( - 'GET', - '/nostrmarket/api/v1/currencies', - this.inkey - ) - - this.currencies = ['sat', ...data] - } catch (error) { - LNbits.utils.notifyApiError(error) - } + getCurrencies() { + const currencies = window.g.allowedCurrencies || [] + this.currencies = ['sat', ...currencies] } }, created: async function () { await this.getZones() - await this.getCurrencies() + this.getCurrencies() } }) diff --git a/static/components/stall-list.js b/static/components/stall-list.js index 1ef4d70..c424950 100644 --- a/static/components/stall-list.js +++ b/static/components/stall-list.js @@ -149,19 +149,9 @@ window.app.component('stall-list', { } }) }, - getCurrencies: async function () { - try { - const {data} = await LNbits.api.request( - 'GET', - '/nostrmarket/api/v1/currencies', - this.inkey - ) - - return ['sat', ...data] - } catch (error) { - LNbits.utils.notifyApiError(error) - } - return [] + getCurrencies: function () { + const currencies = window.g.allowedCurrencies || [] + return ['sat', ...currencies] }, getStalls: async function (pending = false) { try { @@ -207,7 +197,7 @@ window.app.component('stall-list', { } }, openCreateStallDialog: async function (stallData) { - this.currencies = await this.getCurrencies() + this.currencies = this.getCurrencies() this.zoneOptions = await this.getZones() if (!this.zoneOptions || !this.zoneOptions.length) { this.$q.notify({ @@ -256,7 +246,7 @@ window.app.component('stall-list', { }, created: async function () { this.stalls = await this.getStalls() - this.currencies = await this.getCurrencies() + this.currencies = this.getCurrencies() this.zoneOptions = await this.getZones() } })