replaced with working software gerty

This commit is contained in:
ben 2023-01-04 15:03:05 +00:00
parent c5b59d98ef
commit 92cfcca1d9

View file

@ -1,254 +1,251 @@
{% extends "public.html" %} {% block toolbar_title %} Gerty: {% raw %}{{ {% extends "public.html" %} {% block toolbar_title %} Gerty: {% raw %}{{
gertyname }}{% endraw %}{% endblock %}{% block page %} {% raw %} gertyname }}{% endraw %}{% endblock %}{% block page %} {% raw %}
<div <div
class="q-pa-md row items-start q-gutter-md" class="q-pa-md row items-start q-gutter-md"
v-if="elements.fun_exchange_market_rate || elements.fun_satoshi_quotes" v-if="fun_exchange_market_rate || fun_satoshi_quotes"
>
<q-card
v-if="elements.fun_exchange_market_rate['unit']"
unelevated
class="q-pa-sm"
style="background: none !important"
> >
<q-card-section class="text-h1 q-pa-none"> <q-card
<small> <b>{{elements.fun_exchange_market_rate["amount"]}}</b></small> v-if="fun_exchange_market_rate"
<small class="text-h4" unelevated
>{{elements.fun_exchange_market_rate["unit"].split(" ")[1]}}</small class="q-pa-sm"
> style="background: none !important"
</q-card-section> >
</q-card> <q-card-section class="text-h1 q-pa-none">
<small> <b>{{fun_exchange_market_rate["amount"]}}</b></small>
<q-card <small class="text-h4"
v-if="elements.fun_satoshi_quotes['quote']" >{{fun_exchange_market_rate["unit"].split(" ")[1]}}</small
unelevated >
class="q-pa-none text-body1 blockquote" </q-card-section>
style="background: none !important" </q-card>
<q-card
v-if="fun_satoshi_quotes['quote']"
unelevated
class="q-pa-none text-body1 blockquote"
style="background: none !important"
>
<blockquote class="text-right" style="max-width: 900px">
<p>"{{fun_satoshi_quotes["quote"]}}"</p>
<small>~ Satoshi {{fun_satoshi_quotes["date"]}}</small>
</blockquote>
</q-card>
</div>
<div class="q-pa-md row items-start q-gutter-md" v-if="lnbits_wallets_balance[0]">
<q-card
class="q-pa-sm"
v-for="(wallet, t) in lnbits_wallets_balance"
:style="`background-color: ${wallet.color1} !important`"
unelevated
class="q-pa-none q-pa-sm"
>
<q-card-section class="text-h1 q-pa-none">
<small> <b>{{wallet["amount"]}}</b></small>
<small class="text-h4">({{wallet["name"]}})</small>
</q-card-section>
</q-card>
</div>
<div
class="q-pa-md row items-start q-gutter-md"
v-if="dashboard_onchain[0] || dashboard_mining[0] || lightning_dashboard[0]"
> >
<blockquote class="text-right" style="max-width: 900px"> <q-card
<p>"{{elements.fun_satoshi_quotes["quote"]}}"</p> class="q-pa-sm"
<small>~ Satoshi {{elements.fun_satoshi_quotes["date"]}}</small> v-if="dashboard_onchain[0]"
</blockquote> unelevated
</q-card> class="q-pa-sm"
</div> >
<q-card-section>
<div class="q-pa-md row items-start q-gutter-md" v-if="elements.lnbits_wallets_balance"> <div class="text-h6">Onchain</div>
<q-card </q-card-section>
class="q-pa-sm" <q-card-section class="q-pa-none">
v-for="(wallet, t) in elements.lnbits_wallets_balance" <p v-for="(item, t) in dashboard_onchain">
:style="`background-color: ${wallet.color1} !important`" <b>{{item[0].value}}: </b>{{item[1].value}}
unelevated </p>
class="q-pa-none q-pa-sm" </q-card-section>
> </q-card>
<q-card-section class="text-h1 q-pa-none">
<small> <b>{{wallet["amount"]}}</b></small> <q-card class="q-pa-sm" v-if="dashboard_mining[0]" unelevated class="q-pa-sm">
<small class="text-h4">({{wallet["name"]}})</small> <q-card-section>
</q-card-section> <div class="text-h6">Mining</div>
</q-card> </q-card-section>
</div> <q-card-section class="q-pa-none">
<p v-for="(item, t) in dashboard_mining">
<div <b>{{item[0].value}}:</b> {{item[1].value}}
class="q-pa-md row items-start q-gutter-md" </p>
v-if="elements.dashboard_onchain || elements.dashboard_mining || elements.lightning_dashboard" </q-card-section>
> </q-card>
<q-card
class="q-pa-sm" <q-card class="q-pa-sm" v-if="lightning_dashboard[0]" unelevated class="q-pa-sm">
v-if="elements.dashboard_onchain[0]" <q-card-section>
unelevated <div class="text-h6">Lightning (Last 7 days)</div>
class="q-pa-sm" </q-card-section>
> <q-card-section class="q-pa-none">
<q-card-section> <p v-for="(item, t) in lightning_dashboard">
<div class="text-h6">Onchain</div> <b>{{item[0].value}}:</b> {{item[1].value}}
</q-card-section> </p>
<q-card-section class="q-pa-none"> </q-card-section>
<p v-for="(item, t) in elements.dashboard_onchain"> </q-card>
<b>{{item[0].value}}: </b>{{item[1].value}}
</p> <q-card class="q-pa-sm" v-if="url_checker[0]" unelevated class="q-pa-sm">
</q-card-section> <q-card-section>
</q-card> <div class="text-h6">Servers to check</div>
</q-card-section>
<q-card class="q-pa-sm" v-if="elements.dashboard_mining" unelevated class="q-pa-sm"> <q-card-section class="q-pa-none">
<q-card-section> <div class="row q-pb-md" v-for="(item, t) in url_checker">
<div class="text-h6">Mining</div> <div class="col-8">
</q-card-section> <small>
<q-card-section class="q-pa-none"> <b style="word-wrap: break-word; max-width: 230px; display: block">
<p v-for="(item, t) in elements.dashboard_mining"> <a class="text-secondary" class="text-primary">
<b>{{item[0].value}}:</b> {{item[1].value}} {{item[0].value}}
</p> </a>
</q-card-section> </b>
</q-card> </small>
</div>
<q-card class="q-pa-sm" v-if="elements.lightning_dashboard" unelevated class="q-pa-sm"> <div class="col-4">
<q-card-section> <q-chip
<div class="text-h6">Lightning (Last 7 days)</div> v-if="item[1].value < 300"
</q-card-section> square
<q-card-section class="q-pa-none"> size="sm"
<p v-for="(item, t) in elements.lightning_dashboard"> color="green"
<b>{{item[0].value}}:</b> {{item[1].value}} text-color="white"
</p> icon="sentiment_satisfied"
</q-card-section> >
</q-card> {{item[1].value}}
</q-chip>
<q-card class="q-pa-sm" v-if="elements.url_checker" unelevated class="q-pa-sm"> <q-chip
<q-card-section> v-else-if="item[1].value >= 300"
<div class="text-h6">Servers to check</div> square
</q-card-section> size="sm"
<q-card-section class="q-pa-none"> color="yellow"
<div class="row q-pb-md" v-for="(item, t) in elements.url_checker"> text-color="white"
<div class="col-8"> icon="sentiment_dissatisfied"
<small> >
<b style="word-wrap: break-word; max-width: 230px; display: block"> {{item[1].value}}
<a class="text-secondary" class="text-primary"> </q-chip>
{{item[0].value}} <q-chip
</a> v-else
</b> square
</small> size="sm"
color="red"
text-color="white"
icon="sentiment_dissatisfied"
>
{{item[1].value}}
</q-chip>
</div>
</div> </div>
<div class="col-4"> </q-card-section>
<q-chip </q-card>
v-if="item[1].value < 300" </div>
square
size="sm" {% endraw %} {% endblock %} {% block scripts %}
color="green" <script>
text-color="white" Vue.component(VueQrcode.name, VueQrcode)
icon="sentiment_satisfied"
> new Vue({
{{item[1].value}} el: '#vue',
</q-chip> mixins: [windowMixin],
<q-chip data: function () {
v-else-if="item[1].value >= 300" return {
square lnbits_wallets_balance: {},
size="sm" dashboard_onchain: {},
color="yellow" fun_satoshi_quotes: {},
text-color="white" fun_exchange_market_rate: {
icon="sentiment_dissatisfied" unit: ""
> },
{{item[1].value}} dashboard_mining: {},
</q-chip> lightning_dashboard: {},
<q-chip url_checker: {},
v-else dashboard_mining: {},
square gerty: [],
size="sm" gerty_id: `{{gerty}}`,
color="red" gertyname: '',
text-color="white" walletColors: [
icon="sentiment_dissatisfied" {first: '#3f51b5', second: '#1a237e'},
> {first: '#9c27b0', second: '#4a148c'},
{{item[1].value}} {first: '#e91e63', second: '#880e4f'},
</q-chip> {first: '#009688', second: '#004d40'},
</div> {first: '#ff9800', second: '#e65100'},
</div> {first: '#2196f3', second: '#0d47a1'},
</q-card-section> {first: '#4caf50', second: '#1b5e20'}
</q-card> ],
</div> gertywallets: []
{% endraw %} {% endblock %} {% block scripts %}
<script>
Vue.component(VueQrcode.name, VueQrcode)
new Vue({
el: '#vue',
mixins: [windowMixin],
data: function () {
return {
elements:{
lnbits_wallets_balance: [],
dashboard_onchain: [],
fun_satoshi_quotes: [],
fun_exchange_market_rate: [],
lightning_dashboard: [],
url_checker: [],
dashboard_mining: [],
},
gerty: [],
gerty_id: `{{gerty}}`,
gertyname: '',
walletColors: [
{first: '#3f51b5', second: '#1a237e'},
{first: '#9c27b0', second: '#4a148c'},
{first: '#e91e63', second: '#880e4f'},
{first: '#009688', second: '#004d40'},
{first: '#ff9800', second: '#e65100'},
{first: '#2196f3', second: '#0d47a1'},
{first: '#4caf50', second: '#1b5e20'}
],
gertywallets: []
}
},
methods: {
getGertyInfo: async function () {
for (let i = 0; i < 8; i++) {
try {
const {data} = await LNbits.api.request(
'GET',
`/gerty/api/v1/gerty/pages/${this.gerty_id}/${i}`
)
console.log(data.screen.slug)
if(data.screen.slug){
this.gerty[i] = data
}
} catch (error) {
LNbits.utils.notifyApiError(error)
}
} }
console.log(this.gerty[0].screen.group) },
for (let i = 0; i < this.gerty.length; i++) { methods: {
if (this.gerty[i].screen.group == 'lnbits_wallets_balance') { getGertyInfo: async function () {
for (let q = 0; q < this.gerty[i].screen.areas.length; q++) { for (let i = 0; i < 8; i++) {
this.elements.lnbits_wallets_balance[q] = { try {
name: this.gerty[i].screen.areas[q][0].value, const {data} = await LNbits.api.request(
amount: this.gerty[i].screen.areas[q][1].value, 'GET',
color1: this.walletColors[q].first, `/gerty/api/v1/gerty/pages/${this.gerty_id}/${i}`
color2: this.walletColors[q].second )
this.gerty[i] = data
} catch (error) {
LNbits.utils.notifyApiError(error)
}
}
console.log(this.gerty)
for (let i = 0; i < this.gerty.length; i++) {
if (this.gerty[i].screen.group == 'lnbits_wallets_balance') {
for (let q = 0; q < this.gerty[i].screen.areas.length; q++) {
this.lnbits_wallets_balance[q] = {
name: this.gerty[i].screen.areas[q][0].value,
amount: this.gerty[i].screen.areas[q][1].value,
color1: this.walletColors[q].first,
color2: this.walletColors[q].second
}
this.gertyname = this.gerty[i].settings.name
} }
}
if (this.gerty[i].screen.group == 'url_checker') {
this.url_checker = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'dashboard_onchain') {
this.dashboard_onchain = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'dashboard_mining') {
this.dashboard_mining = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'lightning_dashboard') {
this.lightning_dashboard = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'fun_satoshi_quotes') {
this.fun_satoshi_quotes['quote'] = this.gerty[
i
].screen.areas[0][0].value
this.fun_satoshi_quotes['date'] = this.gerty[
i
].screen.areas[0][1].value
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'fun_exchange_market_rate') {
this.fun_exchange_market_rate['unit'] = this.gerty[
i
].screen.areas[0][0].value
this.fun_exchange_market_rate['amount'] = this.gerty[
i
].screen.areas[0][1].value
this.gertyname = this.gerty[i].settings.name this.gertyname = this.gerty[i].settings.name
} }
} }
if (this.gerty[i].screen.group == 'url_checker') {
this.elements.url_checker = this.gerty[i].screen.areas setTimeout(this.getGertyInfo, 20000)
this.gertyname = this.gerty[i].settings.name this.$forceUpdate()
} return this.gerty
if (this.gerty[i].screen.group == 'dashboard_onchain') {
this.elements.dashboard_onchain = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'dashboard_mining') {
this.elements.dashboard_mining = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'lightning_dashboard') {
this.elements.lightning_dashboard = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'fun_satoshi_quotes') {
console.log(this.gerty[i]);
this.elements.fun_satoshi_quotes['quote'] = this.gerty[
i
].screen.areas[0][0].value
this.elements.fun_satoshi_quotes['date'] = this.gerty[
i
].screen.areas[0][1].value
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'fun_exchange_market_rate') {
this.elements.fun_exchange_market_rate['unit'] = this.gerty[
i
].screen.areas[0][0].value
this.elements.fun_exchange_market_rate['amount'] = this.gerty[
i
].screen.areas[0][1].value
this.gertyname = this.gerty[i].settings.name
}
} }
},
setTimeout(this.getGertyInfo, 20000) created: async function () {
this.$forceUpdate() await this.getGertyInfo()
return this.gerty
} }
}, })
created: async function () { </script>
await this.getGertyInfo() {% endblock %}
}
})
</script>
{% endblock %}