Update first time setup flow; update strings, include strings from figma

This commit is contained in:
Ana Custura 2026-03-29 17:17:47 +01:00
parent 9937cc8884
commit 4c25aeabf9
23 changed files with 1451 additions and 245 deletions

View file

@ -15,9 +15,7 @@ def seed_defaults():
"onboarding_complete": "false",
"lock_root_password": "false",
"enable_file_viewer": current_app.config["ENABLE_FILE_VIEWER"],
"enable_map_viewer": current_app.config["ENABLE_MAP_VIEWER"],
"enable_chat": current_app.config["ENABLE_CHAT"],
"enable_app_store": current_app.config["ENABLE_APP_STORE"],
"enable_deltachat": current_app.config["ENABLE_DELTACHAT"],
"ssh_password": "",
"admin_password": current_app.config["ADMIN_PASSWORD"],
@ -26,6 +24,7 @@ def seed_defaults():
"root_account_settings": "",
"ssh_access_settings": "disable_ssh",
"root_password": "",
"first_setup": "true",
}
for key, value in defaults.items():

View file

@ -10,13 +10,13 @@ def hostname_check(form, field):
regex= re.compile("[a-zA-Z0-9-_]+")
matches = re.fullmatch(regex, field.data)
if not matches:
raise ValidationError(_l('Only dashes, underscores, letters and numbers allowed'))
raise ValidationError(_l('Only dashes, underscores, letters and numbers allowed.'))
def wifi_length_check(form, field):
if len(field.data) > 63:
raise ValidationError('Wifi password cannot be longer than 63 characters.')
raise ValidationError(_l('Wifi password cannot be longer than 63 characters.'))
if len(field.data) in range(1,9):
raise ValidationError('Wifi password cannot be shorter than 8 characters.')
raise ValidationError(_l('Wifi password cannot be shorter than 8 characters.'))
class LoginForm(FlaskForm):
username = StringField(_l('Username'), validators=[DataRequired()])
@ -24,6 +24,34 @@ class LoginForm(FlaskForm):
submit = SubmitField(_l('Sign In'))
remember_me = BooleanField('Remember Me')
class Step1Form(FlaskForm):
enable_file_viewer = BooleanField(_l('Enable File Viewer'))
enable_chat = BooleanField(_l('Enable Chat'))
enable_deltachat = BooleanField(_l('Enable DeltaChat'))
submit = SubmitField(_l('Next'))
class Step2Form(FlaskForm):
butterbox_name = StringField(_l('Butterbox Name'), validators=[DataRequired()])
butterbox_logo = FileField((_l('Butterbox Logo')), validators=[FileAllowed(['jpg', 'png', 'svg'], 'Images only!')])
butterbox_hostname = StringField(_l('Butterbox Hostname'), validators=[DataRequired(), Length(1, 64), hostname_check])
submit = SubmitField(_l('Next'))
class Step3Form(FlaskForm):
ssid = StringField(_l('WiFi Name'), validators=[DataRequired(), Length(1, 64), hostname_check])
wifi_password = StringField(_l('WiFi Password'), validators=[wifi_length_check])
enable_wifi_sharing = BooleanField(_l('Enable WiFi Sharing'))
enable_access_point = BooleanField(_l('Enable Access Point'))
submit = SubmitField(_l('Next'))
class Step4Form(FlaskForm):
admin_password = StringField(_l('Admin Password'), widget=PasswordInput(hide_value=False))
root_password = StringField(_l('Root Password'), widget=PasswordInput(hide_value=False), validators=[DataRequired()])
root_account_settings= RadioField(_l('Secure Root Account Method'), choices=[ ('lock_root_account', _l('Lock root account')), ( 'set_root_password', _l('Use root password'))], validators=[DataRequired()])
ssh_access_settings = RadioField(_l('SSH Access Method'), choices=[ ('disable_ssh', _l('Disable SSH')), ( 'enable_ssh_with_root_password', _l('Enable SSH with root password')), ], validators=[DataRequired()])
# ('enable_ssh_with_public_key', 'Enable SSH with public key'),
lock_root_account = BooleanField(_l('Lock Root Account'))
submit = SubmitField(_l('Apply Changes'))
class SettingsForm(FlaskForm):
# Access point settings
@ -32,23 +60,19 @@ class SettingsForm(FlaskForm):
enable_access_point = BooleanField(_l('Enable Access Point'))
# Customisation settings
butterbox_name = StringField(_l('Butterbox Name'), validators=[DataRequired()])
butterbox_logo = FileField((_l('Butterbox Logo')), validators=[FileAllowed(['jpg', 'png', 'svg'], 'Images only!')])
butterbox_logo = FileField((_l('Butterbox Logo')), validators=[FileAllowed(['jpg', 'png', 'svg'], _l('Images only!'))])
# Services settings
enable_file_viewer = BooleanField(_l('Enable File Viewer'))
enable_map_viewer = BooleanField(_l('Enable Map Viewer'))
enable_chat = BooleanField(_l('Enable Chat'))
enable_app_store = BooleanField(_l('Enable App Store'))
enable_deltachat = BooleanField(_l('Enable DeltaChat'))
enable_wifi_sharing = BooleanField(_l('Enable WiFi Sharing'))
# Access Settings
admin_password = StringField('Admin Password', widget=PasswordInput(hide_value=False))
root_password = StringField('Root Password', widget=PasswordInput(hide_value=False), validators=[DataRequired()])
admin_password = StringField(_l('Admin Password'), widget=PasswordInput(hide_value=False))
root_password = StringField(_l('Root Password'), widget=PasswordInput(hide_value=False), validators=[DataRequired()])
root_account_settings= RadioField(_l('Secure Root Account Method'), choices=[ ('lock_root_account', 'Lock root account'), ( 'set_root_password', 'Use root password')], validators=[DataRequired()])
ssh_access_settings = RadioField(_l('SSH Access Method'), choices=[ ('disable_ssh', 'Disable SSH'), ( 'enable_ssh_with_root_password', 'Enable SSH with root password'), ], validators=[DataRequired()])
root_account_settings= RadioField(_l('Secure Root Account Method'), choices=[('lock_root_account', _l('Lock root account')), ( 'set_root_password', _l('Use root password'))], validators=[DataRequired()])
ssh_access_settings = RadioField(_l('SSH Access Method'), choices=[ ('disable_ssh', _l('Disable SSH')), ( 'enable_ssh_with_root_password', _l('Enable SSH with root password')), ], validators=[DataRequired()])
# ('enable_ssh_with_public_key', 'Enable SSH with public key'),
lock_root_account = BooleanField(_l('Lock Root Account'))
butterbox_hostname = StringField(_l('Butterbox Hostname'), validators=[DataRequired(), Length(1, 64), hostname_check])
submit = SubmitField(_l('Submit'))
apply_changes = SubmitField(_l('Apply Changes'))

