diff --git a/app/routes.py b/app/routes.py index 6babe30..94c1ddf 100644 --- a/app/routes.py +++ b/app/routes.py @@ -1,5 +1,5 @@ from app import app -from flask import render_template, flash, redirect, url_for, request, session, send_file +from flask import render_template, flash, redirect, url_for, send_file from app.forms import LoginForm, SettingsForm from flask_login import login_user, current_user, logout_user, login_required import sqlalchemy as sa @@ -16,7 +16,7 @@ import string import glob import time import qrcode -from app.change_manager import CHANGES_REQUIRING_RESTART, check_settings +from app.change_manager import CHANGES_REQUIRING_RESTART def gen_username() -> str: words = top_n_list("en", 5000) @@ -155,6 +155,7 @@ def logout(): @app.route('/admin', methods=['GET', 'POST']) @login_required def admin(): + raspap_installed = os.path.exists("/var/www/html/raspap") form = SettingsForm() populate_settings = ['butterbox_name', 'wifi_password', 'ssid', 'butterbox_hostname', 'root_account_settings', 'ssh_access_settings'] bool_settings = ['enable_access_point','enable_file_viewer', 'enable_map_viewer', 'enable_app_store', 'enable_chat', 'enable_deltachat', 'enable_wifi_sharing'] @@ -214,10 +215,9 @@ def admin(): if form.apply_changes.data: set_setting('apply_changes', "true") dump_settings("settings.txt") - check_settings() flash(_("⚠️ Changes applied! Please wait for the box to restart.")) - return render_template('admin.html', get_setting=get_setting, form=form) + return render_template('admin.html', raspap_installed=raspap_installed, get_setting=get_setting, form=form) @app.route('/messaging', methods=['GET', 'POST']) diff --git a/app/static/css/butter_styles.css b/app/static/css/butter_styles.css index 472306f..97eb2cd 100644 --- a/app/static/css/butter_styles.css +++ b/app/static/css/butter_styles.css @@ -4,7 +4,9 @@ .butter-title { text-align: center; } - +.butter-form-margin { + margin-right: 10px; +} .butter-service { border-radius: 20px; } diff --git a/app/templates/admin.html b/app/templates/admin.html index 82b8693..5e60663 100644 --- a/app/templates/admin.html +++ b/app/templates/admin.html @@ -16,61 +16,90 @@ {{ form.apply_changes(class="button is-warning") }} {% endif %} -
- {{ wtf.form_input_field(form.ssid, form.ssid.errors) }} -

This is the name of the advertised Wi-Fi network. Current SSID: {{ get_setting('ssid') }}

+ + + + +
+ {{ wtf.form_bool_field(form.enable_map_viewer) }} +

Whether map services are enabled.

-
- {{ wtf.form_input_field(form.wifi_password, form.wifi_password.errors) }} -

This is the secret key needed to connect to the Wi-Fi network. By default, this is not set and everyone can join. - Current password: {{ get_setting('wifi_password') or 'Not set' }}

+
+ {{ wtf.form_bool_field(form.enable_chat) }} +

Whether Matrix chat services are enabled.

+
+ {{ wtf.form_bool_field(form.enable_deltachat) }} +

Whether messaging using DeltaChat is enabled.

+
+
+ {{ wtf.form_bool_field(form.enable_file_viewer) }} +

Whether files services via USB are enabled.

+
+
+ {{ wtf.form_bool_field(form.enable_app_store) }} +

Whether app store services are enabled.

+
+ +
+ +
{{ wtf.form_input_field(form.butterbox_name, form.butterbox_name.errors) }}

This is the name shown in the UI. Current name: {{ get_setting('butterbox_name') }}, accessed at {{ get_setting('butterbox_name') }}.local.

-
{{ wtf.form_input_field(form.butterbox_hostname, form.butterbox_hostname.errors) }} -

This is used to access the box locally by adding .local or .lan in your browser. +

This is the URL used to access the box by adding .local in your browser. Current hostname: {{ get_setting('butterbox_hostname') }}.local.

-
- {{ wtf.form_bool_field(form.enable_access_point) }} -

Whether this box will advertise a Wi-Fi network.

-
-
- {{ wtf.form_bool_field(form.enable_wifi_sharing) }} -

Whether a share button for the Wi-Fi network is available.

-
-
- {{ wtf.form_bool_field(form.enable_map_viewer) }} -

Whether map services are enabled.

-
-
- {{ wtf.form_bool_field(form.enable_chat) }} -

Whether chat services are enabled.

-
-
- {{ wtf.form_bool_field(form.enable_deltachat) }} -

Whether secure messaging using DeltaChat is enabled.

-
-
- {{ wtf.form_bool_field(form.enable_file_viewer) }} -

Whether files services via USB are enabled.

-
-
- {{ wtf.form_bool_field(form.enable_app_store) }} -

Whether app store services are enabled.

+ +
{{ form.butterbox_logo(class='label', style="width: 280px") }}
+ {{ wtf.field_errors(form.butterbox_logo.errors) }} +

This is the logo shown in the UI. Current logo:

+ +
+ + +
+ + + {% if raspap_installed %} +
+ {{ wtf.form_input_field(form.ssid, form.ssid.errors) }} +

This is the name of the advertised Wi-Fi network. Current SSID: {{ get_setting('ssid') }}

+
+
+ {{ wtf.form_input_field(form.wifi_password, form.wifi_password.errors) }} +

This is the secret key needed to connect to the Wi-Fi network. By default, this is not set and everyone can join. + Current password: {{ get_setting('wifi_password') or 'Not set' }}

+
+ +
+ {{ wtf.form_bool_field(form.enable_access_point) }} +

Whether this box will advertise a Wi-Fi network.

+
+
+ {{ wtf.form_bool_field(form.enable_wifi_sharing) }} +

Whether a share button for the Wi-Fi network is available.

+
+ {% else %} +

Access point is only enabled when using a Raspberry Pi.

+ {% endif %} + +
+ + +
{{ wtf.form_password_field(form.admin_password, form.admin_password.errors) }}

Password for accessing this browser interface.

-
+
{% for subfield in form.root_account_settings %} -