make QR code clickable, verified it works on android and desktop

This commit is contained in:
holger krekel
2023-12-02 00:18:54 +01:00
parent b8cf5da37f
commit ab2cc5a687
2 changed files with 26 additions and 14 deletions

View File

@@ -156,7 +156,8 @@ def _install_mta_sts_daemon() -> bool:
name="install postfix-mta-sts-resolver with pip", name="install postfix-mta-sts-resolver with pip",
commands=[ commands=[
"python3 -m venv /usr/local/lib/postfix-mta-sts-resolver", "python3 -m venv /usr/local/lib/postfix-mta-sts-resolver",
"/usr/local/lib/postfix-mta-sts-resolver/bin/pip install postfix-mta-sts-resolver", "/usr/local/lib/postfix-mta-sts-resolver/bin/pip "
"install postfix-mta-sts-resolver",
], ],
) )
@@ -294,18 +295,20 @@ def _configure_nginx(domain: str, debug: bool = False) -> bool:
) )
files.put( files.put(
name=f"Upload cgi newemail.py script", name="Upload cgi newemail.py script",
src=importlib.resources.files("chatmaild").joinpath(f"newemail.py").open("rb"), src=importlib.resources.files("chatmaild").joinpath("newemail.py").open("rb"),
dest=f"{cgi_dir}/newemail.py", dest=f"{cgi_dir}/newemail.py",
user="root", user="root",
group="root", group="root",
mode="755", mode="755",
) )
qr_data = gen_qr_png_data(domain)
files.put( files.put(
name=f"Upload QR code for account creation", name="Upload QR code for account creation",
src=gen_qr_png_data(domain), src=qr_data,
dest=f"/var/www/html/qrcode.png", dest="/var/www/html/qrcode.png",
user="root", user="root",
group="root", group="root",
mode="644", mode="644",
@@ -376,10 +379,17 @@ def deploy_chatmail(mail_domain: str, mail_server: str, dkim_selector: str) -> N
# deploy web pages and info if we have them # deploy web pages and info if we have them
pkg_root = importlib.resources.files(__package__) pkg_root = importlib.resources.files(__package__)
www_path = pkg_root.joinpath(f"../../../www/{mail_domain}").resolve() www_path = pkg_root.joinpath(f"../../../www/{mail_domain}").resolve()
if not www_path.is_dir(): if www_path.is_dir():
www_path = pkg_root.joinpath(f"../../../www/default").resolve() files.rsync(f"{www_path}/", "/var/www/html", flags=["-avz"])
else:
files.rsync(f"{www_path}/", "/var/www/html", flags=["-avz"]) files.template(
src=importlib.resources.files(__package__).joinpath("nginx/index.html.j2"),
dest="/var/www/html/index.html",
user="root",
group="root",
mode="644",
config={"mail_domain": mail_domain},
)
systemd.service( systemd.service(
name="Start and enable OpenDKIM", name="Start and enable OpenDKIM",

View File

@@ -1,3 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@@ -6,10 +7,11 @@
</style> </style>
</head> </head>
<body> <body>
<h1>Welcome to Chatmail!</h1> <h1>Welcome to {{ config.mail_domain }}!</h1>
<h2>Scan this invite QR code from any Delta Chat app</h2> <h2>Tap or Scan this invite code to setup an account for Delta Chat app</h2>
<img class="section" src="qrcode.png" /> <a href="DCACCOUNT:https://{{ config.mail_domain }}/cgi-bin/newemail.py">
<img class="section" src="qrcode.png" />
</a>
<h2>Properties / Constraints</h2> <h2>Properties / Constraints</h2>
<ul> <ul>
<li>Un-encrypted mails can not leave the chat-mail domain.</li> <li>Un-encrypted mails can not leave the chat-mail domain.</li>