Minor fixes
This commit is contained in:
parent
699d28da17
commit
441031a4ac
4 changed files with 16 additions and 14 deletions
|
|
@ -19,7 +19,7 @@ import qrcode
|
||||||
from flask_babel import lazy_gettext as _l
|
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']
|
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:
|
def gen_username() -> str:
|
||||||
words = top_n_list("en", 5000)
|
words = top_n_list("en", 5000)
|
||||||
|
|
@ -84,13 +84,13 @@ def index():
|
||||||
enable_chat = get_setting("enable_chat")
|
enable_chat = get_setting("enable_chat")
|
||||||
enable_file_viewer = get_setting("enable_file_viewer")
|
enable_file_viewer = get_setting("enable_file_viewer")
|
||||||
enable_deltachat = get_setting("enable_deltachat")
|
enable_deltachat = get_setting("enable_deltachat")
|
||||||
enable_wifi_sharing = get_setting("enable_wifi_sharing")
|
|
||||||
service_array = []
|
service_array = []
|
||||||
usb_inserted = False # actual test of whether USB is inserted
|
usb_inserted = False # actual test of whether USB is inserted
|
||||||
if os.path.exists(app.config["BUTTERBOX_USB_PATH"]):
|
if os.path.exists(app.config["BUTTERBOX_USB_PATH"]):
|
||||||
usb_inserted = True
|
usb_inserted = True
|
||||||
usb_has_maps = False # actual test of whether USB has maps folder
|
usb_has_maps = False # actual test of whether USB has maps folder
|
||||||
usb_has_appstore = False # actual test of whether USB has an appstore
|
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':
|
#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")})
|
# service_array.append({"name": _l("Share Access"), "image": url_for("static", filename="images/share-icon.svg"), "url": url_for("share")})
|
||||||
if enable_deltachat == 'true':
|
if enable_deltachat == 'true':
|
||||||
|
|
@ -211,7 +211,6 @@ def step2():
|
||||||
@app.route('/step3', methods=['GET', 'POST'])
|
@app.route('/step3', methods=['GET', 'POST'])
|
||||||
def step3():
|
def step3():
|
||||||
form = Step3Form()
|
form = Step3Form()
|
||||||
|
|
||||||
step3_bool_settings = ['enable_wifi_sharing', 'enable_access_point']
|
step3_bool_settings = ['enable_wifi_sharing', 'enable_access_point']
|
||||||
step3_settings = ['ssid', 'wifi_password']
|
step3_settings = ['ssid', 'wifi_password']
|
||||||
if not form.is_submitted():
|
if not form.is_submitted():
|
||||||
|
|
@ -221,13 +220,15 @@ def step3():
|
||||||
getattr(form, s).data = get_setting(s)
|
getattr(form, s).data = get_setting(s)
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
if form.submit.data:
|
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
|
setting_value = getattr(form, s).data
|
||||||
|
if s in step3_bool_settings:
|
||||||
|
setting_value = str(setting_value).lower()
|
||||||
set_setting(s, setting_value)
|
set_setting(s, setting_value)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return redirect(url_for('step4'))
|
return redirect(url_for('step4'))
|
||||||
if get_setting("first_setup") == "true":
|
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'))
|
return redirect(url_for('admin'))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -278,7 +279,6 @@ def admin():
|
||||||
@app.route('/admin_settings', methods=['GET', 'POST'])
|
@app.route('/admin_settings', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def admin_settings():
|
def admin_settings():
|
||||||
raspap_installed = os.path.exists("/var/www/html/raspap")
|
|
||||||
form = SettingsForm()
|
form = SettingsForm()
|
||||||
populate_settings = ['butterbox_name', 'wifi_password', 'ssid', 'root_account_settings', 'ssh_access_settings', 'root_password', 'admin_password']
|
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']
|
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")
|
set_setting('apply_changes', "true")
|
||||||
dump_settings("settings.txt")
|
dump_settings("settings.txt")
|
||||||
flash(_("⚠️ Changes applied! If needed, the system will restart. This may take up to two minutes."))
|
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'])
|
@app.route('/messaging', methods=['GET', 'POST'])
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,11 @@
|
||||||
<a href="{{ url_for('admin') }}" class="navbar-item"> <span class="icon">
|
<a href="{{ url_for('admin') }}" class="navbar-item"> <span class="icon">
|
||||||
<i class="fa fa-user" aria-hidden="true"></i>
|
<i class="fa fa-user" aria-hidden="true"></i>
|
||||||
</span>{{ _("Admin Settings") }}</a>
|
</span>{{ _("Admin Settings") }}</a>
|
||||||
<a href="{{ url_for('share') }}" class="navbar-item"> <span class="icon">
|
{% if get_setting('enable_wifi_sharing') == 'true' %}
|
||||||
<i class="fa fa-share" aria-hidden="true"></i>
|
<a href="{{ url_for('share') }}" class="navbar-item"> <span class="icon">
|
||||||
</span>{{ _("Share Access") }}</a>
|
<i class="fa fa-share" aria-hidden="true"></i>
|
||||||
|
</span>{{ _("Share Access") }}</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
{% block navbar_logout %}{% endblock %}
|
{% block navbar_logout %}{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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">
|
<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>
|
<button class="button butter-centered"><a href={{ url_for("index") }}> {{ _("Continue to Portal")}}</a></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,5 @@ _('Confirm password')
|
||||||
_('Help Center')
|
_('Help Center')
|
||||||
_('Language')
|
_('Language')
|
||||||
_('Share Access')
|
_('Share Access')
|
||||||
_('512 x 512 px. Recommended size.')
|
_('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.")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue