Minor fixes

This commit is contained in:
Ana Custura 2026-03-30 11:22:30 +01:00
parent 699d28da17
commit 441031a4ac
4 changed files with 16 additions and 14 deletions

View file

@ -19,7 +19,7 @@ import qrcode
from flask_babel import lazy_gettext as _l
CHANGES_REQUIRING_RESTART = ['wifi_password', 'ssid', 'enable_access_point', 'enable_chat', 'enable_delta_chat', 'butterbox_hostname', 'ssh_access_settings', 'root_account_settings', 'root_password']
RASPAP_INSTALLED = os.path.exists("/var/www/html/raspap")
def gen_username() -> str:
words = top_n_list("en", 5000)
@ -84,13 +84,13 @@ def index():
enable_chat = get_setting("enable_chat")
enable_file_viewer = get_setting("enable_file_viewer")
enable_deltachat = get_setting("enable_deltachat")
enable_wifi_sharing = get_setting("enable_wifi_sharing")
service_array = []
usb_inserted = False # actual test of whether USB is inserted
if os.path.exists(app.config["BUTTERBOX_USB_PATH"]):
usb_inserted = True
usb_has_maps = False # actual test of whether USB has maps folder
usb_has_appstore = False # actual test of whether USB has an appstore
#enable_wifi_sharing = get_setting("enable_wifi_sharing")
#if enable_wifi_sharing == 'true':
# service_array.append({"name": _l("Share Access"), "image": url_for("static", filename="images/share-icon.svg"), "url": url_for("share")})
if enable_deltachat == 'true':
@ -211,7 +211,6 @@ def step2():
@app.route('/step3', methods=['GET', 'POST'])
def step3():
form = Step3Form()
step3_bool_settings = ['enable_wifi_sharing', 'enable_access_point']
step3_settings = ['ssid', 'wifi_password']
if not form.is_submitted():
@ -221,13 +220,15 @@ def step3():
getattr(form, s).data = get_setting(s)
if form.validate_on_submit():
if form.submit.data:
for s in (step3_bool_settings + step3_settings):
for s in (step3_settings + step3_bool_settings):
setting_value = getattr(form, s).data
if s in step3_bool_settings:
setting_value = str(setting_value).lower()
set_setting(s, setting_value)
db.session.commit()
return redirect(url_for('step4'))
if get_setting("first_setup") == "true":
return render_template('step3.html', form=form, get_setting=get_setting)
return render_template('step3.html', raspap_installed=RASPAP_INSTALLED, form=form, get_setting=get_setting)
return redirect(url_for('admin'))
@ -278,7 +279,6 @@ def admin():
@app.route('/admin_settings', methods=['GET', 'POST'])
@login_required
def admin_settings():
raspap_installed = os.path.exists("/var/www/html/raspap")
form = SettingsForm()
populate_settings = ['butterbox_name', 'wifi_password', 'ssid', 'root_account_settings', 'ssh_access_settings', 'root_password', 'admin_password']
bool_settings = ['enable_access_point','enable_file_viewer', 'enable_chat', 'enable_deltachat', 'enable_wifi_sharing']
@ -337,7 +337,7 @@ def admin_settings():
set_setting('apply_changes', "true")
dump_settings("settings.txt")
flash(_("⚠️ Changes applied! If needed, the system will restart. This may take up to two minutes."))
return render_template('admin.html', raspap_installed=raspap_installed, 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'])

View file

@ -34,10 +34,11 @@
<a href="{{ url_for('admin') }}" class="navbar-item"> <span class="icon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>{{ _("Admin Settings") }}</a>
{% if get_setting('enable_wifi_sharing') == 'true' %}
<a href="{{ url_for('share') }}" class="navbar-item"> <span class="icon">
<i class="fa fa-share" aria-hidden="true"></i>
</span>{{ _("Share Access") }}</a>
{% endif %}
</div>
<div class="navbar-end">
{% block navbar_logout %}{% endblock %}

View file

@ -1,10 +1,10 @@
{% extends "base.html" %}
{% block content %}
<div class="block"><h1 class="title is-large">{{ _("Changes have been applied ") }}.</h1></div>
<div class="block"><h1 class="title is-large">{{ _("Changes have been applied") }}.</h1></div>
<div class="block">
<p class="subtitle"> {{ _("Continue to your box portal. The portal is the view others will see when they connect to the box hotspot.") }}</p>
<p class="subtitle"> {{ _("The box will now reboot to apply settings. This can take up to one minute.") }}</p>
<button class="button butter-centered"><a href={{ url_for("index") }}> {{ _("Continue to Portal")}}</a></button>
</div>

View file

@ -18,3 +18,4 @@ _('Help Center')
_('Language')
_('Share Access')
_('512 x 512 px. Recommended size.')
_("Continue to your box portal. The portal is the view others will see when they connect to the box hotspot.")