View file

@ -1,6 +1,6 @@
from app import app
from flask import render_template, flash, redirect, url_for, send_file
from app.forms import LoginForm, SettingsForm
from app.forms import LoginForm, SettingsForm, Step1Form, Step2Form, Step3Form, Step4Form
from flask_login import login_user, current_user, logout_user, login_required
import sqlalchemy as sa
from app import db
@ -16,6 +16,7 @@ import string
import glob
import time
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']
@ -60,7 +61,6 @@ def get_files_in_path(path: str):
"icon_url": get_file_icon_url(x),
"relative_path": x.replace(app.config["BUTTERBOX_USB_PATH"], "")} for x
in list_of_files]
print(file_list)
return file_list
def get_setting(name) -> str:
@ -82,8 +82,6 @@ def dump_settings(filename: str) -> None:
@app.route('/index')
def index():
enable_chat = get_setting("enable_chat")
enable_app_store = get_setting("enable_app_store")
enable_map_viewer = get_setting("enable_map_viewer")
enable_file_viewer = get_setting("enable_file_viewer")
enable_deltachat = get_setting("enable_deltachat")
enable_wifi_sharing = get_setting("enable_wifi_sharing")
@ -94,19 +92,19 @@ def index():
usb_has_maps = False # actual test of whether USB has maps folder
usb_has_appstore = False # actual test of whether USB has an appstore
if enable_wifi_sharing == 'true':
service_array.append({"name": "Share WiFi", "image": url_for("static", filename="images/share-icon.svg"), "url": url_for("share")})
service_array.append({"name": _l("Share WiFi"), "image": url_for("static", filename="images/share-icon.svg"), "url": url_for("share")})
if enable_deltachat == 'true':
service_array.append({"name": "Secure Messaging", "image": url_for("static", filename="images/deltachat-icon.svg"), "url": url_for("messaging") })
service_array.append({"name": _l("Secure Messenger"), "image": url_for("static", filename="images/deltachat-icon.svg"), "url": url_for("messaging") })
if enable_chat == 'true':
service_array.append({"name": "Message Board", "image": url_for("static", filename="images/chat-icon.png"), "url": f"{app.config["CONVENE_INSTALL_PATH"]}/#/room/join/%23public%3abutterbox.local"})
if enable_app_store == 'true' and usb_has_appstore:
service_array.append({"name": "Apps", "image": url_for("static", filename="images/appstore-icon.svg")})
if enable_map_viewer == 'true' and usb_has_maps:
service_array.append({"name": "Offline Maps", "image": url_for("static", filename="images/maps-icon.png")})
service_array.append({"name": _l("Local Chat"), "image": url_for("static", filename="images/chat-icon.png"), "url": f"{app.config["CONVENE_INSTALL_PATH"]}/#/room/join/%23public%3abutterbox.local"})
if enable_file_viewer == 'true' and usb_has_appstore:
service_array.append({"name": _l("Apps"), "image": url_for("static", filename="images/appstore-icon.svg")})
if enable_file_viewer == 'true' and usb_has_maps:
service_array.append({"name": _l("Maps"), "image": url_for("static", filename="images/maps-icon.png")})
if enable_file_viewer == 'true':
name = "Files"
name = _l("Files")
if not usb_inserted:
name = "Insert USB to browse files"
name = _l("Insert USB to browse files")
service_array.append({
"name": name,
"image": url_for("static", filename="images/explore-icon.svg"),
@ -150,26 +148,151 @@ def login():
return render_template('login.html', title='Sign in', form=form, get_setting=get_setting)
@app.route('/first_setup')
def first_setup():
if get_setting("first_setup") == "true":
return render_template('first_setup_main_page.html', get_setting=get_setting)
return redirect(url_for('admin'))
@app.route('/admin_setup')
def admin_setup():
if get_setting("first_setup") == "true":
return render_template('admin_setup.html', get_setting=get_setting)
return redirect(url_for('admin'))
@app.route('/step1', methods=['GET', 'POST'])
def step1():
form = Step1Form()
step1_settings = ['enable_chat', 'enable_deltachat', 'enable_file_viewer']
if not form.is_submitted():
for s in step1_settings:
getattr(form, s).data = (get_setting(s) == "true")
if form.validate_on_submit():
if form.submit.data:
for s in step1_settings:
setting_value = getattr(form, s).data
setting_value = str(setting_value).lower()
set_setting(s, setting_value)
db.session.commit()
return redirect(url_for('step2'))
if get_setting("first_setup") == "true":
return render_template('step1.html', form=form, get_setting=get_setting)
return redirect(url_for('admin'))
@app.route('/step2', methods=['GET', 'POST'])
def step2():
form = Step2Form()
step2_settings = ['butterbox_hostname', 'butterbox_name']
if not form.is_submitted():
for s in step2_settings:
getattr(form, s).data = get_setting(s)
if form.validate_on_submit():
if form.submit.data:
for s in step2_settings:
setting_value = getattr(form, s).data
if s == 'butterbox_hostname':
setting_value = setting_value.lower().replace(" ", "")
set_setting(s, setting_value)
new_logo = form.butterbox_logo.data
if new_logo.filename:
logo_stream = form.butterbox_logo.data.stream
b64_logo = base64.b64encode(logo_stream.read()).decode('utf-8')
file_mimetype = form.butterbox_logo.data.mimetype
new_value = f"data:{file_mimetype};base64,{b64_logo}"
existing_value = get_setting('butterbox_logo')
if new_value != existing_value:
set_setting('butterbox_logo', new_value)
db.session.commit()
return redirect(url_for('step3'))
if get_setting("first_setup") == "true":
return render_template('step2.html', form=form, get_setting=get_setting)
return redirect(url_for('admin'))
@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():
for s in step3_bool_settings:
getattr(form, s).data = (get_setting(s) == "true")
for s in step3_settings:
getattr(form, s).data = get_setting(s)
if form.validate_on_submit():
if form.submit.data:
for s in (step3_bool_settings + step3_settings):
setting_value = getattr(form, s).data
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 redirect(url_for('admin'))
@app.route('/step4', methods=['GET', 'POST'])
def step4():
form = Step4Form()
step4_settings = ['root_account_settings', 'ssh_access_settings', 'root_password', 'admin_password']
if not form.is_submitted():
for s in step4_settings:
getattr(form, s).data = get_setting(s)
if form.validate_on_submit():
if form.submit.data:
new_admin_password = form.admin_password.data
if new_admin_password:
admin_user = db.session.scalar(sa.select(User).where(User.username == 'admin'))
if not admin_user.check_password(new_admin_password):
admin_user.set_password(new_admin_password)
db.session.add(admin_user)
step4_settings.remove('admin_password')
for s in step4_settings:
setting_value = getattr(form, s).data
set_setting(s, setting_value)
set_setting('first_setup', "false")
db.session.commit()
return redirect(url_for('setup_complete'))
if get_setting("first_setup") == "true":
return render_template('step4.html', form=form, get_setting=get_setting)
return redirect(url_for('admin'))
@app.route('/setup_complete')
def setup_complete():
if get_setting("first_setup"):
dump_settings("settings.txt")
return render_template('setup_complete.html', get_setting=get_setting)
return redirect(url_for('admin'))
@app.route('/logout')
def logout():
logout_user()
return redirect(url_for('admin'))
@app.route('/admin', methods=['GET', 'POST'])
@login_required
return redirect(url_for('admin_setup'))
@app.route('/admin', methods=['GET'])
def admin():
if get_setting("first_setup") == "true":
return redirect(url_for('first_setup'))
return redirect(url_for('admin_settings'))
@app.route('/admin_settings', methods=['GET', 'POST'])
@login_required
def admin_settings():
raspap_installed = os.path.exists("/var/www/html/raspap")
raspap_installed = True
form = SettingsForm()
populate_settings = ['butterbox_name', 'wifi_password', 'ssid', 'butterbox_hostname', 'root_account_settings', 'ssh_access_settings', 'root_password', 'admin_password']
bool_settings = ['enable_access_point','enable_file_viewer', 'enable_map_viewer', 'enable_app_store', 'enable_chat', 'enable_deltachat', 'enable_wifi_sharing']
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']
populate_settings.extend(bool_settings)
if not form.is_submitted():
for s in populate_settings:
if s in bool_settings:
getattr(form, s).data = (get_setting(s) == "true")
else:
print(s, get_setting(s))
getattr(form, s).data = get_setting(s)
non_admin_settings_changed = False
if not form.validate_on_submit():
print(form.errors)
if form.validate_on_submit():
if form.submit.data:
for s in populate_settings:
@ -215,7 +338,6 @@ def admin():
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)

View file

@ -19,11 +19,6 @@
<label class="label is-large">Services</label>
<div class="field checkbox" style="display: none">
{{ wtf.form_bool_field(form.enable_map_viewer) }}
<p class="help butter-form-margin">Whether map services are enabled.</p>
</div>
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_chat) }}
<p class="help butter-form-margin">Whether Matrix chat services are enabled.</p>
@ -36,10 +31,7 @@
{{ wtf.form_bool_field(form.enable_file_viewer) }}
<p class="help butter-form-margin">Whether files services via USB are enabled.</p>
</div>
<div class="field checkbox" style="display: none">
{{ wtf.form_bool_field(form.enable_app_store) }}
<p class="help">Whether app store services are enabled.</p>
</div>
<hr>
<label class="label is-large">Branding and name</label>
@ -49,11 +41,6 @@
<p class="help">This is the name shown in the UI.
Current name: {{ get_setting('butterbox_name') }}, accessed at {{ get_setting('butterbox_name') }}.local.</p>
</div>
<div class="field">
{{ wtf.form_input_field(form.butterbox_hostname, form.butterbox_hostname.errors) }}
<p class="help">This is the URL used to access the box by adding .local in your browser.
Current hostname: {{ get_setting('butterbox_hostname') }}.local.</p>
</div>
<div class="field">
<label class="label">{{ form.butterbox_logo.label }} </label>
<div class="control block">{{ form.butterbox_logo(class='label', style="width: 280px") }}</div>

