diff --git a/lnbits/core/static/js/service-worker.js b/lnbits/core/static/js/service-worker.js index 4f0addc22..041b9f32f 100644 --- a/lnbits/core/static/js/service-worker.js +++ b/lnbits/core/static/js/service-worker.js @@ -1,9 +1,9 @@ // the cache version gets updated every time there is a new deployment -const CACHE_VERSION = 1; -const CURRENT_CACHE = `lnbits-${CACHE_VERSION}-`; +const CACHE_VERSION = 1 +const CURRENT_CACHE = `lnbits-${CACHE_VERSION}-` -const getApiKey = (request) => { - return request.headers.get('X-Api-Key') || "none" +const getApiKey = request => { + return request.headers.get('X-Api-Key') || 'none' } // on activation we clean up the previously registered service workers @@ -14,32 +14,38 @@ self.addEventListener('activate', evt => cacheNames.map(cacheName => { const currentCacheVersion = cacheName.split('-').slice(-2, 2) if (currentCacheVersion !== CACHE_VERSION) { - return caches.delete(cacheName); + return caches.delete(cacheName) } }) - ); + ) }) ) -); +) // The fetch handler serves responses for same-origin resources from a cache. // If no response is found, it populates the runtime cache with the response // from the network before returning it to the page. self.addEventListener('fetch', event => { // Skip cross-origin requests, like those for Google Analytics. - if (event.request.url.startsWith(self.location.origin) && event.request.method == "GET") { - + if ( + event.request.url.startsWith(self.location.origin) && + event.request.method == 'GET' + ) { // Open the cache - event.respondWith(caches.open(CURRENT_CACHE + getApiKey(event.request)).then((cache) => { - // Go to the network first - return fetch(event.request).then((fetchedResponse) => { - cache.put(event.request, fetchedResponse.clone()); + event.respondWith( + caches.open(CURRENT_CACHE + getApiKey(event.request)).then(cache => { + // Go to the network first + return fetch(event.request) + .then(fetchedResponse => { + cache.put(event.request, fetchedResponse.clone()) - return fetchedResponse; - }).catch(() => { - // If the network is unavailable, get - return cache.match(event.request.url); - }); - })); + return fetchedResponse + }) + .catch(() => { + // If the network is unavailable, get + return cache.match(event.request.url) + }) + }) + ) } -}); \ No newline at end of file +}) diff --git a/lnbits/core/static/js/wallet.js b/lnbits/core/static/js/wallet.js index 057968938..baa9f605f 100644 --- a/lnbits/core/static/js/wallet.js +++ b/lnbits/core/static/js/wallet.js @@ -704,8 +704,9 @@ new Vue({ }) if (navigator.serviceWorker != null) { - navigator.serviceWorker.register('/service-worker.js') - .then(function(registration) { - console.log('Registered events at scope: ', registration.scope); - }); -} \ No newline at end of file + navigator.serviceWorker + .register('/service-worker.js') + .then(function (registration) { + console.log('Registered events at scope: ', registration.scope) + }) +} diff --git a/lnbits/extensions/tpos/templates/tpos/tpos.html b/lnbits/extensions/tpos/templates/tpos/tpos.html index 02d6a98d6..ca196e4a0 100644 --- a/lnbits/extensions/tpos/templates/tpos/tpos.html +++ b/lnbits/extensions/tpos/templates/tpos/tpos.html @@ -1,6 +1,4 @@ -{% extends "public.html" %} -{% block toolbar_title %} -{{ tpos.name }} +{% extends "public.html" %} {% block toolbar_title %} {{ tpos.name }} -{% endblock %} -{% block footer %}{% endblock %} {% block page_container %} +{% endblock %} {% block footer %}{% endblock %} {% block page_container %} @@ -179,27 +176,24 @@ - +
- Would you like to leave a tip? + Would you like to leave a tip?
- {% raw %}{{ tip }}{% endraw %}% + {% raw %}{{ tip }}{% endraw %}%

No, thanks

@@ -264,7 +258,7 @@ } .keypad .btn-confirm { - grid-area: 1 / 4 / 5 / 4; + grid-area: 1 / 4 / 5 / 4; } {% endblock %} {% block scripts %} @@ -281,7 +275,7 @@ tip_options: JSON.parse('{{ tpos.tip_options }}'), exchangeRate: null, stack: [], - tipAmount: 0.00, + tipAmount: 0.0, invoiceDialog: { show: false, data: null, @@ -289,7 +283,7 @@ paymentChecker: null }, tipDialog: { - show: false, + show: false }, urlDialog: { show: false @@ -323,7 +317,7 @@ methods: { closeInvoiceDialog: function () { this.stack = [] - this.tipAmount = 0.00 + this.tipAmount = 0.0 var dialog = this.invoiceDialog setTimeout(function () { clearInterval(dialog.paymentChecker) @@ -333,8 +327,10 @@ processTipSelection: function (selectedTipOption) { this.tipDialog.show = false - if(selectedTipOption) { - const tipAmount = parseFloat(parseFloat((selectedTipOption / 100) * this.amount)) + if (selectedTipOption) { + const tipAmount = parseFloat( + parseFloat((selectedTipOption / 100) * this.amount) + ) const subtotal = parseFloat(this.amount) const grandTotal = parseFloat((tipAmount + subtotal).toFixed(2)) const totalString = grandTotal.toFixed(2).toString() @@ -343,7 +339,7 @@ for (var i = 0; i < totalString.length; i++) { const char = totalString[i] - if(char !== ".") { + if (char !== '.') { this.stack.push(char) } } @@ -353,14 +349,14 @@ this.showInvoice() }, - submitForm: function() { - if(this.tip_options.length) { + submitForm: function () { + if (this.tip_options.length) { this.showTipModal() } else { this.showInvoice() } }, - showTipModal: function() { + showTipModal: function () { this.tipDialog.show = true }, showInvoice: function () { @@ -371,7 +367,7 @@ .post('/tpos/api/v1/tposs/' + this.tposId + '/invoices', null, { params: { amount: this.sat, - tipAmount: this.tipAmountSat, + tipAmount: this.tipAmountSat } }) .then(function (response) { diff --git a/lnbits/static/js/base.js b/lnbits/static/js/base.js index 48496b3c2..7c0e9958d 100644 --- a/lnbits/static/js/base.js +++ b/lnbits/static/js/base.js @@ -356,7 +356,7 @@ window.windowMixin = { } this.g.allowedThemes = window.allowedThemes ?? ['bitcoin'] - addEventListener('offline', event => { + addEventListener('offline', event => { this.g.offline = true }) @@ -442,4 +442,4 @@ window.decryptLnurlPayAES = function (success_action, preimage) { let decoder = new TextDecoder('utf-8') return decoder.decode(valueb) }) -} \ No newline at end of file +} diff --git a/lnbits/templates/base.html b/lnbits/templates/base.html index a744e1346..6ab1ec840 100644 --- a/lnbits/templates/base.html +++ b/lnbits/templates/base.html @@ -17,10 +17,8 @@ {% if web_manifest %} - - {% endif %} - - {% block head_scripts %}{% endblock %} + + {% endif %} {% block head_scripts %}{% endblock %} @@ -55,10 +53,13 @@ > {% endblock %} - - - OFFLINE - + + OFFLINE