Initial commit

This commit is contained in:
Ana Custura 2026-02-17 08:42:33 +00:00
commit c0b4ca1021
21 changed files with 677 additions and 0 deletions

64
app/templates/admin.html Normal file
View file

@ -0,0 +1,64 @@
{% extends "base.html" %}
{% block content %}
<h1>{{ _('Application Settings') }}</h1>
{% import "bulma_wtf.html" as wtf %}
<form action="" method="post" enctype="multipart/form-data" novalidate >
{{ form.hidden_tag() }}
{% if config['SETTINGS_CHANGED'] %}
<p>{{ form.apply_changes(class="button is-warning") }}</p>
{% endif %}
<div class="field">
{{ wtf.form_input_field(form.ssid) }}
<p class="help"> This is the name of the advertised Wi-Fi network. Current SSID: {{ get_setting('ssid') }}</p>
</div>
<div class="password">
{{ wtf.form_input_field(form.wifi_password) }}
<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">
{{ wtf.form_input_field(form.butterbox_name) }}
<p class="help">This is the name shown in the UI, and used to access the box locally by adding .local or .lan in your browser.
Current name: {{ get_setting('butterbox_name') }}, accessed at {{ get_setting('butterbox_name') }}.local.</p>
</div>
<div class="checkbox">
{{ wtf.form_bool_field(form.disable_access_point) }}
<p class="help">Whether this box will advertise a WiFi network.</p>
</div>
<div class="checkbox">
{{ wtf.form_bool_field(form.disable_map_viewer) }}
<p class="help">Whether map services are enabled.</p>
</div>
<div class="checkbox">
{{ wtf.form_bool_field(form.disable_chat) }}
<p class="help">Whether chat services are enabled.</p>
</div>
<div class="checkbox">
{{ wtf.form_bool_field(form.disable_file_viewer) }}
<p class="help">Whether files services via USB are enabled.</p>
</div>
<div class="checkbox">
{{ wtf.form_bool_field(form.disable_app_store) }}
<p class="help">Whether app store services are enabled.</p>
</div>
<div class="field">
{{ wtf.form_input_field(form.admin_password) }}
<p class="help">Password for accessing this interface.</p>
</div>
<div class="field">
<label class="label">{{ form.butterbox_logo.label }} </label>
<div class="control">{{ form.butterbox_logo(class='label', style="width: 280px") }}</div>
{% for error in form.butterbox_logo.errors %}
<p class="help is-danger">{{ error }}</p>
{% endfor %}
<p class="help">This is the logo shown in the UI. Current logo: <br>
<img src="{{ get_setting('butterbox_logo') }}" style="height: 50px"> </p>
</div>
<p>{{ form.submit( class="button is-link") }}</p>
</form>
<a href="{{ url_for('logout') }}">Logout</a>
{% endblock %}

36
app/templates/base.html Normal file
View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% if title %}
<title>{{ title }}</title>
{% else %}
<title>"{{ get_setting('butterbox_name') }}"</title>
{% endif %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css">
<link rel="stylesheet" href="{{ url_for('static', filename='butter_styles.css') }}">
</head>
<body>
<div class="container">
<div class="header" style="display: inline">
<a href="{{ url_for('index') }}"><img class="image is-32x32" style="display: inline;" src="{{ get_setting('butterbox_logo') }}"></a>
<p style="display: inline; padding-inline-start: 10px;">{{ get_setting('butterbox_name') }}</p>
</div>
<div class="content"> {% block content %}{% endblock %} </div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="notification">
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endwith %}
</div>
</body>
</html>

View file

@ -0,0 +1,20 @@
{% macro form_input_field(field) %}
<div class="control">
{{ field.label(class='label')}}
{{ field(class='input' + (' is-danger' if field.errors else ' is_success'), type="text") }}
{% for error in field.errors %}
<p class="help is-danger">{{ error }}</p>
{% endfor %}
</div>
{% endmacro %}
{% macro form_bool_field(field) %}
<div class="control">
{{ field.label(class='label')}}
{{ field(class='checkbox', type="checkbox") }}
{% for error in field.errors %}
<p class="help is-danger">{{ error }}</p>
{% endfor %}
</div>
{% endmacro %}

17
app/templates/index.html Normal file
View file

@ -0,0 +1,17 @@
{% extends "base.html" %}
{% block content %}
<h1 class="title is-large butter-title">Hi, welcome to the {{get_setting('butterbox_name')}}.</h1>
<p class="subtitle butter-title"> View and download the information you want from this offline box.</p>
<div class="grid">
{% for service in services %}
<a class="cell button is-large is-responsive butter-service" href={{ service.url }}>
<div class="butter-service__content"> {{ service.name }} <br>
<img class="image is-64x64 butter-service__image" src={{ service.image }}>
</div>
</a>
{% endfor %}
</div>
{% endblock %}

14
app/templates/login.html Normal file
View file

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block content %}
{% import "bulma_wtf.html" as wtf %}
<h1>Sign In</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<div class="field">{{ wtf.form_input_field(form.username) }}</div>
<div class="field">{{ wtf.form_input_field(form.password) }}</div>
<div>{{ form.submit(class="button is-link") }}</div>
</form>
{% endblock %}