diff --git a/lnbits/static/bundle-components.min.js b/lnbits/static/bundle-components.min.js index 8aa9936b4..e629a132e 100644 --- a/lnbits/static/bundle-components.min.js +++ b/lnbits/static/bundle-components.min.js @@ -1 +1 @@ -function generateChart(e,n){const t=n.reduce(((e,n)=>(e.labels.push(n.date),e.income.push(n.income),e.spending.push(n.spending),e.cumulative.push(n.balance),e)),{labels:[],income:[],spending:[],cumulative:[]});return new Chart(e.getContext("2d"),{type:"bar",data:{labels:t.labels,datasets:[{data:t.cumulative,type:"line",label:"balance",backgroundColor:"#673ab7",borderColor:"#673ab7",borderWidth:4,pointRadius:3,fill:!1},{data:t.income,type:"bar",label:"in",barPercentage:.75,backgroundColor:window.Color("rgb(76,175,80)").alpha(.5).rgbString()},{data:t.spending,type:"bar",label:"out",barPercentage:.75,backgroundColor:window.Color("rgb(233,30,99)").alpha(.5).rgbString()}]},options:{title:{text:"Chart.js Combo Time Scale"},tooltips:{mode:"index",intersect:!1},scales:{xAxes:[{type:"time",display:!0,time:{minUnit:"hour",stepSize:3}}]},animation:{duration:0},elements:{line:{tension:0}}}})}window.app.component("lnbits-funding-sources",{mixins:[window.windowMixin],props:["form-data","allowed-funding-sources"],methods:{getFundingSourceLabel(e){const n=this.rawFundingSources.find((n=>n[0]===e));return n?n[1]:e}},computed:{fundingSources(){let e=[];for(const[n,t,i]of this.rawFundingSources){const t={};if(null!==i)for(let[e,n]of Object.entries(i))t[e]={label:n,value:null};e.push([n,t])}return new Map(e)},sortedAllowedFundingSources(){return this.allowedFundingSources.sort()}},data:()=>({rawFundingSources:[["VoidWallet","Void Wallet",null],["FakeWallet","Fake Wallet",{fake_wallet_secret:"Secret"}],["CoreLightningWallet","Core Lightning",{corelightning_rpc:"Endpoint",corelightning_pay_command:"Custom Pay Command"}],["CoreLightningRestWallet","Core Lightning Rest",{corelightning_rest_url:"Endpoint",corelightning_rest_cert:"Certificate",corelightning_rest_macaroon:"Macaroon"}],["LndRestWallet","Lightning Network Daemon (LND Rest)",{lnd_rest_endpoint:"Endpoint",lnd_rest_cert:"Certificate",lnd_rest_macaroon:"Macaroon",lnd_rest_macaroon_encrypted:"Encrypted Macaroon",lnd_rest_route_hints:"Enable Route Hints"}],["LndWallet","Lightning Network Daemon (LND)",{lnd_grpc_endpoint:"Endpoint",lnd_grpc_cert:"Certificate",lnd_grpc_port:"Port",lnd_grpc_admin_macaroon:"Admin Macaroon",lnd_grpc_macaroon_encrypted:"Encrypted Macaroon"}],["LnTipsWallet","LN.Tips",{lntips_api_endpoint:"Endpoint",lntips_api_key:"API Key"}],["LNPayWallet","LN Pay",{lnpay_api_endpoint:"Endpoint",lnpay_api_key:"API Key",lnpay_wallet_key:"Wallet Key"}],["EclairWallet","Eclair (ACINQ)",{eclair_url:"URL",eclair_pass:"Password"}],["LNbitsWallet","LNbits",{lnbits_endpoint:"Endpoint",lnbits_key:"Admin Key"}],["BlinkWallet","Blink",{blink_api_endpoint:"Endpoint",blink_ws_endpoint:"WebSocket",blink_token:"Key"}],["AlbyWallet","Alby",{alby_api_endpoint:"Endpoint",alby_access_token:"Key"}],["BoltzWallet","Boltz",{boltz_client_endpoint:"Endpoint",boltz_client_macaroon:"Admin Macaroon path or hex",boltz_client_cert:"Certificate path or hex",boltz_client_wallet:"Wallet Name"}],["ZBDWallet","ZBD",{zbd_api_endpoint:"Endpoint",zbd_api_key:"Key"}],["PhoenixdWallet","Phoenixd",{phoenixd_api_endpoint:"Endpoint",phoenixd_api_password:"Key"}],["OpenNodeWallet","OpenNode",{opennode_api_endpoint:"Endpoint",opennode_key:"Key"}],["ClicheWallet","Cliche (NBD)",{cliche_endpoint:"Endpoint"}],["SparkWallet","Spark",{spark_url:"Endpoint",spark_token:"Token"}],["NWCWallet","Nostr Wallet Connect",{nwc_pairing_url:"Pairing URL"}],["BreezSdkWallet","Breez SDK",{breez_api_key:"Breez API Key",breez_greenlight_seed:"Greenlight Seed",breez_greenlight_device_key:"Greenlight Device Key",breez_greenlight_device_cert:"Greenlight Device Cert",breez_greenlight_invite_code:"Greenlight Invite Code"}]]}),template:'\n
\n
Funding Sources
\n
\n
\n

Active Funding (Requires server restart)

\n \n
\n
\n \n
\n
\n
\n \n
\n
\n
\n \n
\n '}),window.app.component("lnbits-extension-settings-form",{name:"lnbits-extension-settings-form",props:["options","adminkey","endpoint"],methods:{async updateSettings(){if(!this.settings)return Quasar.Notify.create({message:"No settings to update",type:"negative"});try{const{data:e}=await LNbits.api.request("PUT",this.endpoint,this.adminkey,this.settings);this.settings=e}catch(e){LNbits.utils.notifyApiError(e)}},getSettings:async function(){try{const{data:e}=await LNbits.api.request("GET",this.endpoint,this.adminkey);this.settings=e}catch(e){LNbits.utils.notifyApiError(e)}},resetSettings:async function(){LNbits.utils.confirmDialog("Are you sure you want to reset the settings?").onOk((async()=>{try{await LNbits.api.request("DELETE",this.endpoint,this.adminkey),await this.getSettings()}catch(e){LNbits.utils.notifyApiError(e)}}))}},created:async function(){await this.getSettings()},template:'\n \n \n
\n Update\n Reset\n \n
\n
\n ',data:function(){return{settings:void 0}}}),window.app.component("lnbits-extension-settings-btn-dialog",{name:"lnbits-extension-settings-btn-dialog",props:["options","adminkey","endpoint"],template:'\n \n \n \n \n \n \n \n \n \n ',data:function(){return{show:!1}}}),window.app.component("lnbits-extension-rating",{name:"lnbits-extension-rating",props:["rating"],template:'\n
\n \n \n
\n '}),window.app.component("payment-list",{name:"payment-list",props:["update","wallet","mobileSimple","lazy"],mixins:[window.windowMixin],data:function(){return{denomination:LNBITS_DENOMINATION,payments:[],paymentsTable:{columns:[{name:"time",align:"left",label:this.$t("memo")+"/"+this.$t("date"),field:"date",sortable:!0},{name:"amount",align:"right",label:this.$t("amount")+" ("+LNBITS_DENOMINATION+")",field:"sat",sortable:!0}],pagination:{rowsPerPage:10,page:1,sortBy:"time",descending:!0,rowsNumber:10},search:null,loading:!1},exportTagName:"",exportPaymentTagList:[],paymentsCSV:{columns:[{name:"pending",align:"left",label:"Pending",field:"pending"},{name:"memo",align:"left",label:this.$t("memo"),field:"memo"},{name:"time",align:"left",label:this.$t("date"),field:"date",sortable:!0},{name:"amount",align:"right",label:this.$t("amount")+" ("+LNBITS_DENOMINATION+")",field:"sat",sortable:!0},{name:"fee",align:"right",label:this.$t("fee")+" (m"+LNBITS_DENOMINATION+")",field:"fee"},{name:"tag",align:"right",label:this.$t("tag"),field:"tag"},{name:"payment_hash",align:"right",label:this.$t("payment_hash"),field:"payment_hash"},{name:"payment_proof",align:"right",label:this.$t("payment_proof"),field:"payment_proof"},{name:"webhook",align:"right",label:this.$t("webhook"),field:"webhook"},{name:"fiat_currency",align:"right",label:"Fiat Currency",field:e=>e.extra.wallet_fiat_currency},{name:"fiat_amount",align:"right",label:"Fiat Amount",field:e=>e.extra.wallet_fiat_amount}],filter:null,loading:!1}}},computed:{filteredPayments:function(){var e=this.paymentsTable.search;return e&&""!==e?LNbits.utils.search(this.payments,e):this.payments},paymentsOmitter(){return this.$q.screen.lt.md&&this.mobileSimple?this.payments.length>0?[this.payments[0]]:[]:this.payments},pendingPaymentsExist:function(){return-1!==this.payments.findIndex((e=>e.pending))}},methods:{fetchPayments:function(e){const n=LNbits.utils.prepareFilterQuery(this.paymentsTable,e);return LNbits.api.getPayments(this.wallet,n).then((e=>{this.paymentsTable.loading=!1,this.paymentsTable.pagination.rowsNumber=e.data.total,this.payments=e.data.data.map((e=>LNbits.map.payment(e)))})).catch((e=>{this.paymentsTable.loading=!1,LNbits.utils.notifyApiError(e)}))},paymentTableRowKey:function(e){return e.payment_hash+e.amount},exportCSV(e=!1){const n=this.paymentsTable.pagination,t={sortby:n.sortBy??"time",direction:n.descending?"desc":"asc"},i=new URLSearchParams(t);LNbits.api.getPayments(this.wallet,i).then((n=>{let t=n.data.data.map(LNbits.map.payment),i=this.paymentsCSV.columns;if(e){this.exportPaymentTagList.length&&(t=t.filter((e=>this.exportPaymentTagList.includes(e.tag))));const e=Object.keys(t.reduce(((e,n)=>({...e,...n.details})),{})).map((e=>({name:e,align:"right",label:e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g," $1"),field:n=>n.details[e],format:e=>"object"==typeof e?JSON.stringify(e):e})));i=this.paymentsCSV.columns.concat(e)}LNbits.utils.exportCSV(i,t,this.wallet.name+"-payments")}))},addFilterTag:function(){if(!this.exportTagName)return;const e=this.exportTagName.trim();this.exportPaymentTagList=this.exportPaymentTagList.filter((n=>n!==e)),this.exportPaymentTagList.push(e),this.exportTagName=""},removeExportTag:function(e){this.exportPaymentTagList=this.exportPaymentTagList.filter((n=>n!==e))},formatCurrency:function(e,n){try{return LNbits.utils.formatCurrency(e,n)}catch(n){return console.error(n),`${e} ???`}}},watch:{lazy:function(e){!0===e&&this.fetchPayments()},update:function(){this.fetchPayments()}},created:function(){void 0===this.lazy&&this.fetchPayments()},template:'\n \n \n
\n
\n \n
\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n\n \n \n \n \n \n
\n \n \n
\n
\n \n \n \n \n \n \n
\n \n '}),window.app.component("payment-chart",{name:"payment-chart",props:["wallet"],mixins:[window.windowMixin],data:function(){return{paymentsChart:{show:!1,group:{value:"hour",label:"Hour"},groupOptions:[{value:"hour",label:"Hour"},{value:"day",label:"Day"},{value:"week",label:"Week"},{value:"month",label:"Month"},{value:"year",label:"Year"}],instance:null}}},methods:{showChart:function(){this.paymentsChart.show=!0,LNbits.api.request("GET","/api/v1/payments/history?group="+this.paymentsChart.group.value,this.wallet.adminkey).then((e=>{this.$nextTick((()=>{this.paymentsChart.instance&&this.paymentsChart.instance.destroy(),this.paymentsChart.instance=generateChart(this.$refs.canvas,e.data)}))})).catch((e=>{LNbits.utils.notifyApiError(e),this.paymentsChart.show=!1}))}},template:'\n \n \n \n \n \n \n\n \n \n \n
\n
Payments Chart
\n \n \n
\n \n
\n
\n
\n
\n '}),window.app.component(QrcodeVue),window.app.component("lnbits-fsat",{props:{amount:{type:Number,default:0}},template:"{{ fsat }}",computed:{fsat:function(){return LNbits.utils.formatSat(this.amount)}}}),window.app.component("lnbits-wallet-list",{props:["balance"],data:function(){return{user:null,activeWallet:null,balance:0,showForm:!1,walletName:"",LNBITS_DENOMINATION:LNBITS_DENOMINATION}},template:'\n \n \n \n \n \n \n \n \n \n {{ wallet.name }}\n {{ parseFloat(String(wallet.live_fsat).replaceAll(",", "")) / 100 }} {{ LNBITS_DENOMINATION }}\n {{ wallet.live_fsat }} {{ LNBITS_DENOMINATION }}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ',computed:{wallets:function(){var e=this.balance;return this.user.wallets.map((function(n){return n.live_fsat=e.length&&e[0]===n.id?LNbits.utils.formatSat(e[1]):n.fsat,n}))}},methods:{createWallet:function(){LNbits.api.createWallet(this.user.wallets[0],this.walletName)}},created:function(){window.user&&(this.user=LNbits.map.user(window.user)),window.wallet&&(this.activeWallet=LNbits.map.wallet(window.wallet)),document.addEventListener("updateWalletBalance",this.updateWalletBalance)}}),window.app.component("lnbits-extension-list",{data:function(){return{extensions:[],user:null}},template:'\n \n \n \n \n \n \n \n \n \n {{ extension.name }} \n \n \n \n \n \n
\n
\n ',computed:{userExtensions:function(){if(!this.user)return[];var e=window.location.pathname,n=this.user.extensions;return this.extensions.filter((function(e){return-1!==n.indexOf(e.code)})).map((function(n){return n.isActive=e.startsWith(n.url),n}))}},created:function(){window.extensions&&(this.extensions=window.extensions.map((function(e){return LNbits.map.extension(e)})).sort((function(e,n){return e.name.localeCompare(n.name)}))),window.user&&(this.user=LNbits.map.user(window.user))}}),window.app.component("lnbits-manage",{props:["showAdmin","showNode","showExtensions","showUsers"],methods:{isActive:function(e){return window.location.pathname===e}},data:function(){return{extensions:[],user:null}},template:'\n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n
\n ',created:function(){window.user&&(this.user=LNbits.map.user(window.user))}}),window.app.component("lnbits-payment-details",{props:["payment"],mixins:[window.windowMixin],data:function(){return{LNBITS_DENOMINATION:LNBITS_DENOMINATION}},template:'\n
\n\n
\n \n #{{ payment.tag }}\n \n
\n\n
\n :\n {{ payment.date }} ({{ payment.dateFrom }})\n
\n\n
\n :\n {{ payment.expirydate }} ({{ payment.expirydateFrom }})\n
\n\n
\n :\n {{ (payment.amount / 1000).toFixed(3) }} {{LNBITS_DENOMINATION}}\n
\n\n
\n :\n {{ (payment.fee / 1000).toFixed(3) }} {{LNBITS_DENOMINATION}}\n
\n\n
\n : {{ payment.payment_hash }}\n \n
\n\n
\n : {{ payment.memo }}\n
\n\n
\n : {{ payment.webhook }}: \n {{ webhookStatusText }}\n \n
\n\n
\n : {{ payment.preimage }}\n
\n\n
\n \n extra\n \n {{ entry.key }}:\n {{ entry.value }}\n
\n\n
\n Success action:\n \n
\n\n
\n ',computed:{hasPreimage(){return this.payment.preimage&&"0000000000000000000000000000000000000000000000000000000000000000"!==this.payment.preimage},hasExpiry(){return!!this.payment.expiry},hasSuccessAction(){return this.hasPreimage&&this.payment.extra&&this.payment.extra.success_action},webhookStatusColor(){return this.payment.webhook_status>=300||this.payment.webhook_status<0?"red-10":this.payment.webhook_status?"green-10":"cyan-7"},webhookStatusText(){return this.payment.webhook_status?this.payment.webhook_status:"not sent yet"},hasTag(){return this.payment.extra&&!!this.payment.extra.tag},extras(){if(!this.payment.extra)return[];let e=_.omit(this.payment.extra,["tag","success_action"]);return Object.keys(e).map((n=>({key:n,value:e[n]})))}}}),window.app.component("lnbits-lnurlpay-success-action",{props:["payment","success_action"],data(){return{decryptedValue:this.success_action.ciphertext}},template:'\n
\n

{{ success_action.message || success_action.description }}

\n \n {{ decryptedValue }}\n \n

\n {{ success_action.url }}\n

\n
\n ',mounted:function(){if("aes"!==this.success_action.tag)return null;decryptLnurlPayAES(this.success_action,this.payment.preimage).then((e=>{this.decryptedValue=e}))}}),window.app.component("lnbits-qrcode",{mixins:[window.windowMixin],components:{QrcodeVue:QrcodeVue},props:["value"],data:()=>({logo:LNBITS_QR_LOGO}),template:'\n
\n \n ...\n
\n '}),window.app.component("lnbits-notifications-btn",{mixins:[window.windowMixin],props:["pubkey"],data:()=>({isSupported:!1,isSubscribed:!1,isPermissionGranted:!1,isPermissionDenied:!1}),template:'\n \n Subscribe to notifications\n Unsubscribe from notifications\n \n Notifications are disabled,
please enable or reset permissions\n
\n Notifications are not supported\n \n ',methods:{urlB64ToUint8Array(e){const n=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),t=atob(n),i=new Uint8Array(t.length);for(let e=0;en!==e)),this.$q.localStorage.set("lnbits.webpush.subscribedUsers",JSON.stringify(n))},isUserSubscribed(e){return(JSON.parse(this.$q.localStorage.getItem("lnbits.webpush.subscribedUsers"))||[]).includes(e)},subscribe(){var e=this;this.isSupported&&!this.isPermissionDenied&&(Notification.requestPermission().then((e=>{this.isPermissionGranted="granted"===e,this.isPermissionDenied="denied"===e})).catch((function(e){console.log(e)})),navigator.serviceWorker.ready.then((n=>{navigator.serviceWorker.getRegistration().then((n=>{n.pushManager.getSubscription().then((function(t){if(null===t||!e.isUserSubscribed(e.g.user.id)){const t={applicationServerKey:e.urlB64ToUint8Array(e.pubkey),userVisibleOnly:!0};n.pushManager.subscribe(t).then((function(n){LNbits.api.request("POST","/api/v1/webpush",e.g.user.wallets[0].adminkey,{subscription:JSON.stringify(n)}).then((function(n){e.saveUserSubscribed(n.data.user),e.isSubscribed=!0})).catch((function(e){LNbits.utils.notifyApiError(e)}))}))}})).catch((function(e){console.log(e)}))}))})))},unsubscribe(){var e=this;navigator.serviceWorker.ready.then((n=>{n.pushManager.getSubscription().then((n=>{n&&LNbits.api.request("DELETE","/api/v1/webpush?endpoint="+btoa(n.endpoint),e.g.user.wallets[0].adminkey).then((function(){e.removeUserSubscribed(e.g.user.id),e.isSubscribed=!1})).catch((function(e){LNbits.utils.notifyApiError(e)}))}))})).catch((function(e){console.log(e)}))},checkSupported:function(){let e="https:"===window.location.protocol,n="serviceWorker"in navigator,t="Notification"in window,i="PushManager"in window;return this.isSupported=e&&n&&t&&i,this.isSupported||console.log("Notifications disabled because requirements are not met:",{HTTPS:e,"Service Worker API":n,"Notification API":t,"Push API":i}),this.isSupported},updateSubscriptionStatus:async function(){var e=this;await navigator.serviceWorker.ready.then((n=>{n.pushManager.getSubscription().then((n=>{e.isSubscribed=!!n&&e.isUserSubscribed(e.g.user.id)}))})).catch((function(e){console.log(e)}))}},created:function(){this.isPermissionDenied="denied"===Notification.permission,this.checkSupported()&&this.updateSubscriptionStatus()}}),window.app.component("lnbits-dynamic-fields",{mixins:[window.windowMixin],props:["options","value"],data:()=>({formData:null,rules:[e=>!!e||"Field is required"]}),template:'\n
\n
\n
\n

\n ()\n

\n \n \n
\n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n
\n \n \n
\n
\n
\n
\n ',methods:{applyRules(e){return e?this.rules:[]},buildData(e,n={}){return e.reduce(((e,t)=>(t.options?.length?e[t.name]=this.buildData(t.options,n[t.name]):e[t.name]=n[t.name]??t.default,e)),{})},handleValueChanged(){this.$emit("input",this.formData)}},created:function(){this.formData=this.buildData(this.options,this.value)}}),window.app.component("lnbits-update-balance",{mixins:[window.windowMixin],props:["wallet_id","callback"],computed:{denomination:()=>LNBITS_DENOMINATION,admin(){return this.g.user.admin}},data:function(){return{credit:0}},methods:{updateBalance:function(e){LNbits.api.updateBalance(e,this.wallet_id).then((n=>{if("Success"!==n.data.status)throw new Error(n.data);this.callback({success:!0,credit:parseInt(e),wallet_id:this.wallet_id})})).then((n=>(e=parseInt(e),Quasar.Notify.create({type:"positive",message:this.$t("wallet_topup_ok",{amount:e}),icon:null}),e))).catch((function(e){LNbits.utils.notifyApiError(e)}))}},template:'\n \n \n \n \n \n \n Topup Wallet\n \n '}),window.app.use(VueQrcodeReader),window.app.use(Quasar),window.app.use(window.i18n),window.app.mount("#vue"); +function generateChart(t,e){const n=e.reduce(((t,e)=>(t.labels.push(e.date),t.income.push(e.income),t.spending.push(e.spending),t.cumulative.push(e.balance),t)),{labels:[],income:[],spending:[],cumulative:[]});return new Chart(t.getContext("2d"),{type:"bar",data:{labels:n.labels,datasets:[{data:n.cumulative,type:"line",label:"balance",backgroundColor:"#673ab7",borderColor:"#673ab7",borderWidth:4,pointRadius:3,fill:!1},{data:n.income,type:"bar",label:"in",barPercentage:.75,backgroundColor:"rgba(76, 175, 80, 0.5)"},{data:n.spending,type:"bar",label:"out",barPercentage:.75,backgroundColor:"rgba(233, 30, 99, 0.5)"}]},options:{title:{text:"Chart.js Combo Time Scale"},tooltips:{mode:"index",intersect:!1},scales:{xAxes:[{type:"time",display:!0,time:{minUnit:"hour",stepSize:3}}]},animation:{duration:0},elements:{line:{tension:0}}}})}window.app.component("lnbits-funding-sources",{template:"#lnbits-funding-sources",mixins:[window.windowMixin],props:["form-data","allowed-funding-sources"],methods:{getFundingSourceLabel(t){const e=this.rawFundingSources.find((e=>e[0]===t));return e?e[1]:t}},computed:{fundingSources(){let t=[];for(const[e,n,i]of this.rawFundingSources){const n={};if(null!==i)for(let[t,e]of Object.entries(i))n[t]={label:e,value:null};t.push([e,n])}return new Map(t)},sortedAllowedFundingSources(){return this.allowedFundingSources.sort()}},data:()=>({rawFundingSources:[["VoidWallet","Void Wallet",null],["FakeWallet","Fake Wallet",{fake_wallet_secret:"Secret"}],["CoreLightningWallet","Core Lightning",{corelightning_rpc:"Endpoint",corelightning_pay_command:"Custom Pay Command"}],["CoreLightningRestWallet","Core Lightning Rest",{corelightning_rest_url:"Endpoint",corelightning_rest_cert:"Certificate",corelightning_rest_macaroon:"Macaroon"}],["LndRestWallet","Lightning Network Daemon (LND Rest)",{lnd_rest_endpoint:"Endpoint",lnd_rest_cert:"Certificate",lnd_rest_macaroon:"Macaroon",lnd_rest_macaroon_encrypted:"Encrypted Macaroon",lnd_rest_route_hints:"Enable Route Hints"}],["LndWallet","Lightning Network Daemon (LND)",{lnd_grpc_endpoint:"Endpoint",lnd_grpc_cert:"Certificate",lnd_grpc_port:"Port",lnd_grpc_admin_macaroon:"Admin Macaroon",lnd_grpc_macaroon_encrypted:"Encrypted Macaroon"}],["LnTipsWallet","LN.Tips",{lntips_api_endpoint:"Endpoint",lntips_api_key:"API Key"}],["LNPayWallet","LN Pay",{lnpay_api_endpoint:"Endpoint",lnpay_api_key:"API Key",lnpay_wallet_key:"Wallet Key"}],["EclairWallet","Eclair (ACINQ)",{eclair_url:"URL",eclair_pass:"Password"}],["LNbitsWallet","LNbits",{lnbits_endpoint:"Endpoint",lnbits_key:"Admin Key"}],["BlinkWallet","Blink",{blink_api_endpoint:"Endpoint",blink_ws_endpoint:"WebSocket",blink_token:"Key"}],["AlbyWallet","Alby",{alby_api_endpoint:"Endpoint",alby_access_token:"Key"}],["BoltzWallet","Boltz",{boltz_client_endpoint:"Endpoint",boltz_client_macaroon:"Admin Macaroon path or hex",boltz_client_cert:"Certificate path or hex",boltz_client_wallet:"Wallet Name"}],["ZBDWallet","ZBD",{zbd_api_endpoint:"Endpoint",zbd_api_key:"Key"}],["PhoenixdWallet","Phoenixd",{phoenixd_api_endpoint:"Endpoint",phoenixd_api_password:"Key"}],["OpenNodeWallet","OpenNode",{opennode_api_endpoint:"Endpoint",opennode_key:"Key"}],["ClicheWallet","Cliche (NBD)",{cliche_endpoint:"Endpoint"}],["SparkWallet","Spark",{spark_url:"Endpoint",spark_token:"Token"}],["NWCWallet","Nostr Wallet Connect",{nwc_pairing_url:"Pairing URL"}],["BreezSdkWallet","Breez SDK",{breez_api_key:"Breez API Key",breez_greenlight_seed:"Greenlight Seed",breez_greenlight_device_key:"Greenlight Device Key",breez_greenlight_device_cert:"Greenlight Device Cert",breez_greenlight_invite_code:"Greenlight Invite Code"}]]})}),window.app.component("lnbits-extension-settings-form",{name:"lnbits-extension-settings-form",template:"#lnbits-extension-settings-form",props:["options","adminkey","endpoint"],methods:{async updateSettings(){if(!this.settings)return Quasar.Notify.create({message:"No settings to update",type:"negative"});try{const{data:t}=await LNbits.api.request("PUT",this.endpoint,this.adminkey,this.settings);this.settings=t}catch(t){LNbits.utils.notifyApiError(t)}},getSettings:async function(){try{const{data:t}=await LNbits.api.request("GET",this.endpoint,this.adminkey);this.settings=t}catch(t){LNbits.utils.notifyApiError(t)}},resetSettings:async function(){LNbits.utils.confirmDialog("Are you sure you want to reset the settings?").onOk((async()=>{try{await LNbits.api.request("DELETE",this.endpoint,this.adminkey),await this.getSettings()}catch(t){LNbits.utils.notifyApiError(t)}}))}},created:async function(){await this.getSettings()},data:function(){return{settings:void 0}}}),window.app.component("lnbits-extension-settings-btn-dialog",{template:"#lnbits-extension-settings-btn-dialog",name:"lnbits-extension-settings-btn-dialog",props:["options","adminkey","endpoint"],data:function(){return{show:!1}}}),window.app.component("payment-list",{name:"payment-list",template:"#payment-list",props:["update","wallet","mobileSimple","lazy"],mixins:[window.windowMixin],data:function(){return{denomination:LNBITS_DENOMINATION,payments:[],paymentsTable:{columns:[{name:"time",align:"left",label:this.$t("memo")+"/"+this.$t("date"),field:"date",sortable:!0},{name:"amount",align:"right",label:this.$t("amount")+" ("+LNBITS_DENOMINATION+")",field:"sat",sortable:!0}],pagination:{rowsPerPage:10,page:1,sortBy:"time",descending:!0,rowsNumber:10},search:null,loading:!1},exportTagName:"",exportPaymentTagList:[],paymentsCSV:{columns:[{name:"pending",align:"left",label:"Pending",field:"pending"},{name:"memo",align:"left",label:this.$t("memo"),field:"memo"},{name:"time",align:"left",label:this.$t("date"),field:"date",sortable:!0},{name:"amount",align:"right",label:this.$t("amount")+" ("+LNBITS_DENOMINATION+")",field:"sat",sortable:!0},{name:"fee",align:"right",label:this.$t("fee")+" (m"+LNBITS_DENOMINATION+")",field:"fee"},{name:"tag",align:"right",label:this.$t("tag"),field:"tag"},{name:"payment_hash",align:"right",label:this.$t("payment_hash"),field:"payment_hash"},{name:"payment_proof",align:"right",label:this.$t("payment_proof"),field:"payment_proof"},{name:"webhook",align:"right",label:this.$t("webhook"),field:"webhook"},{name:"fiat_currency",align:"right",label:"Fiat Currency",field:t=>t.extra.wallet_fiat_currency},{name:"fiat_amount",align:"right",label:"Fiat Amount",field:t=>t.extra.wallet_fiat_amount}],filter:null,loading:!1}}},computed:{filteredPayments:function(){var t=this.paymentsTable.search;return t&&""!==t?LNbits.utils.search(this.payments,t):this.payments},paymentsOmitter(){return this.$q.screen.lt.md&&this.mobileSimple?this.payments.length>0?[this.payments[0]]:[]:this.payments},pendingPaymentsExist:function(){return-1!==this.payments.findIndex((t=>t.pending))}},methods:{fetchPayments:function(t){const e=LNbits.utils.prepareFilterQuery(this.paymentsTable,t);return LNbits.api.getPayments(this.wallet,e).then((t=>{this.paymentsTable.loading=!1,this.paymentsTable.pagination.rowsNumber=t.data.total,this.payments=t.data.data.map((t=>LNbits.map.payment(t)))})).catch((t=>{this.paymentsTable.loading=!1,LNbits.utils.notifyApiError(t)}))},paymentTableRowKey:function(t){return t.payment_hash+t.amount},exportCSV(t=!1){const e=this.paymentsTable.pagination,n={sortby:e.sortBy??"time",direction:e.descending?"desc":"asc"},i=new URLSearchParams(n);LNbits.api.getPayments(this.wallet,i).then((e=>{let n=e.data.data.map(LNbits.map.payment),i=this.paymentsCSV.columns;if(t){this.exportPaymentTagList.length&&(n=n.filter((t=>this.exportPaymentTagList.includes(t.tag))));const t=Object.keys(n.reduce(((t,e)=>({...t,...e.details})),{})).map((t=>({name:t,align:"right",label:t.charAt(0).toUpperCase()+t.slice(1).replace(/([A-Z])/g," $1"),field:e=>e.details[t],format:t=>"object"==typeof t?JSON.stringify(t):t})));i=this.paymentsCSV.columns.concat(t)}LNbits.utils.exportCSV(i,n,this.wallet.name+"-payments")}))},addFilterTag:function(){if(!this.exportTagName)return;const t=this.exportTagName.trim();this.exportPaymentTagList=this.exportPaymentTagList.filter((e=>e!==t)),this.exportPaymentTagList.push(t),this.exportTagName=""},removeExportTag:function(t){this.exportPaymentTagList=this.exportPaymentTagList.filter((e=>e!==t))},formatCurrency:function(t,e){try{return LNbits.utils.formatCurrency(t,e)}catch(e){return console.error(e),`${t} ???`}}},watch:{lazy:function(t){!0===t&&this.fetchPayments()},update:function(){this.fetchPayments()}},created:function(){void 0===this.lazy&&this.fetchPayments()}}),window.app.component("payment-chart",{template:"#payment-chart",name:"payment-chart",props:["wallet"],mixins:[window.windowMixin],data:function(){return{paymentsChart:{show:!1,group:{value:"hour",label:"Hour"},groupOptions:[{value:"hour",label:"Hour"},{value:"day",label:"Day"},{value:"week",label:"Week"},{value:"month",label:"Month"},{value:"year",label:"Year"}],instance:null}}},methods:{showChart:function(){this.paymentsChart.show=!0,LNbits.api.request("GET","/api/v1/payments/history?group="+this.paymentsChart.group.value,this.wallet.adminkey).then((t=>{this.$nextTick((()=>{this.paymentsChart.instance&&this.paymentsChart.instance.destroy(),this.paymentsChart.instance=generateChart(this.$refs.canvas,t.data)}))})).catch((t=>{LNbits.utils.notifyApiError(t),this.paymentsChart.show=!1}))}}}),window.app.component(QrcodeVue),window.app.component("lnbits-extension-rating",{template:"#lnbits-extension-rating",name:"lnbits-extension-rating",props:["rating"]}),window.app.component("lnbits-fsat",{template:"{{ fsat }}",props:{amount:{type:Number,default:0}},computed:{fsat:function(){return LNbits.utils.formatSat(this.amount)}}}),window.app.component("lnbits-wallet-list",{template:"#lnbits-wallet-list",props:["balance"],data:function(){return{user:null,activeWallet:null,balance:0,showForm:!1,walletName:"",LNBITS_DENOMINATION:LNBITS_DENOMINATION}},computed:{wallets:function(){var t=this.balance;return this.user.wallets.map((function(e){return e.live_fsat=t.length&&t[0]===e.id?LNbits.utils.formatSat(t[1]):e.fsat,e}))}},methods:{createWallet:function(){LNbits.api.createWallet(this.user.wallets[0],this.walletName)}},created:function(){window.user&&(this.user=LNbits.map.user(window.user)),window.wallet&&(this.activeWallet=LNbits.map.wallet(window.wallet)),document.addEventListener("updateWalletBalance",this.updateWalletBalance)}}),window.app.component("lnbits-extension-list",{template:"#lnbits-extension-list",data:function(){return{extensions:[],user:null}},computed:{userExtensions:function(){if(!this.user)return[];var t=window.location.pathname,e=this.user.extensions;return this.extensions.filter((function(t){return-1!==e.indexOf(t.code)})).map((function(e){return e.isActive=t.startsWith(e.url),e}))}},created:function(){window.extensions&&(this.extensions=window.extensions.map((function(t){return LNbits.map.extension(t)})).sort((function(t,e){return t.name.localeCompare(e.name)}))),window.user&&(this.user=LNbits.map.user(window.user))}}),window.app.component("lnbits-manage",{template:"#lnbits-manage",props:["showAdmin","showNode","showExtensions","showUsers"],methods:{isActive:function(t){return window.location.pathname===t}},data:()=>({extensions:[],user:null}),created(){window.user&&(this.user=LNbits.map.user(window.user))}}),window.app.component("lnbits-payment-details",{template:"#lnbits-payment-details",props:["payment"],mixins:[window.windowMixin],data:function(){return{LNBITS_DENOMINATION:LNBITS_DENOMINATION}},computed:{hasPreimage(){return this.payment.preimage&&"0000000000000000000000000000000000000000000000000000000000000000"!==this.payment.preimage},hasExpiry(){return!!this.payment.expiry},hasSuccessAction(){return this.hasPreimage&&this.payment.extra&&this.payment.extra.success_action},webhookStatusColor(){return this.payment.webhook_status>=300||this.payment.webhook_status<0?"red-10":this.payment.webhook_status?"green-10":"cyan-7"},webhookStatusText(){return this.payment.webhook_status?this.payment.webhook_status:"not sent yet"},hasTag(){return this.payment.extra&&!!this.payment.extra.tag},extras(){if(!this.payment.extra)return[];let t=_.omit(this.payment.extra,["tag","success_action"]);return Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),window.app.component("lnbits-lnurlpay-success-action",{template:"#lnbits-lnurlpay-success-action",props:["payment","success_action"],data(){return{decryptedValue:this.success_action.ciphertext}},mounted:function(){if("aes"!==this.success_action.tag)return null;decryptLnurlPayAES(this.success_action,this.payment.preimage).then((t=>{this.decryptedValue=t}))}}),window.app.component("lnbits-qrcode",{template:"#lnbits-qrcode",mixins:[window.windowMixin],components:{QrcodeVue:QrcodeVue},props:["value"],data:()=>({logo:LNBITS_QR_LOGO})}),window.app.component("lnbits-notifications-btn",{template:"#lnbits-notifications-btn",mixins:[window.windowMixin],props:["pubkey"],data:()=>({isSupported:!1,isSubscribed:!1,isPermissionGranted:!1,isPermissionDenied:!1}),methods:{urlB64ToUint8Array(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(e),i=new Uint8Array(n.length);for(let t=0;te!==t)),this.$q.localStorage.set("lnbits.webpush.subscribedUsers",JSON.stringify(e))},isUserSubscribed(t){return(JSON.parse(this.$q.localStorage.getItem("lnbits.webpush.subscribedUsers"))||[]).includes(t)},subscribe(){var t=this;this.isSupported&&!this.isPermissionDenied&&(Notification.requestPermission().then((t=>{this.isPermissionGranted="granted"===t,this.isPermissionDenied="denied"===t})).catch((function(t){console.log(t)})),navigator.serviceWorker.ready.then((e=>{navigator.serviceWorker.getRegistration().then((e=>{e.pushManager.getSubscription().then((function(n){if(null===n||!t.isUserSubscribed(t.g.user.id)){const n={applicationServerKey:t.urlB64ToUint8Array(t.pubkey),userVisibleOnly:!0};e.pushManager.subscribe(n).then((function(e){LNbits.api.request("POST","/api/v1/webpush",t.g.user.wallets[0].adminkey,{subscription:JSON.stringify(e)}).then((function(e){t.saveUserSubscribed(e.data.user),t.isSubscribed=!0})).catch((function(t){LNbits.utils.notifyApiError(t)}))}))}})).catch((function(t){console.log(t)}))}))})))},unsubscribe(){var t=this;navigator.serviceWorker.ready.then((e=>{e.pushManager.getSubscription().then((e=>{e&&LNbits.api.request("DELETE","/api/v1/webpush?endpoint="+btoa(e.endpoint),t.g.user.wallets[0].adminkey).then((function(){t.removeUserSubscribed(t.g.user.id),t.isSubscribed=!1})).catch((function(t){LNbits.utils.notifyApiError(t)}))}))})).catch((function(t){console.log(t)}))},checkSupported:function(){let t="https:"===window.location.protocol,e="serviceWorker"in navigator,n="Notification"in window,i="PushManager"in window;return this.isSupported=t&&e&&n&&i,this.isSupported||console.log("Notifications disabled because requirements are not met:",{HTTPS:t,"Service Worker API":e,"Notification API":n,"Push API":i}),this.isSupported},updateSubscriptionStatus:async function(){var t=this;await navigator.serviceWorker.ready.then((e=>{e.pushManager.getSubscription().then((e=>{t.isSubscribed=!!e&&t.isUserSubscribed(t.g.user.id)}))})).catch((function(t){console.log(t)}))}},created:function(){this.isPermissionDenied="denied"===Notification.permission,this.checkSupported()&&this.updateSubscriptionStatus()}}),window.app.component("lnbits-dynamic-fields",{template:"#lnbits-dynamic-fields",mixins:[window.windowMixin],props:["options","value"],data:()=>({formData:null,rules:[t=>!!t||"Field is required"]}),methods:{applyRules(t){return t?this.rules:[]},buildData(t,e={}){return t.reduce(((t,n)=>(n.options?.length?t[n.name]=this.buildData(n.options,e[n.name]):t[n.name]=e[n.name]??n.default,t)),{})},handleValueChanged(){this.$emit("input",this.formData)}},created(){this.formData=this.buildData(this.options,this.value)}}),window.app.component("lnbits-update-balance",{template:"#lnbits-update-balance",mixins:[window.windowMixin],props:["wallet_id","callback"],computed:{denomination:()=>LNBITS_DENOMINATION,admin(){return this.g.user.admin}},data:function(){return{credit:0}},methods:{updateBalance:function(t){LNbits.api.updateBalance(t,this.wallet_id).then((e=>{if("Success"!==e.data.status)throw new Error(e.data);this.callback({success:!0,credit:parseInt(t),wallet_id:this.wallet_id})})).then((e=>(t=parseInt(t),Quasar.Notify.create({type:"positive",message:this.$t("wallet_topup_ok",{amount:t}),icon:null}),t))).catch((function(t){LNbits.utils.notifyApiError(t)}))}}}),window.app.use(VueQrcodeReader),window.app.use(Quasar),window.app.use(window.i18n),window.app.mount("#vue"); diff --git a/lnbits/static/js/components.js b/lnbits/static/js/components.js index 720394aa6..fc723d870 100644 --- a/lnbits/static/js/components.js +++ b/lnbits/static/js/components.js @@ -1,13 +1,19 @@ window.app.component(QrcodeVue) +window.app.component('lnbits-extension-rating', { + template: '#lnbits-extension-rating', + name: 'lnbits-extension-rating', + props: ['rating'] +}) + window.app.component('lnbits-fsat', { + template: '{{ fsat }}', props: { amount: { type: Number, default: 0 } }, - template: '{{ fsat }}', computed: { fsat: function () { return LNbits.utils.formatSat(this.amount) @@ -16,6 +22,7 @@ window.app.component('lnbits-fsat', { }) window.app.component('lnbits-wallet-list', { + template: '#lnbits-wallet-list', props: ['balance'], data: function () { return { @@ -27,52 +34,6 @@ window.app.component('lnbits-wallet-list', { LNBITS_DENOMINATION: LNBITS_DENOMINATION } }, - template: ` - - - - - - - - - - {{ wallet.name }} - {{ parseFloat(String(wallet.live_fsat).replaceAll(",", "")) / 100 }} {{ LNBITS_DENOMINATION }} - {{ wallet.live_fsat }} {{ LNBITS_DENOMINATION }} - - - - - - - - - - - - - - - - - - - - - - - - `, computed: { wallets: function () { var bal = this.balance @@ -102,37 +63,13 @@ window.app.component('lnbits-wallet-list', { }) window.app.component('lnbits-extension-list', { + template: '#lnbits-extension-list', data: function () { return { extensions: [], user: null } }, - template: ` - - - - - - - - - - {{ extension.name }} - - - - - -
-
- `, computed: { userExtensions: function () { if (!this.user) return [] @@ -168,59 +105,20 @@ window.app.component('lnbits-extension-list', { }) window.app.component('lnbits-manage', { + template: '#lnbits-manage', props: ['showAdmin', 'showNode', 'showExtensions', 'showUsers'], methods: { isActive: function (path) { return window.location.pathname === path } }, - data: function () { + data() { return { extensions: [], user: null } }, - template: ` - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- `, - - created: function () { + created() { if (window.user) { this.user = LNbits.map.user(window.user) } @@ -228,6 +126,7 @@ window.app.component('lnbits-manage', { }) window.app.component('lnbits-payment-details', { + template: '#lnbits-payment-details', props: ['payment'], mixins: [window.windowMixin], data: function () { @@ -235,72 +134,6 @@ window.app.component('lnbits-payment-details', { LNBITS_DENOMINATION: LNBITS_DENOMINATION } }, - template: ` -
- -
- - #{{ payment.tag }} - -
- -
- : - {{ payment.date }} ({{ payment.dateFrom }}) -
- -
- : - {{ payment.expirydate }} ({{ payment.expirydateFrom }}) -
- -
- : - {{ (payment.amount / 1000).toFixed(3) }} {{LNBITS_DENOMINATION}} -
- -
- : - {{ (payment.fee / 1000).toFixed(3) }} {{LNBITS_DENOMINATION}} -
- -
- : {{ payment.payment_hash }} - -
- -
- : {{ payment.memo }} -
- -
- : {{ payment.webhook }}:  - {{ webhookStatusText }} - -
- -
- : {{ payment.preimage }} -
- -
- - extra - - {{ entry.key }}: - {{ entry.value }} -
- -
- Success action: - -
- -
- `, computed: { hasPreimage() { return ( @@ -344,26 +177,15 @@ window.app.component('lnbits-payment-details', { }) window.app.component('lnbits-lnurlpay-success-action', { + template: '#lnbits-lnurlpay-success-action', props: ['payment', 'success_action'], data() { return { decryptedValue: this.success_action.ciphertext } }, - template: ` -
-

{{ success_action.message || success_action.description }}

- - {{ decryptedValue }} - -

- {{ success_action.url }} -

-
- `, mounted: function () { if (this.success_action.tag !== 'aes') return null - decryptLnurlPayAES(this.success_action, this.payment.preimage).then( value => { this.decryptedValue = value @@ -373,6 +195,7 @@ window.app.component('lnbits-lnurlpay-success-action', { }) window.app.component('lnbits-qrcode', { + template: '#lnbits-qrcode', mixins: [window.windowMixin], components: { QrcodeVue @@ -382,16 +205,11 @@ window.app.component('lnbits-qrcode', { return { logo: LNBITS_QR_LOGO } - }, - template: ` -
- - ... -
- ` + } }) window.app.component('lnbits-notifications-btn', { + template: '#lnbits-notifications-btn', mixins: [window.windowMixin], props: ['pubkey'], data() { @@ -402,26 +220,6 @@ window.app.component('lnbits-notifications-btn', { isPermissionDenied: false } }, - template: ` - - Subscribe to notifications - Unsubscribe from notifications - - Notifications are disabled,
please enable or reset permissions -
- Notifications are not supported -
- `, methods: { // converts base64 to Array buffer urlB64ToUint8Array(base64String) { @@ -605,6 +403,7 @@ window.app.component('lnbits-notifications-btn', { }) window.app.component('lnbits-dynamic-fields', { + template: '#lnbits-dynamic-fields', mixins: [window.windowMixin], props: ['options', 'value'], data() { @@ -613,111 +412,6 @@ window.app.component('lnbits-dynamic-fields', { rules: [val => !!val || 'Field is required'] } }, - - template: ` -
-
-
-

- () -

- - -
- - - - - -
- - - - - - - - - -
- - -
-
-
-
- `, methods: { applyRules(required) { return required ? this.rules : [] @@ -736,12 +430,13 @@ window.app.component('lnbits-dynamic-fields', { this.$emit('input', this.formData) } }, - created: function () { + created() { this.formData = this.buildData(this.options, this.value) } }) window.app.component('lnbits-update-balance', { + template: '#lnbits-update-balance', mixins: [window.windowMixin], props: ['wallet_id', 'callback'], computed: { @@ -786,35 +481,5 @@ window.app.component('lnbits-update-balance', { LNbits.utils.notifyApiError(error) }) } - }, - template: ` - - - - - - - Topup Wallet - - ` + } }) diff --git a/lnbits/static/js/components/extension-rating.js b/lnbits/static/js/components/extension-rating.js deleted file mode 100644 index 8626d2d97..000000000 --- a/lnbits/static/js/components/extension-rating.js +++ /dev/null @@ -1,16 +0,0 @@ -window.app.component('lnbits-extension-rating', { - name: 'lnbits-extension-rating', - props: ['rating'], - template: ` -
- - -
- ` -}) diff --git a/lnbits/static/js/components/extension-settings.js b/lnbits/static/js/components/extension-settings.js index 3e7b408a3..0aad57eaa 100644 --- a/lnbits/static/js/components/extension-settings.js +++ b/lnbits/static/js/components/extension-settings.js @@ -1,5 +1,6 @@ window.app.component('lnbits-extension-settings-form', { name: 'lnbits-extension-settings-form', + template: '#lnbits-extension-settings-form', props: ['options', 'adminkey', 'endpoint'], methods: { async updateSettings() { @@ -49,16 +50,6 @@ window.app.component('lnbits-extension-settings-form', { created: async function () { await this.getSettings() }, - template: ` - - -
- Update - Reset - -
-
- `, data: function () { return { settings: undefined @@ -67,21 +58,9 @@ window.app.component('lnbits-extension-settings-form', { }) window.app.component('lnbits-extension-settings-btn-dialog', { + template: '#lnbits-extension-settings-btn-dialog', name: 'lnbits-extension-settings-btn-dialog', props: ['options', 'adminkey', 'endpoint'], - template: ` - - - - - - - - - - `, data: function () { return { show: false diff --git a/lnbits/static/js/components/lnbits-funding-sources.js b/lnbits/static/js/components/lnbits-funding-sources.js index 9af85bdfe..e0f6fb4f0 100644 --- a/lnbits/static/js/components/lnbits-funding-sources.js +++ b/lnbits/static/js/components/lnbits-funding-sources.js @@ -1,4 +1,5 @@ window.app.component('lnbits-funding-sources', { + template: '#lnbits-funding-sources', mixins: [window.windowMixin], props: ['form-data', 'allowed-funding-sources'], methods: { @@ -196,45 +197,5 @@ window.app.component('lnbits-funding-sources', { ] ] } - }, - template: ` -
-
Funding Sources
-
-
-

Active Funding (Requires server restart)

- -
-
- -
-
-
- -
-
-
-
-
- ` + } }) diff --git a/lnbits/static/js/components/payment-chart.js b/lnbits/static/js/components/payment-chart.js index 08652ac04..3d9385fa0 100644 --- a/lnbits/static/js/components/payment-chart.js +++ b/lnbits/static/js/components/payment-chart.js @@ -35,14 +35,14 @@ function generateChart(canvas, rawData) { type: 'bar', label: 'in', barPercentage: 0.75, - backgroundColor: window.Color('rgb(76,175,80)').alpha(0.5).rgbString() // green + backgroundColor: 'rgba(76, 175, 80, 0.5)' // green }, { data: data.spending, type: 'bar', label: 'out', barPercentage: 0.75, - backgroundColor: window.Color('rgb(233,30,99)').alpha(0.5).rgbString() // pink + backgroundColor: 'rgba(233, 30, 99, 0.5)' // pink } ] }, @@ -81,6 +81,7 @@ function generateChart(canvas, rawData) { } window.app.component('payment-chart', { + template: '#payment-chart', name: 'payment-chart', props: ['wallet'], mixins: [window.windowMixin], @@ -128,30 +129,5 @@ window.app.component('payment-chart', { this.paymentsChart.show = false }) } - }, - template: ` - - - - - - - - - - -
-
Payments Chart
- - -
- -
-
-
-
- ` + } }) diff --git a/lnbits/static/js/components/payment-list.js b/lnbits/static/js/components/payment-list.js index f028ddf69..b4cfd873a 100644 --- a/lnbits/static/js/components/payment-list.js +++ b/lnbits/static/js/components/payment-list.js @@ -1,5 +1,6 @@ window.app.component('payment-list', { name: 'payment-list', + template: '#payment-list', props: ['update', 'wallet', 'mobileSimple', 'lazy'], mixins: [window.windowMixin], data: function () { @@ -223,280 +224,5 @@ window.app.component('payment-list', { }, created: function () { if (this.lazy === undefined) this.fetchPayments() - }, - template: ` - - -
-
-
-
-
- - - - - - - - - - - -
- -
-
-
- - - - - - -
-
- -
-
- - - - - - -
-
- ` + } }) diff --git a/lnbits/static/vendor.json b/lnbits/static/vendor.json index 3761cbb49..fb2657694 100644 --- a/lnbits/static/vendor.json +++ b/lnbits/static/vendor.json @@ -39,7 +39,6 @@ "components": [ "js/components/lnbits-funding-sources.js", "js/components/extension-settings.js", - "js/components/extension-rating.js", "js/components/payment-list.js", "js/components/payment-chart.js", "js/components.js", diff --git a/lnbits/templates/base.html b/lnbits/templates/base.html index fc63412e6..0ea065241 100644 --- a/lnbits/templates/base.html +++ b/lnbits/templates/base.html @@ -223,12 +223,10 @@ - {% block vue_templates %}{% endblock %} - - {% for url in INCLUDED_JS %} + {% include('components.vue') %} {% block vue_templates %}{% endblock %} {% + for url in INCLUDED_JS %} {% endfor %} -