From 40bcee6d22cfd064c2bde317ff2769e97a08976a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Wed, 4 Jan 2023 17:09:50 +0100 Subject: [PATCH] fix issue @ben ;) --- lnbits/extensions/gerty/helpers.py | 3 +- .../gerty/templates/gerty/gerty.html | 499 +++++++++--------- lnbits/extensions/gerty/views_api.py | 4 +- 3 files changed, 256 insertions(+), 250 deletions(-) diff --git a/lnbits/extensions/gerty/helpers.py b/lnbits/extensions/gerty/helpers.py index 59b7159d7..3e48c5763 100644 --- a/lnbits/extensions/gerty/helpers.py +++ b/lnbits/extensions/gerty/helpers.py @@ -70,7 +70,7 @@ def get_text_item_dict( else: data_text["x"] = x_pos if x_pos > 0 else 0 data_text["y"] = y_pos if x_pos > 0 else 0 - return text + return data_text def get_date_suffix(dayNumber): @@ -532,7 +532,6 @@ async def get_screen_data(screen_num: int, screens_list: list, gerty): "title": title, "areas": areas, } - return data diff --git a/lnbits/extensions/gerty/templates/gerty/gerty.html b/lnbits/extensions/gerty/templates/gerty/gerty.html index 141c3152d..8a374e61e 100644 --- a/lnbits/extensions/gerty/templates/gerty/gerty.html +++ b/lnbits/extensions/gerty/templates/gerty/gerty.html @@ -1,251 +1,258 @@ {% extends "public.html" %} {% block toolbar_title %} Gerty: {% raw %}{{ - gertyname }}{% endraw %}{% endblock %}{% block page %} {% raw %} - -
+ - - - {{fun_exchange_market_rate["amount"]}} - {{fun_exchange_market_rate["unit"].split(" ")[1]}} - - - - -
-

"{{fun_satoshi_quotes["quote"]}}"

- ~ Satoshi {{fun_satoshi_quotes["date"]}} -
-
-
- -
- - - {{wallet["amount"]}} - ({{wallet["name"]}}) - - -
- -
+ {{fun_exchange_market_rate["amount"]}} + {{fun_exchange_market_rate["unit"].split(" ")[1]}} + + + + - - -
Onchain
-
- -

- {{item[0].value}}: {{item[1].value}} -

-
-
- - - -
Mining
-
- -

- {{item[0].value}}: {{item[1].value}} -

-
-
- - - -
Lightning (Last 7 days)
-
- -

- {{item[0].value}}: {{item[1].value}} -

-
-
- - - -
Servers to check
-
- -
- -
- - {{item[1].value}} - - - {{item[1].value}} - - - {{item[1].value}} - -
+
+

"{{fun_satoshi_quotes["quote"]}}"

+ ~ Satoshi {{fun_satoshi_quotes["date"]}} +
+ +
+ +
+ + + {{wallet["amount"]}} + ({{wallet["name"]}}) + + +
+ +
+ + +
Onchain
+
+ +

+ {{item[0].value}}: {{item[1].value}} +

+
+
+ + + +
Mining
+
+ +

+ {{item[0].value}}: {{item[1].value}} +

+
+
+ + + +
Lightning (Last 7 days)
+
+ +

+ {{item[0].value}}: {{item[1].value}} +

+
+
+ + + +
Servers to check
+
+ +
+ - - -
- - {% endraw %} {% endblock %} {% block scripts %} - - {% endblock %} - \ No newline at end of file + }, + 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}` + ) + 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 + } + } + + setTimeout(this.getGertyInfo, 20000) + this.$forceUpdate() + return this.gerty + } + }, + created: async function () { + await this.getGertyInfo() + } + }) + +{% endblock %} diff --git a/lnbits/extensions/gerty/views_api.py b/lnbits/extensions/gerty/views_api.py index 4020c9806..c408504b6 100644 --- a/lnbits/extensions/gerty/views_api.py +++ b/lnbits/extensions/gerty/views_api.py @@ -18,10 +18,10 @@ from .crud import ( update_gerty, ) from .helpers import ( - get_screen_data, - get_satoshi, gerty_should_sleep, get_next_update_time, + get_satoshi, + get_screen_data, get_screen_slug_by_index, ) from .models import Gerty