refactor move home / into vue components (#3498)
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
window.app.component('lnbits-home-logos', {
|
||||
template: '#lnbits-home-logos',
|
||||
mixins: [window.windowMixin],
|
||||
data() {
|
||||
return {
|
||||
logos: [
|
||||
{
|
||||
href: 'https://github.com/ElementsProject/lightning',
|
||||
lightSrc: '/static/images/clnl.png',
|
||||
darkSrc: '/static/images/cln.png'
|
||||
},
|
||||
{
|
||||
href: 'https://github.com/lightningnetwork/lnd',
|
||||
lightSrc: '/static/images/lnd.png',
|
||||
darkSrc: '/static/images/lnd.png'
|
||||
},
|
||||
{
|
||||
href: 'https://opennode.com',
|
||||
lightSrc: '/static/images/opennodel.png',
|
||||
darkSrc: '/static/images/opennode.png'
|
||||
},
|
||||
{
|
||||
href: 'https://lnpay.co/',
|
||||
lightSrc: '/static/images/lnpayl.png',
|
||||
darkSrc: '/static/images/lnpay.png'
|
||||
},
|
||||
{
|
||||
href: 'https://github.com/rootzoll/raspiblitz',
|
||||
lightSrc: '/static/images/blitzl.png',
|
||||
darkSrc: '/static/images/blitz.png'
|
||||
},
|
||||
{
|
||||
href: 'https://start9.com/',
|
||||
lightSrc: '/static/images/start9l.png',
|
||||
darkSrc: '/static/images/start9.png'
|
||||
},
|
||||
{
|
||||
href: 'https://getumbrel.com/',
|
||||
lightSrc: '/static/images/umbrell.png',
|
||||
darkSrc: '/static/images/umbrel.png'
|
||||
},
|
||||
{
|
||||
href: 'https://mynodebtc.com',
|
||||
lightSrc: '/static/images/mynodel.png',
|
||||
darkSrc: '/static/images/mynode.png'
|
||||
},
|
||||
{
|
||||
href: 'https://github.com/shesek/spark-wallet',
|
||||
lightSrc: '/static/images/sparkl.png',
|
||||
darkSrc: '/static/images/spark.png'
|
||||
},
|
||||
{
|
||||
href: 'https://voltage.cloud',
|
||||
lightSrc: '/static/images/voltagel.png',
|
||||
darkSrc: '/static/images/voltage.png'
|
||||
},
|
||||
{
|
||||
href: 'https://breez.technology/sdk/',
|
||||
lightSrc: '/static/images/breezl.png',
|
||||
darkSrc: '/static/images/breez.png'
|
||||
},
|
||||
{
|
||||
href: 'https://blockstream.com/lightning/greenlight/',
|
||||
lightSrc: '/static/images/greenlightl.png',
|
||||
darkSrc: '/static/images/greenlight.png'
|
||||
},
|
||||
{
|
||||
href: 'https://getalby.com',
|
||||
lightSrc: '/static/images/albyl.png',
|
||||
darkSrc: '/static/images/alby.png'
|
||||
},
|
||||
{
|
||||
href: 'https://zbd.gg',
|
||||
lightSrc: '/static/images/zbdl.png',
|
||||
darkSrc: '/static/images/zbd.png'
|
||||
},
|
||||
{
|
||||
href: 'https://phoenix.acinq.co/server',
|
||||
lightSrc: '/static/images/phoenixdl.png',
|
||||
darkSrc: '/static/images/phoenixd.png'
|
||||
},
|
||||
{
|
||||
href: 'https://boltz.exchange/',
|
||||
lightSrc: '/static/images/boltzl.svg',
|
||||
darkSrc: '/static/images/boltz.svg'
|
||||
},
|
||||
{
|
||||
href: 'https://www.blink.sv/',
|
||||
lightSrc: '/static/images/blink_logol.png',
|
||||
darkSrc: '/static/images/blink_logo.png'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showLogos() {
|
||||
return (
|
||||
this.LNBITS_DENOMINATION == 'sats' &&
|
||||
this.SITE_TITLE == 'LNbits' &&
|
||||
this.LNBITS_SHOW_HOME_PAGE_ELEMENTS == true
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -193,6 +193,11 @@ const routes = [
|
||||
path: '/first_install',
|
||||
name: 'FirstInstall',
|
||||
component: PageFirstInstall
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
name: 'PageHome',
|
||||
component: PageHome
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
window.app = Vue.createApp({
|
||||
el: '#vue',
|
||||
window.PageHome = {
|
||||
template: '#page-home',
|
||||
mixins: [window.windowMixin],
|
||||
data() {
|
||||
return {
|
||||
disclaimerDialog: {
|
||||
show: false,
|
||||
data: {},
|
||||
description: ''
|
||||
},
|
||||
lnurl: '',
|
||||
isUserAuthorized: false,
|
||||
authAction: 'login',
|
||||
authMethod: 'username-password',
|
||||
@@ -22,11 +18,50 @@ window.app = Vue.createApp({
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showClaimLnurl() {
|
||||
return (
|
||||
this.lnurl !== '' &&
|
||||
this.allowRegister &&
|
||||
'user-id-only' in this.LNBITS_AUTH_METHODS
|
||||
)
|
||||
},
|
||||
formatDescription() {
|
||||
return LNbits.utils.convertMarkdown(this.description)
|
||||
return LNbits.utils.convertMarkdown(this.SITE_DESCRIPTION)
|
||||
},
|
||||
isAccessTokenExpired() {
|
||||
return this.$q.cookies.get('is_access_token_expired')
|
||||
},
|
||||
allowRegister() {
|
||||
return this.LNBITS_NEW_ACCOUNTS_ALLOWED
|
||||
},
|
||||
// TODO: this makes no sense
|
||||
hasCustomImage() {
|
||||
return this.LNBITS_CUSTOM_IMAGE
|
||||
},
|
||||
showHomepageElements() {
|
||||
return this.HOMEPAGE_ELEMENTS_ENABLED
|
||||
},
|
||||
siteTitle() {
|
||||
return this.SITE_TITLE || ''
|
||||
},
|
||||
siteTagline() {
|
||||
return this.SITE_TAGLINE || ''
|
||||
},
|
||||
adsEnabled() {
|
||||
return this.AD_SPACE_ENABLED && this.AD_SPACE && this.AD_SPACE.length > 0
|
||||
},
|
||||
adsTitle() {
|
||||
return this.AD_SPACE_TITLE || ''
|
||||
},
|
||||
ads() {
|
||||
return this.AD_SPACE.map(ad => ad.split(';'))
|
||||
},
|
||||
lnbitsBannerEnabled() {
|
||||
return (
|
||||
this.LNBITS_DENOMINATION == 'sats' &&
|
||||
this.SITE_TITLE == 'LNbits' &&
|
||||
this.LNBITS_SHOW_HOME_PAGE_ELEMENTS == true
|
||||
)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -101,23 +136,24 @@ window.app = Vue.createApp({
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.description = this.SITE_DESCRIPTION
|
||||
this.allowedRegister = this.LNBITS_NEW_ACCOUNTS_ALLOWED
|
||||
this.authAction =
|
||||
!this.allowedRegister ||
|
||||
Quasar.LocalStorage.getItem('lnbits.disclaimerShown')
|
||||
? 'login'
|
||||
: 'register'
|
||||
this.isUserAuthorized = !!this.$q.cookies.get('is_lnbits_user_authorized')
|
||||
const _acccess_cookies_for_safari_refresh_do_not_delete = document.cookie
|
||||
|
||||
const _access_cookies_for_safari_refresh_do_not_delete = document.cookie
|
||||
|
||||
if (this.isUserAuthorized) {
|
||||
window.location.href = '/wallet'
|
||||
}
|
||||
this.reset_key = new URLSearchParams(window.location.search).get(
|
||||
'reset_key'
|
||||
)
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
|
||||
this.reset_key = urlParams.get('reset_key')
|
||||
if (this.reset_key) {
|
||||
this.authAction = 'reset'
|
||||
}
|
||||
|
||||
// check if lightning parameters are present in the URL
|
||||
if (urlParams.has('lightning')) {
|
||||
this.lnurl = urlParams.get('lightning')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user