View file

@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block content %}
{% import "bulma_wtf.html" as wtf %}
<div class="block"><h1 class="title is-large">{{ _("Admin Settings")}}</h1></div>
<div class="block grid">
<a class="cell button is-large is-responsive butter-service" href={{ url_for("step1") }}>
<div class="butter-service__content"> <p style="text-wrap: wrap;">01 {{ _("Choose Services") }}</p>
</div></a>
<a class="cell button is-large is-responsive butter-service" href={{ url_for("step2") }}>
<div class="butter-service__content"> <p style="text-wrap: wrap;">02 {{ _("Customise Portal") }}</p>
</div></a>
<a class="cell button is-large is-responsive butter-service" href={{ url_for("step3") }}>
<div class="butter-service__content"> <p style="text-wrap: wrap;">03 {{ _("Secure Portal") }}</p>
</div></a>
<a class="cell button is-large is-responsive butter-service" href={{ url_for("step4") }}>
<div class="butter-service__content"> <p style="text-wrap: wrap;">04 {{ _("Secure Admin Settings") }}</p>
</div></a>
</div>
{% endblock %}

View file

@ -31,7 +31,7 @@
<div id="navbarBasic" class="navbar-menu">
<div class="navbar-start">
<a href="{{ url_for('admin') }}" class="navbar-item">Admin
<a href="{{ url_for('admin') }}" class="navbar-item">{{ _("Admin Settings") }}
</a>
</div>
<div class="navbar-end">

