Compare commits

..

No commits in common. "eeb387d6946258131cebddac144523c539dccbce" and "e0c30040bc64c3aac3cc9e3b955b4b5db45f5578" have entirely different histories.

7 changed files with 60 additions and 148 deletions

View file

@ -15,7 +15,7 @@ def hostname_check(form, field):
def wifi_length_check(form, field):
if len(field.data) > 63:
raise ValidationError(_l('Wifi password cannot be longer than 63 characters.'))
if len(field.data) in range(1,8):
if len(field.data) in range(1,9):
raise ValidationError(_l('Wifi password cannot be shorter than 8 characters.'))
class LoginForm(FlaskForm):

View file

@ -1,6 +1,3 @@
import io
import re
from app import app
from flask import render_template, flash, redirect, url_for, send_file
from app.forms import LoginForm, SettingsForm, Step1Form, Step2Form, Step3Form, Step4Form
@ -28,10 +25,7 @@ RASPAP_INSTALLED = os.path.exists("/var/www/html/raspap")
def gen_username() -> str:
words = top_n_list("en", 5000)
prefix = random.randint(1000, 9999)
word1 = re.sub(r'[^a-zA-Z ]', '', random.choice(words))
word2 = re.sub(r'[^a-zA-Z ]', '', random.choice(words))
print(word1, word2)
return f"{word1}{word2}{prefix}"
return f"{random.choice(words)}{random.choice(words)}{prefix}"
def gen_password() -> str:
characters = string.ascii_letters + string.digits
@ -352,17 +346,15 @@ def messaging():
return render_template('messaging.html', get_setting=get_setting)
@app.route("/deltachat_credentials", methods=["POST"])
def deltachat_credentials():
def generate_random_deltachat_credentials():
ip = app.config['BUTTERBOX_DEFAULT_IP']
username = gen_username()
password = gen_password()
hostname = f"{get_setting('butterbox_hostname')}.local"
dclink = f"dclogin:{username}@{hostname}/?p={password}&v=1&ih={ip}&ip=143&sh={ip}&sp=25&is=plain&ss=plain&sc=3"
img = qrcode.make(dclink)
file_object = io.BytesIO()
img.save(file_object, 'PNG')
base64img = "data:image/png;base64," + base64.b64encode(file_object.getvalue()).decode('ascii')
return render_template('deltachat_creds.html',dclink=dclink, base64img=base64img, get_setting=get_setting)
flash(f"Username: {username}")
flash(f"Password: {password}")
flash(f"IP: {ip}")
return redirect(url_for("messaging"))
@app.route('/share')
def share():

View file

@ -1,24 +0,0 @@
{% extends "base.html" %}
{% block content %}
<h1 class="title is-large butter-title">{{ _('Secure Messenger Account') }}</h1>
<div class="block">
<div class="block">
<p>{{ _('Scan the following QR code with a device where DeltaChat is installed:') }}</p>
</div>
<img src="{{ base64img }}"/>
</div>
<div class="block">
<div class="block"><p class="">{{ _('If your device does not have a camera, select "Create new profile" in DeltaChat, choose "Use Other Server" and find "Paste from clipboard", to paste the following link') }}:</p></div>
<pre>{{ dclink}}</pre>
</div>
<div class="block"></div>
<form action="{{ url_for('deltachat_credentials') }}" method="post">
<button type="submit" class="button is-link is-fullwidth block">
<p>{{ _("Generate new credentials") }} </p>
</button>
</form>
{% endblock %}

View file

