Compare commits
8 Commits
v0.14.1-re
...
s-allius/i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab1b245e2a | ||
|
|
2430aef541 | ||
|
|
509d26471f | ||
|
|
e5a08c3150 | ||
|
|
d386456a88 | ||
|
|
a527926e57 | ||
|
|
fe915f524d | ||
|
|
55972b2240 |
@@ -10,7 +10,7 @@ APP=.
|
|||||||
SRC=$(APP)/src
|
SRC=$(APP)/src
|
||||||
# Folders for Babel translation
|
# Folders for Babel translation
|
||||||
BABEL_INPUT_JINJA=$(SRC)/web/templates
|
BABEL_INPUT_JINJA=$(SRC)/web/templates
|
||||||
BABEL_INPUT= $(foreach dir,$(BABEL_INPUT_JINJA),$(wildcard $(dir)/*.html)) \
|
BABEL_INPUT= $(foreach dir,$(BABEL_INPUT_JINJA),$(wildcard $(dir)/*.html.j2)) \
|
||||||
|
|
||||||
BABEL_TRANSLATIONS=$(APP)/translations
|
BABEL_TRANSLATIONS=$(APP)/translations
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
[python: **.py]
|
[python: **.py]
|
||||||
[jinja2: web/templates/**.html]
|
[jinja2: web/templates/**.html]
|
||||||
|
[jinja2: web/templates/**.html.j2]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
from quart import Blueprint
|
from quart import Blueprint
|
||||||
from quart import render_template
|
from quart import render_template, url_for
|
||||||
from quart import send_from_directory
|
from quart import send_from_directory
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -13,14 +13,44 @@ async def get_icon(file: str, mime: str = 'image/png'):
|
|||||||
mimetype=mime)
|
mimetype=mime)
|
||||||
|
|
||||||
|
|
||||||
|
def get_inv_count():
|
||||||
|
return 1234
|
||||||
|
|
||||||
|
|
||||||
|
TsunCnt = 0
|
||||||
|
|
||||||
|
|
||||||
|
def get_tsun_count():
|
||||||
|
global TsunCnt
|
||||||
|
TsunCnt += 1
|
||||||
|
return TsunCnt
|
||||||
|
|
||||||
|
|
||||||
|
@web_routes.context_processor
|
||||||
|
def utility_processor():
|
||||||
|
return dict(inv_count=get_inv_count(),
|
||||||
|
tsun_count=get_tsun_count())
|
||||||
|
|
||||||
|
|
||||||
@web_routes.route('/')
|
@web_routes.route('/')
|
||||||
async def index():
|
async def index():
|
||||||
return await render_template('index.html')
|
return await render_template(
|
||||||
|
'index.html.j2',
|
||||||
|
fetch_url='.'+url_for('web_routes.data_fetch'))
|
||||||
|
|
||||||
|
|
||||||
@web_routes.route('/page')
|
@web_routes.route('/page')
|
||||||
async def empty():
|
async def empty():
|
||||||
return await render_template('empty.html')
|
return await render_template('empty.html.j2')
|
||||||
|
|
||||||
|
|
||||||
|
@web_routes.route('/data-fetch')
|
||||||
|
async def data_fetch():
|
||||||
|
global TsunCnt
|
||||||
|
TsunCnt += 1
|
||||||
|
return {
|
||||||
|
"geology-fact": f"<h3>{TsunCnt}</h3>",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@web_routes.route('/favicon-96x96.png')
|
@web_routes.route('/favicon-96x96.png')
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 729 KiB |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TSUN-Proxy",
|
"name": "TSUN-Proxy",
|
||||||
"short_name": "TsunProxy",
|
"short_name": "Proxy",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/web-app-manifest-192x192.png",
|
"src": "/web-app-manifest-192x192.png",
|
||||||
|
|||||||
@@ -106,6 +106,36 @@
|
|||||||
mySidebar.style.display = "none";
|
mySidebar.style.display = "none";
|
||||||
overlayBg.style.display = "none";
|
overlayBg.style.display = "none";
|
||||||
}
|
}
|
||||||
|
{% if fetch_url is defined %}
|
||||||
|
function fetch_data() {
|
||||||
|
fetch("{{fetch_url}}")
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(function (data) {
|
||||||
|
Object.keys(data).forEach(key => {
|
||||||
|
//console.log(`${key}: ${data[key]}`);
|
||||||
|
try {
|
||||||
|
elm = document.getElementById(key)
|
||||||
|
elm.innerHTML = data[key]
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
console.log('error: ' + err + ' (for key: ' + key + ')');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.log('error: ' + err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', function () {
|
||||||
|
// Your document is loaded.
|
||||||
|
var fetchInterval = 5000; // 5 seconds.
|
||||||
|
|
||||||
|
// Invoke the request every 5 seconds.
|
||||||
|
setInterval(fetch_data, fetchInterval);
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock trailer %}
|
{% endblock trailer %}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html.j2' %}
|
||||||
|
|
||||||
{% block title %} TSUN Proxy - View {% endblock title%}
|
{% block title %} TSUN Proxy - View {% endblock title%}
|
||||||
{% block menu2_class %}w3-blue{% endblock %}
|
{% block menu2_class %}w3-blue{% endblock %}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html.j2' %}
|
||||||
|
|
||||||
{% block title %} TSUN Proxy - Dashboard {% endblock title%}
|
{% block title %} TSUN Proxy - Dashboard {% endblock title%}
|
||||||
{% block menu1_class %}w3-blue{% endblock %}
|
{% block menu1_class %}w3-blue{% endblock %}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="w3-container w3-red w3-padding-16">
|
<div class="w3-container w3-red w3-padding-16">
|
||||||
<div class="w3-left"><i class="fa fa-comment w3-xxxlarge"></i></div>
|
<div class="w3-left"><i class="fa fa-comment w3-xxxlarge"></i></div>
|
||||||
<div class="w3-right">
|
<div class="w3-right">
|
||||||
<h3>52</h3>
|
<h3>{{inv_count}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-clear"></div>
|
<div class="w3-clear"></div>
|
||||||
<h4>Messages</h4>
|
<h4>Messages</h4>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="w3-container w3-blue w3-padding-16">
|
<div class="w3-container w3-blue w3-padding-16">
|
||||||
<div class="w3-left"><i class="fa fa-eye w3-xxxlarge"></i></div>
|
<div class="w3-left"><i class="fa fa-eye w3-xxxlarge"></i></div>
|
||||||
<div class="w3-right">
|
<div class="w3-right">
|
||||||
<h3>99</h3>
|
<h3>{{tsun_count}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-clear"></div>
|
<div class="w3-clear"></div>
|
||||||
<h4>Views</h4>
|
<h4>Views</h4>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<div class="w3-quarter">
|
<div class="w3-quarter">
|
||||||
<div class="w3-container w3-teal w3-padding-16">
|
<div class="w3-container w3-teal w3-padding-16">
|
||||||
<div class="w3-left"><i class="fa fa-share-alt w3-xxxlarge"></i></div>
|
<div class="w3-left"><i class="fa fa-share-alt w3-xxxlarge"></i></div>
|
||||||
<div class="w3-right">
|
<div id = "geology-fact" class="w3-right">
|
||||||
<h3>23</h3>
|
<h3>23</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-clear"></div>
|
<div class="w3-clear"></div>
|
||||||
@@ -52,7 +52,6 @@
|
|||||||
<div class="w3-row-padding" style="margin:0 -16px">
|
<div class="w3-row-padding" style="margin:0 -16px">
|
||||||
<div class="w3-third">
|
<div class="w3-third">
|
||||||
<h5>Regions</h5>
|
<h5>Regions</h5>
|
||||||
<img src="/w3images/region.jpg" style="width:100%" alt="Google Regional Map">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-twothird">
|
<div class="w3-twothird">
|
||||||
<h5>Feeds</h5>
|
<h5>Feeds</h5>
|
||||||
@@ -178,5 +177,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content%}
|
{% endblock content%}
|
||||||
|
|
||||||
|
|
||||||
@@ -61,3 +61,13 @@ async def test_manifest():
|
|||||||
response = await client.get('/site.webmanifest')
|
response = await client.get('/site.webmanifest')
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.mimetype == 'application/manifest+json'
|
assert response.mimetype == 'application/manifest+json'
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_data_fetch():
|
||||||
|
"""Test the healthy route."""
|
||||||
|
client = app.test_client()
|
||||||
|
response = await client.get('/data-fetch')
|
||||||
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
response = await client.get('/data-fetch')
|
||||||
|
assert response.status_code == 200
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: tsun-gen3-proxy 0.14.0\n"
|
"Project-Id-Version: tsun-gen3-proxy 0.14.0\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2025-04-18 20:46+0200\n"
|
"POT-Creation-Date: 2025-04-20 00:01+0200\n"
|
||||||
"PO-Revision-Date: 2025-04-18 16:24+0200\n"
|
"PO-Revision-Date: 2025-04-18 16:24+0200\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
@@ -19,7 +19,7 @@ msgstr ""
|
|||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Generated-By: Babel 2.17.0\n"
|
"Generated-By: Babel 2.17.0\n"
|
||||||
|
|
||||||
#: src/web/templates/index.html:5
|
#: src/web/templates/index.html.j2:5
|
||||||
msgid "My Dashboard"
|
msgid "My Dashboard"
|
||||||
msgstr "Mein Dashboard"
|
msgstr "Mein Dashboard"
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ SRC_FILES := $(wildcard $(SRC_PROXY)/*.py)\
|
|||||||
$(wildcard $(SRC_PROXY)/gen3/*.py)\
|
$(wildcard $(SRC_PROXY)/gen3/*.py)\
|
||||||
$(wildcard $(SRC_PROXY)/gen3plus/*.py)\
|
$(wildcard $(SRC_PROXY)/gen3plus/*.py)\
|
||||||
$(wildcard $(SRC_PROXY)/web/*.py)\
|
$(wildcard $(SRC_PROXY)/web/*.py)\
|
||||||
$(wildcard $(SRC_PROXY)/web/templates/*.html)\
|
$(wildcard $(SRC_PROXY)/web/templates/*.html.j2)\
|
||||||
$(wildcard $(SRC_PROXY)/web/static/css/*.css)\
|
$(wildcard $(SRC_PROXY)/web/static/css/*.css)\
|
||||||
$(wildcard $(SRC_PROXY)/web/static/font/*)\
|
$(wildcard $(SRC_PROXY)/web/static/font/*)\
|
||||||
$(wildcard $(SRC_PROXY)/web/static/font-awesome/*/*)\
|
$(wildcard $(SRC_PROXY)/web/static/font-awesome/*/*)\
|
||||||
|
|||||||
Reference in New Issue
Block a user