View file

@ -11,8 +11,8 @@
{% macro form_bool_field(field) %}
<div class="control block">
{{ field(class='checkbox', type="checkbox", style="display: inline") }}
{{ field.label(class='label')}}
{{ field(class='checkbox', type="checkbox") }}
{% for error in errors %}
<p class="help is-danger">{{ error }}</p>
{% endfor %}

View file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block content %}
{% import "bulma_wtf.html" as wtf %}
<div class="block"><h1 class="title is-large">{{ _("Set up your box")}}</h1></div>
<div class="block">
<p class="grey">{{ _("Version")}} 1.0.1</p>
</div>
<div class="block">
<p class="subtitle">{{ _("You have full control over the services on this box and its security. Continue to Admin Settings to personalize your setup.")}}</p>
<button class="button butter-centered"><a href={{ url_for("admin_setup") }}> {{ _("Continue")}}</a></button>
</div>
{% endblock %}

View file

@ -1,8 +1,9 @@
{% extends "base.html" %}
{% block content %}
<div class="block"><h1 class="title is-large butter-title">Welcome.</h1></div>
<div class="block"><p class="subtitle butter-title"> View and download the information you want from this offline box.</p></div>
<div class="block"><h1 class="title is-large butter-title">{{ _("Welcome.") }}</h1></div>
<div class="block"><p class="subtitle butter-title"> {{ _("View and download the information you want from this offline
box.")}}</p></div>
<div class="block grid">
{% for service in services %}

View file

@ -3,7 +3,7 @@
{% block content %}
{% import "bulma_wtf.html" as wtf %}
<h1>Sign In</h1>
<h1>{{ _("Sign In")}}</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<div class="field">{{ wtf.form_input_field(form.username) }}</div>

View file

@ -1,19 +1,19 @@
{% extends "base.html" %}
{% block content %}
<h1 class="title is-large butter-title">{{ _('Secure Messaging') }}</h1>
<h1 class="title is-large butter-title">{{ _('Secure Messenger') }}</h1>
<div class="block">
<p> To use secure messaging, install Delta Chat and then return to this page to create your local offline account</p>
<p> {{ _("To use secure messaging, install Delta Chat and then return to this page to create your local offline account.")}}</p>
</div>
<a href="{{ url_for('static', filename='DeltaChat_2.35.0_APKPure.apk') }}"><button class="button is-link is-fullwidth block">
<p>Step 1<br> Download and install</p>
<p>{{ _("Step 1") }}<br> {{ _("Download and install") }}</p>
</button>
</a>
<div class="block"></div>
<form action="{{ url_for('generate_random_deltachat_credentials') }}" method="post">
<button type="submit" class="button is-link is-fullwidth block">
<p>Step 2 <br> Create offline account </p>
<p>{{ _("Step 2") }} <br> {{ _("Create offline account") }} </p>
</button>
</form>
{% endblock %}

View file

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block content %}
<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>
<button class="button butter-centered"><a href={{ url_for("index") }}> {{ _("Continue to Portal")}}</a></button>
</div>
{% endblock %}

View file

@ -1,16 +1,16 @@
{% extends "base.html" %}
{% block content %}
<h1 class="title is-large butter-title">Share access to {{get_setting('butterbox_name')}}.</h1>
<h1 class="title is-large butter-title">{{ _("Share access to")}} {{get_setting('butterbox_name')}}.</h1>
<div class="block butter-centered">
{% if display_wifi_password %}
<p>Connect to WiFi name: "{{ get_setting('ssid') }}" with password: "{{ get_setting('wifi_password') }}".</p>
<p>{{ _("Connect to WiFi name:")}} "{{ get_setting('ssid') }}" {{ _("with password:")}} "{{ get_setting('wifi_password') }}".</p>
{% else %}
<p>Your WiFi name is "{{ get_setting('ssid') }}". You will be able to join without a password.</p>
<p>{{ _("Your WiFi name is")}} "{{ get_setting('ssid') }}". {{ _("You will be able to join without a password.")}}</p>
{% endif %}
<p>You can also use the following QR code to join:</p>
<p>{{ _("You can also use the following QR code to join:")}}</p>
</div>
<div class="block butter-centered">
<img class="image is-256x256" style="margin: 0 auto" src="{{ url_for('static', filename='images/wifi_qr_code.png') }}">

31
app/templates/step1.html Normal file
View file

@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block content %}
<div class="block"><h1 class="title is-large">{{ _("Choose Services") }}.</h1></div>
<div class="block"><p class="subtitle"> {{ _("To learn more about individual services and what is required to run them, visit the Help Center. You can change the services anytime.") }}</p></div>
<div class="block grid">
{% import "bulma_wtf.html" as wtf %}
<form action="" method="post" enctype="multipart/form-data" novalidate >
{{ form.hidden_tag() }}
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_chat) }}
<p class="help butter-form-margin">{{ _("Whether Matrix chat services are enabled.")}}</p>
</div>
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_deltachat) }}
<p class="help butter-form-margin">{{ _("Whether messaging using DeltaChat is enabled.")}}</p>
</div>
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_file_viewer) }}
<p class="help butter-form-margin">{{ _("Whether files services via USB are enabled.")}}</p>
</div>
<div class="control block">
<button class="button"> <a href={{ url_for("admin_setup") }}>{{ _("Back") }}</a></button>
{{ form.submit( class="button is-link") }}
</div>
</form>
</div>
{% endblock %}

