diff --git a/app/routes.py b/app/routes.py index 11aefdc..481d5b8 100644 --- a/app/routes.py +++ b/app/routes.py @@ -79,16 +79,6 @@ def dump_settings(filename: str) -> None: @app.route('/') @app.route('/index') def index(): - display_wifi_password = False - wifi_password = get_setting("wifi_password") - if wifi_password: - wifi_ssid = get_setting("ssid") - wifi_encryption_type = "WPA2" - img = qrcode.make(f"WIFI:T:{wifi_encryption_type};S:{wifi_ssid};P:{wifi_password};;") - img.save("app/static/images/wifi_qr_code.png") - display_wifi_password = True - else: - os.remove("app/static/images/wifi_qr_code.png") enable_chat = get_setting("enable_chat") enable_app_store = get_setting("enable_app_store") enable_map_viewer = get_setting("enable_map_viewer") @@ -116,7 +106,7 @@ def index(): "name": name, "image": url_for("static", filename="images/explore-icon.svg"), "url": url_for("files", path=""),}) - return render_template('index.html', title='Home', get_setting=get_setting, services=service_array, display_wifi_password=display_wifi_password) + return render_template('index.html', title='Home', get_setting=get_setting, services=service_array) @app.route('/files/', defaults={'path': ''}) @app.route('/files/') @@ -236,4 +226,23 @@ def generate_random_deltachat_credentials(): flash(f"Username: {username}") flash(f"Password: {password}") flash(f"IP: {ip}") - return redirect(url_for("messaging")) \ No newline at end of file + return redirect(url_for("messaging")) + +@app.route('/share') +def share(): + display_wifi_password = False + wifi_password = get_setting("wifi_password") + if wifi_password: + wifi_ssid = get_setting("ssid") + wifi_encryption_type = "WPA2" + img = qrcode.make(f"WIFI:T:{wifi_encryption_type};S:{wifi_ssid};P:{wifi_password};;") + img.save("app/static/images/wifi_qr_code.png") + display_wifi_password = True + else: + if os.path.exists("app/static/images/wifi_qr_code.png"): + os.remove("app/static/images/wifi_qr_code.png") + return render_template('share.html', get_setting=get_setting, display_wifi_password=display_wifi_password) + +@app.route('/about') +def about(): + return render_template('about.html', get_setting=get_setting) diff --git a/app/templates/about.html b/app/templates/about.html new file mode 100644 index 0000000..e79dd31 --- /dev/null +++ b/app/templates/about.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block content %} +

About this {{get_setting('butterbox_name')}}.

+ +
+

Some info here about butter and how to create your own.

+
+{% endblock %} diff --git a/app/templates/base.html b/app/templates/base.html index 47d81e2..39f1204 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -14,10 +14,33 @@
-
- -

{{ get_setting('butterbox_name') }}

-
+ + +
{% with messages = get_flashed_messages() %} diff --git a/app/templates/breadcrumbs.html b/app/templates/breadcrumbs.html new file mode 100644 index 0000000..6804062 --- /dev/null +++ b/app/templates/breadcrumbs.html @@ -0,0 +1,15 @@ + diff --git a/app/templates/index.html b/app/templates/index.html index b995f90..a5b2103 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -13,13 +13,5 @@ {% endfor %}
- - {% if display_wifi_password %} -
-

Connect to this box with wifi: - -

-
- {% endif %} {% endblock %} \ No newline at end of file diff --git a/app/templates/share.html b/app/templates/share.html new file mode 100644 index 0000000..7d9406f --- /dev/null +++ b/app/templates/share.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block content %} +

Share access to {{get_setting('butterbox_name')}}.

+ + + {% if display_wifi_password %} +
+

Connect to WiFi name: "{{ get_setting('ssid') }}" with password: "{{ get_setting('wifi_password') }}". You can also use the following QR code to join:

+ + +
+ {% else %} +
+

Your WiFi name is "{{ get_setting('ssid') }}". You will be able to join without a password.

+
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/app/templates/usb-file-viewer.html b/app/templates/usb-file-viewer.html index dba7fbb..3442b34 100644 --- a/app/templates/usb-file-viewer.html +++ b/app/templates/usb-file-viewer.html @@ -1,8 +1,8 @@ {% extends "base.html" %} - {% block content %} -

{{ _('File Viewer') }}

+{% include 'breadcrumbs.html' %} +

{{ _('File Viewer') }}

@@ -18,7 +18,7 @@ {% if f.is_dir %} - + {% endif %} {% if f.is_file %}
{{ f.name}}{{ f.name}}