@ -4,14 +4,14 @@
<h1 class="title is-large butter-title">{{ _('Secure Messenger') }}</h1>
<div class="block">
<p> {{ _("To use secure messaging, install Delta Chat and then 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>
</button>
</a>
<div class="block"></div>
<form action="{{ url_for('deltachat_credentials') }}" method="post">
<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>
</button>

View file

@ -1,7 +1,5 @@
import pexpect
import json
from app import app
def run_madmail_installer():
with open("./settings.txt", "r") as f:
settings = json.load(f)
@ -17,7 +15,7 @@ def run_madmail_installer():
child.expect("MX record")
child.sendline(f"{butterbox_hostname}.locaL")
child.expect("Public IP address")
child.sendline(app.config['BUTTERBOX_DEFAULT_IP'])
child.sendline("127.0.0.1")
child.expect("Additional domains")
child.sendline("")
child.expect("State directory")
@ -57,7 +55,7 @@ def run_madmail_installer():
child.expect("Require PGP encryption for outgoing messages")
child.sendline("y")
child.expect("Allow secure join requests without encryption")
child.sendline("y")
child.sendline("n")
child.expect("Passthrough senders")
child.sendline("")
child.expect("Passthrough recipients")

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-03-31 12:45+0100\n"
"POT-Creation-Date: 2026-03-29 17:11+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -22,7 +22,7 @@ msgid "Please log in to access this page."
msgstr ""
#: app/forms.py:13
msgid "Only dashes, underscores, letters and numbers allowed."
msgid "Only dashes, underscores, letters and numbers allowed"
msgstr ""
#: app/forms.py:17
@ -141,45 +141,49 @@ msgstr ""
msgid "Submit"
msgstr ""
#: app/routes.py:104 app/templates/messaging.html:4
#: app/routes.py:95
msgid "Share WiFi"
msgstr ""
#: app/routes.py:97 app/templates/messaging.html:4
msgid "Secure Messenger"
msgstr ""
#: app/routes.py:106
#: app/routes.py:99
msgid "Local Chat"
msgstr ""
#: app/routes.py:108
#: app/routes.py:101
msgid "Apps"
msgstr ""
#: app/routes.py:110
#: app/routes.py:103
msgid "Maps"
msgstr ""
#: app/routes.py:112
#: app/routes.py:105
msgid "Files"
msgstr ""
#: app/routes.py:114
#: app/routes.py:107
msgid "Insert USB to browse files"
msgstr ""
#: app/routes.py:151
#: app/routes.py:144
msgid "Invalid username or password"
msgstr ""
#: app/routes.py:336
#: app/routes.py:330
msgid ""
"⚠️ Some settings may not fully take effect until the Butter Box restarts."
" Click 'Apply Changes' to restart."
msgstr ""
#: app/routes.py:340
#: app/routes.py:334
msgid "Settings successfully changed."
msgstr ""
#: app/routes.py:346
#: app/routes.py:340
msgid ""
"⚠️ Changes applied! If needed, the system will restart. This may take up "
"to two minutes."
@ -259,7 +263,7 @@ msgstr ""
msgid "Language"
msgstr ""
#: app/templates/base.html:40 app/translation_refs.py:19
#: app/translation_refs.py:19
msgid "Share Access"
msgstr ""
@ -267,17 +271,11 @@ msgstr ""
msgid "512 x 512 px. Recommended size."
msgstr ""
#: app/translation_refs.py:21
msgid ""
"Continue to your box portal. The portal is the view others will see when "
"they connect to the box hotspot."
msgstr ""
#: app/templates/admin.html:8
msgid "Application Settings"
msgstr ""
#: app/templates/admin_setup.html:6 app/templates/base.html:36
#: app/templates/admin_setup.html:6 app/templates/base.html:34
msgid "Admin Settings"
msgstr ""
@ -297,25 +295,6 @@ msgstr ""
msgid "Secure Admin Settings"
msgstr ""
#: app/templates/deltachat_creds.html:4
msgid "Secure Messenger Account"
msgstr ""
#: app/templates/deltachat_creds.html:9
msgid "Scan the following QR code with a device where DeltaChat is installed:"
msgstr ""
#: app/templates/deltachat_creds.html:14
msgid ""
"If your device does not have a camera, select \"Create new profile\" in "
"DeltaChat, choose \"Use Other Server\" and find \"Paste from clipboard\","
" to paste the following link"
msgstr ""
#: app/templates/deltachat_creds.html:21
msgid "Generate new credentials"
msgstr ""
#: app/templates/first_setup_main_page.html:6
msgid "Set up your box"
msgstr ""
@ -346,8 +325,8 @@ msgstr ""
#: app/templates/messaging.html:7
msgid ""
"To use secure messaging, install Delta Chat and then create your local "
"offline account."
"To use secure messaging, install Delta Chat and then return to this page "
"to create your local offline account."
msgstr ""
#: app/templates/messaging.html:10
@ -367,11 +346,13 @@ msgid "Create offline account"
msgstr ""
#: app/templates/setup_complete.html:4
msgid "Changes have been applied"
msgid "Changes have been applied "
msgstr ""
#: app/templates/setup_complete.html:7
msgid "The box will now reboot to apply settings. This can take up to one minute."
msgid ""
"Continue to your box portal. The portal is the view others will see when "
"they connect to the box hotspot."
msgstr ""
#: app/templates/setup_complete.html:8

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-03-31 12:45+0100\n"
"POT-Creation-Date: 2026-03-29 17:11+0100\n"
"PO-Revision-Date: 2026-03-29 17:13+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: ru\n"
@ -24,7 +24,7 @@ msgid "Please log in to access this page."
msgstr ""
#: app/forms.py:13
msgid "Only dashes, underscores, letters and numbers allowed."
msgid "Only dashes, underscores, letters and numbers allowed"
msgstr ""
#: app/forms.py:17
@ -143,45 +143,49 @@ msgstr ""
msgid "Submit"
msgstr ""
#: app/routes.py:104 app/templates/messaging.html:4
#: app/routes.py:95
msgid "Share WiFi"
msgstr ""
#: app/routes.py:97 app/templates/messaging.html:4
msgid "Secure Messenger"
msgstr ""
#: app/routes.py:106
#: app/routes.py:99
msgid "Local Chat"
msgstr ""
#: app/routes.py:108
#: app/routes.py:101
msgid "Apps"
msgstr ""
#: app/routes.py:110
#: app/routes.py:103
msgid "Maps"
msgstr ""
#: app/routes.py:112
#: app/routes.py:105
msgid "Files"
msgstr ""
#: app/routes.py:114
#: app/routes.py:107
msgid "Insert USB to browse files"
msgstr ""
#: app/routes.py:151
#: app/routes.py:144
msgid "Invalid username or password"
msgstr ""
#: app/routes.py:336
#: app/routes.py:330
msgid ""
"⚠️ Some settings may not fully take effect until the Butter Box restarts."
" Click 'Apply Changes' to restart."
msgstr ""
#: app/routes.py:340
#: app/routes.py:334
msgid "Settings successfully changed."
msgstr ""
#: app/routes.py:346
#: app/routes.py:340
msgid ""
"⚠️ Changes applied! If needed, the system will restart. This may take up "
"to two minutes."
@ -261,7 +265,7 @@ msgstr ""
msgid "Language"
msgstr ""
#: app/templates/base.html:40 app/translation_refs.py:19
#: app/translation_refs.py:19
msgid "Share Access"
msgstr ""
@ -269,17 +273,11 @@ msgstr ""
msgid "512 x 512 px. Recommended size."
msgstr ""
#: app/translation_refs.py:21
msgid ""
"Continue to your box portal. The portal is the view others will see when "
"they connect to the box hotspot."
msgstr ""
#: app/templates/admin.html:8
msgid "Application Settings"
msgstr ""
#: app/templates/admin_setup.html:6 app/templates/base.html:36
#: app/templates/admin_setup.html:6 app/templates/base.html:34
msgid "Admin Settings"
msgstr ""
@ -299,25 +297,6 @@ msgstr ""
msgid "Secure Admin Settings"
msgstr ""
#: app/templates/deltachat_creds.html:4
msgid "Secure Messenger Account"
msgstr ""
#: app/templates/deltachat_creds.html:9
msgid "Scan the following QR code with a device where DeltaChat is installed:"
msgstr ""
#: app/templates/deltachat_creds.html:14
msgid ""
"If your device does not have a camera, select \"Create new profile\" in "
"DeltaChat, choose \"Use Other Server\" and find \"Paste from clipboard\","
" to paste the following link"
msgstr ""
#: app/templates/deltachat_creds.html:21
msgid "Generate new credentials"
msgstr ""
#: app/templates/first_setup_main_page.html:6
msgid "Set up your box"
msgstr ""
@ -348,8 +327,8 @@ msgstr ""
#: app/templates/messaging.html:7
msgid ""
"To use secure messaging, install Delta Chat and then create your local "
"offline account."
"To use secure messaging, install Delta Chat and then return to this page "
"to create your local offline account."
msgstr ""
#: app/templates/messaging.html:10
@ -369,11 +348,13 @@ msgid "Create offline account"
msgstr ""
#: app/templates/setup_complete.html:4
msgid "Changes have been applied"
msgid "Changes have been applied "
msgstr ""
#: app/templates/setup_complete.html:7
msgid "The box will now reboot to apply settings. This can take up to one minute."
msgid ""
"Continue to your box portal. The portal is the view others will see when "
"they connect to the box hotspot."
msgstr ""
#: app/templates/setup_complete.html:8
@ -517,19 +498,3 @@ msgstr ""
msgid "Directory is empty"
msgstr ""
#~ msgid "Only dashes, underscores, letters and numbers allowed"
#~ msgstr ""
#~ msgid "Share WiFi"
#~ msgstr ""
#~ msgid ""
#~ "To use secure messaging, install Delta"
#~ " Chat and then return to this "
#~ "page to create your local offline "
#~ "account."
#~ msgstr ""
#~ msgid "Changes have been applied "
#~ msgstr ""