35
app/templates/step2.html Normal file
View file

@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block content %}
<div class="block"><h1 class="title is-large">{{ _("Customise Portal") }}.</h1></div>
<div class="block"><p class="subtitle"> {{ _("The URL is the address users will enter into a browser after they connect to the box network. From here, they can view the portal. This cannot be changed later.") }}</p></div>
<div class="block grid">
{% import "bulma_wtf.html" as wtf %}
<form action="" method="post" enctype="multipart/form-data" novalidate >
{{ form.hidden_tag() }}
<div class="field">
{{ wtf.form_input_field(form.butterbox_name, form.butterbox_name.errors) }}
<p class="help">{{ _("This is the name shown in the UI.
Current name:")}} {{ get_setting('butterbox_name') }}, {{ _("accessed at")}} {{ get_setting('butterbox_name') }}.local.</p>
</div>
<div class="field">
{{ wtf.form_input_field(form.butterbox_hostname, form.butterbox_hostname.errors) }}
<p class="help">{{ _("This is the URL used to access the box by adding .local in your browser.
Current hostname:")}} {{ get_setting('butterbox_hostname') }}.local.</p>
</div>
<div class="field">
<label class="label">{{ form.butterbox_logo.label }} </label>
<div class="control block">{{ form.butterbox_logo(class='label', style="width: 280px") }}</div>
{{ wtf.field_errors(form.butterbox_logo.errors) }}
<div class="block"><p class="help">{{ _("This is the logo shown in the UI. Current logo:")}}</p></div>
<img src="{{ get_setting('butterbox_logo') }}" style="height: 50px">
</div>
<div class="control block">
<button class="button"> <a href={{ url_for("step1") }}>{{ _("Back") }}</a></button>
{{ form.submit( class="button is-link") }}
</div>
</form>
</div>
{% endblock %}

59
app/templates/step3.html Normal file
View file

@ -0,0 +1,59 @@
{% extends "base.html" %}
{% block content %}
<div class="block"><h1 class="title is-large">{{ _("Secure Portal") }}.</h1></div>
<div class="block grid">
{% import "bulma_wtf.html" as wtf %}
<form action="" method="post" enctype="multipart/form-data" novalidate >
{{ form.hidden_tag() }}
{% if raspap_installed %}
<div class="field">
{{ wtf.form_input_field(form.ssid, form.ssid.errors) }}
<p class="help"> {{ _("This is the name of the advertised Wi-Fi network. Current SSID:")}} {{ get_setting('ssid') }}</p>
</div>
<div class="field password">
{{ wtf.form_input_field(form.wifi_password, form.wifi_password.errors) }}
<p class="help"> {{ _("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') }}</p>
</div>
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_access_point) }}
<p class="butter-form-margin help">{{ _("Whether this box will advertise a Wi-Fi network.")}}</p>
</div>
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_wifi_sharing) }}
<p class="butter-form-margin help">{{ _("Whether a share button for the Wi-Fi network is available.")}}</p>
</div>
{% else %}
<div class="block"><p class="subtitle"> {{ _("Access point is only enabled when using a Raspberry Pi.") }} </p></div>
<div style="display: none">
<div class="field">
{{ wtf.form_input_field(form.ssid, form.ssid.errors) }}
<p class="help"> This is the name of the advertised Wi-Fi network. Current SSID: {{ get_setting('ssid') }}</p>
</div>
<div class="field password">
{{ wtf.form_input_field(form.wifi_password, form.wifi_password.errors) }}
<p class="help"> 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' }}</p>
</div>
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_access_point) }}
<p class="butter-form-margin help">Whether this box will advertise a Wi-Fi network.</p>
</div>
<div class="field checkbox">
{{ wtf.form_bool_field(form.enable_wifi_sharing) }}
<p class="butter-form-margin help">Whether a share button for the Wi-Fi network is available.</p>
</div>
</div>
{% endif %}
<div class="control block">
<button class="button"> <a href={{ url_for("step2") }}>{{ _("Back") }}</a></button>
{{ form.submit( class="button is-link") }}
</div>
</form>
</div>
{% endblock %}

60
app/templates/step4.html Normal file
View file

@ -0,0 +1,60 @@
{% extends "base.html" %}
{% block content %}
<div class="block"><h1 class="title is-large">{{ _("Secure Admin Settings") }}.</h1></div>
<div class="block grid">
{% import "bulma_wtf.html" as wtf %}
<form action="" method="post" enctype="multipart/form-data" novalidate >
{{ form.hidden_tag() }}
<div class="control field">
{{ wtf.form_password_field(form.admin_password, form.admin_password.errors) }}
<p class="block help">{{ _("Password for accessing this admin interface.")}}</p>
</div>
<div class="control block">
<label class="label">{{ form.root_account_settings.label }} </label>
{% for subfield in form.root_account_settings %}
<label class="radio butter-form-margin">
{% if get_setting('root_account_settings') == subfield._value() %}
<input id='{{subfield.id}}' type='radio' name='{{subfield.name}}' value='{{subfield._value()}}' checked/>
{% else %}
<input id='{{subfield.id}}' type='radio' name='{{subfield.name}}' value='{{subfield._value()}}'/>
{% endif %}
{{ subfield.label }}
</label>
{% endfor %}
{{ wtf.field_errors(form.root_account_settings.errors)}}
<p class="block help">{{ _("You need to set a root password, and choose whether you want to lock the root
account.")}}</p>
</div>
<div class="control field">
{{ wtf.form_password_field(form.root_password, form.root_password.errors) }}
<p class="help">{{ _("Password for accessing the root account.")}}</p>
</div>
<div class="control block">
<label class="label">{{ form.ssh_access_settings.label }} </label>
{% for subfield in form.ssh_access_settings %}
<label class="radio butter-form-margin">
{% if get_setting('ssh_access_settings') == subfield._value() %}
<input id='{{subfield.id}}' type='radio' name='{{subfield.name}}' value='{{subfield._value()}}' checked/>
{% else %}
<input id='{{subfield.id}}' type='radio' name='{{subfield.name}}' value='{{subfield._value()}}'/>
{% endif %}
{{ subfield.label }}
</label>
{% endfor %}
{{ wtf.field_errors(form.ssh_access_settings.errors) }}
</div>
<div class="control block">
<button class="button"> <a href={{ url_for("step3") }}>{{ _("Back") }}</a></button>
{{ form.submit( class="button is-link") }}
</div>
</form>
</div>
{% endblock %}

View file

@ -8,9 +8,9 @@
<thead>
<tr>
<th></th>
<th>File Name</th>
<th class="file-viewer-date-modified">Date modified</th>
<th>Download</th>
<th>{{ _("File Name")}}</th>
<th class="file-viewer-date-modified">{{ _("Date modified")}}</th>
<th>{{ _("Download") }}</th>
</tr>
</thead>
<tbody>
@ -27,7 +27,7 @@
<td class="file-viewer-date-modified">{{ f.last_modified}}</td>
{% if f.is_file %}
<td><a href="{{ url_for('serve_file', filepath=f.path) }}">Download</a></td>
<td><a href="{{ url_for('serve_file', filepath=f.path) }}">{{ _("Download") }}</a></td>
{% endif %}
{% if f.is_dir %}
<td></td>
@ -36,9 +36,10 @@
{% endfor %}
{% if not render_files %}
<tr>
<td colspan="4"> <p class="butter-centered has-text-grey">Directory is empty</p></td>
<td colspan="4"> <p class="butter-centered has-text-grey">{{ _("Directory is empty") }}</p></td>
</tr>
{% endif %}
</tbody>
</table>
</div>
{% endblock %}

View file

@ -1,6 +1,20 @@
from flask_babel import gettext as _
_('ssid_description')
_('butterbox_name_description')
_('wifi_password_description')
_('logo_description')
_('The URL is the address users will enter into a browser after they connect to the box network. From here, they can view the portal. ')
_('Upload New Logo')
_('After the box is powered on, it will appear as a Wi-Fi network on nearby devices. The Wi-Fi name will show up in the Wi-Fi list.')
_('⚠️ This network only provides access to content on the box. No internet access.')
_('Set a password to limit access to the portal.')
_('Security')
_('Require a Wi-Fi Password')
_('Turn off the Wi-Fi access point if you do not want the box to appear as a Wi-Fi network on nearby devices.')
_('Wi-Fi Access Point (on)')
_('Set Admin Password')
_('Set an admin password to keep admin settings protected. Store somewhere secure. It cannot be reset.')
_('⚠️ This password should not match the Wi-Fi password.')
_('Enter password')
_('Confirm password')
_('Help Center')
_('Language')
_('Share Access')
_('512 x 512 px. Recommended size.')

View file

@ -1,88 +0,0 @@
# English translations for PROJECT.
# Copyright (C) 2026 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-02-10 15:23+0000\n"
"PO-Revision-Date: 2026-02-10 15:29+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.18.0\n"
#: app/__init__.py:19
msgid "Please log in to access this page."
msgstr "Please log in to access this page."
#: app/forms.py:6
msgid "Username"
msgstr "Username"
#: app/forms.py:7
msgid "Password"
msgstr "Password"
#: app/forms.py:8
msgid "Sign In"
msgstr "Sign In"
#: app/forms.py:14
msgid "WiFi Password"
msgstr "WiFi Password"
#: app/forms.py:15
msgid "Butterbox Name"
msgstr "Butterbox Name"
#: app/forms.py:16
msgid "Butterbox Logo"
msgstr "Butterbox Logo"
#: app/forms.py:18
msgid "Submit"
msgstr "Submit"
#: app/routes.py:39
msgid "Invalid username or password"
msgstr "Invalid username or password"
#: app/translation_refs.py:3
msgid "ssid_description"
msgstr "This is the name of the advertised Wi-Fi network."
#: app/translation_refs.py:4
msgid "butterbox_name_description"
msgstr "This is the secret key needed to connect to the Wi-Fi network. By default, this is not set and everyone can join."
#: app/translation_refs.py:5
msgid "wifi_password_description"
msgstr "This is the name shown in the UI, and used to access the box locally by adding .local or .lan in your browser."
#: app/translation_refs.py:6
msgid "logo_description"
msgstr "An image that will be used as the logo."
#: app/templates/admin.html:4
msgid "Application Settings"
msgstr "Application Settings"
#: app/templates/base.html:15
msgid "Home"
msgstr "Home"
#: app/templates/base.html:32
msgid ""
"Admin settings have changed! Restart the butterbox for changes to take "
"effect."
msgstr ""
"Admin settings have changed! Restart the butterbox for changes to take "
"effect."

View file

@ -1,87 +0,0 @@
# Romanian translations for PROJECT.
# Copyright (C) 2026 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-02-10 15:23+0000\n"
"PO-Revision-Date: 2026-02-10 16:28+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: ro\n"
"Language-Team: ro <LL@li.org>\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100"
" < 20)) ? 1 : 2);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.18.0\n"
#: app/__init__.py:19
msgid "Please log in to access this page."
msgstr ""
#: app/forms.py:6
msgid "Username"
msgstr ""
#: app/forms.py:7
msgid "Password"
msgstr "Password"
#: app/forms.py:8
msgid "Sign In"
msgstr "Sign In"
#: app/forms.py:14
msgid "WiFi Password"
msgstr "WiFi Password"
#: app/forms.py:15
msgid "Butterbox Name"
msgstr "Butterbox Name"
#: app/forms.py:16
msgid "Butterbox Logo"
msgstr "Butterbox Logo"
#: app/forms.py:18
msgid "Submit"
msgstr "Submit"
#: app/routes.py:39
msgid "Invalid username or password"
msgstr ""
#: app/translation_refs.py:3
msgid "ssid_description"
msgstr ""
#: app/translation_refs.py:4
msgid "butterbox_name_description"
msgstr ""
#: app/translation_refs.py:5
msgid "wifi_password_description"
msgstr ""
#: app/translation_refs.py:6
msgid "logo_description"
msgstr ""
#: app/templates/admin.html:4
msgid "Application Settings"
msgstr ""
#: app/templates/base.html:15
msgid "Home"
msgstr ""
#: app/templates/base.html:32
msgid ""
"Admin settings have changed! Restart the butterbox for changes to take "
"effect."
msgstr ""