mirror of
https://github.com/tebarius/Docker-Flask-QR.git
synced 2025-12-20 22:23:30 +01:00
css,mail,tel,url,calendar fertig
This commit is contained in:
115
app/Flask-QR.py
115
app/Flask-QR.py
@@ -13,11 +13,122 @@ def index():
|
||||
return render_template('index.html')
|
||||
|
||||
|
||||
@app.route("/text.html")
|
||||
def text():
|
||||
return render_template('text.html')
|
||||
|
||||
|
||||
@app.route("/tel.html")
|
||||
def tel():
|
||||
return render_template('tel.html')
|
||||
|
||||
|
||||
@app.route("/url.html")
|
||||
def url():
|
||||
return render_template('url.html')
|
||||
|
||||
|
||||
@app.route("/vcard.html")
|
||||
def vcard():
|
||||
return render_template('vcard.html')
|
||||
|
||||
|
||||
@app.route("/geo.html")
|
||||
def geo():
|
||||
return render_template('geo.html')
|
||||
|
||||
|
||||
@app.route("/mail.html")
|
||||
def mail():
|
||||
return render_template('mail.html')
|
||||
|
||||
|
||||
@app.route("/wifi.html")
|
||||
def wifi():
|
||||
return render_template('wifi.html')
|
||||
|
||||
|
||||
@app.route("/cal.html")
|
||||
def cal():
|
||||
return render_template('cal.html')
|
||||
|
||||
|
||||
@app.route("/qr.html")
|
||||
def makeqr():
|
||||
data = request.args.get('qr')
|
||||
data = ""
|
||||
if request.args.get('type') == "text":
|
||||
data = request.args.get('text')
|
||||
|
||||
elif request.args.get('type') == "url":
|
||||
data = request.args.get('url')
|
||||
|
||||
elif request.args.get('type') == "tel":
|
||||
data = f"tel:{request.args.get('tel')}"
|
||||
|
||||
elif request.args.get('type') == "vcard":
|
||||
pass
|
||||
|
||||
elif request.args.get('type') == "geo":
|
||||
pass
|
||||
|
||||
elif request.args.get('type') == "wifi":
|
||||
pass
|
||||
|
||||
elif request.args.get('type') == "cal":
|
||||
# Format für Calendar (Zeilenumbrüche beachten!!):
|
||||
# BEGIN:VEVENT
|
||||
# SUMMARY:<titel>
|
||||
# DESCRIPTION:<beschreibung>
|
||||
# LOCATION:<Ort>
|
||||
# DTSTART:20231114T090000
|
||||
# DTEND:20231123T110000
|
||||
# END:VEVENT
|
||||
sdt = request.args.get('sdate').replace('-', '')
|
||||
if request.args.get('edate') == "":
|
||||
edt = sdt
|
||||
else:
|
||||
edt = request.args.get('edate').replace('-', '')
|
||||
if request.args.get('stime') != "":
|
||||
sdt += f"T{request.args.get('stime').replace(':', '')}00"
|
||||
if request.args.get('etime') != "":
|
||||
edt += f"T{request.args.get('etime').replace(':', '')}00"
|
||||
data = (f"BEGIN:VEVENT\nSUMMARY:{request.args.get('title')}\n"
|
||||
f"DESCRIPTION: {request.args.get('description')}\n"
|
||||
f"LOCATION:{request.args.get('location')}\n"
|
||||
f"DTSTART:{sdt}\nDTEND:{edt}\n"
|
||||
f"END:VEVENT")
|
||||
|
||||
elif request.args.get('type') == "mail":
|
||||
more = False
|
||||
data = f"mailto:{request.args.get('mail')}"
|
||||
if request.args.get('cc') != "":
|
||||
data += f"?cc={request.args.get('cc')}"
|
||||
more = True
|
||||
if request.args.get('bcc') != "":
|
||||
if more:
|
||||
data += "&"
|
||||
else:
|
||||
data += "?"
|
||||
more = True
|
||||
data += f"bcc={request.args.get('bcc')}"
|
||||
if request.args.get('subject') != "":
|
||||
if more:
|
||||
data += "&"
|
||||
else:
|
||||
data += "?"
|
||||
more = True
|
||||
data += f"subject={request.args.get('subject')}"
|
||||
if request.args.get('body') != "":
|
||||
if more:
|
||||
data += "&"
|
||||
else:
|
||||
data += "?"
|
||||
data += f"body={request.args.get('body')}"
|
||||
|
||||
else:
|
||||
data = "Sorry kein Inhalt!!!"
|
||||
return render_template('qr.html', data=data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host='0.0.0.0', port=80)
|
||||
app.run(host='0.0.0.0', port=80, debug=True)
|
||||
|
||||
28
app/static/style.css
Normal file
28
app/static/style.css
Normal file
@@ -0,0 +1,28 @@
|
||||
H1 {
|
||||
text-align: center;
|
||||
background-color: #eee;
|
||||
border-radius: 60px;
|
||||
filter: drop-shadow(10px 10px 20px blue);
|
||||
font-size: 70px;
|
||||
}
|
||||
p {
|
||||
text-align: center;
|
||||
font-size: 50px;
|
||||
}
|
||||
div {
|
||||
text-align: center;
|
||||
font-size: 50px;
|
||||
}
|
||||
form {
|
||||
text-align: center;
|
||||
font-size: 50px;
|
||||
}
|
||||
input { font-size: 30px;
|
||||
}
|
||||
button {
|
||||
border: solid gainsboro;
|
||||
font-size: 30px;
|
||||
margin: 15px;
|
||||
border-radius: 50px;
|
||||
filter: drop-shadow(10px 10px 10px blue);
|
||||
}
|
||||
14
app/templates/base.html
Normal file
14
app/templates/base.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>QR-Code-Generator</title>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<H1>QRCode-Generator</H1>
|
||||
{% block inhalt %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
30
app/templates/cal.html
Normal file
30
app/templates/cal.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block inhalt %}
|
||||
<form action="qr.html">
|
||||
<label>Gib bitte Details für deinen Termin ein!</label><br />
|
||||
<input type="hidden" name="type" value="cal">
|
||||
|
||||
<label for="title">Titel:</label>
|
||||
<input type="text" name="title" id="title" size="30" maxlength="60" required><br />
|
||||
<label for="sdate">Start-Datum</label>
|
||||
<input type="date" name="sdate" id="sdate" required><br />
|
||||
<br />
|
||||
<label><i><u>optionale Angaben:</u></i></label><br />
|
||||
<label for="stime">Start-Zeit</label>
|
||||
<input type="time" name="stime" id="stime"><br />
|
||||
<label for="edate">End-Datum</label>
|
||||
<input type="date" name="edate" id="edate"><br />
|
||||
<label for="etime">End-Zeit</label>
|
||||
<input type="time" name="etime" id="etime"><br />
|
||||
<label for="location">Ort:</label>
|
||||
<input type="text" name="location" id="location" size="30" maxlength="120"><br />
|
||||
<label for="description">weitere Notizen:</label>
|
||||
<input type="text" name="description" id="description" size="30" maxlength="180"><br />
|
||||
|
||||
<br />
|
||||
<button type="reset">Eingaben zurücksetzen</button>
|
||||
<button type="submit">Eingaben absenden</button>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,23 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>QR-Code-Generator</title>
|
||||
</head>
|
||||
<body>
|
||||
<H1 style="text-align: center; background-color: #eee; border-radius: .5em;">QRCode-Generator</H1>
|
||||
<p style="text-align: center;">
|
||||
{% extends "base.html" %}
|
||||
|
||||
</p>
|
||||
<form action="qr.html" style="text-align: center">
|
||||
<label for="qr" style="font-size: 2em;">Was soll im QR-Code stehen?</label><br>
|
||||
<input type="text" name="qr" id="qr" size="60" maxlength="120">
|
||||
<br><br>
|
||||
<button type="reset">Eingaben zurücksetzen</button>
|
||||
<button type="submit">Eingaben absenden</button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
{% block inhalt %}
|
||||
<p>
|
||||
<b>Welche Art von QR-Code soll generiert werden?</b><br>
|
||||
<div><button><a href="./text.html">einfacher Text </a></button></div>
|
||||
<div><button><a href="./url.html">URL/Website-Link</a></button></div>
|
||||
<div><button><a href="./tel.html">Telefonnummer</a></button></div>
|
||||
<!--<div><button><a href="./vcard.html">Visitenkarte (vCard)</a></button></div>-->
|
||||
<!--<div><button><a href="./geo.html">geographische Koordinaten</a></button></div>-->
|
||||
<div><button><a href="./mail.html">EMail-Adresse</a></button></div>
|
||||
<!--<div><button><a href="./wifi.html">WIFI</a></button></div>-->
|
||||
<div><button><a href="./cal.html">Kalender-Termin</a></button></div>
|
||||
{% endblock %}
|
||||
|
||||
24
app/templates/mail.html
Normal file
24
app/templates/mail.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block inhalt %}
|
||||
<form action="qr.html">
|
||||
<label>Wie lautet die EMail-Adresse?</label><br />
|
||||
<input type="hidden" name="type" value="mail">
|
||||
|
||||
<label for="mail">EMail:</label>
|
||||
<input type="email" name="mail" id="mail" size="30" maxlength="60" required><br />
|
||||
<label><i>optionale Angaben:</i></label><br />
|
||||
<label for="subject">Betreff:</label>
|
||||
<input type="text" name="subject" id="subject" size="30" maxlength="120"><br />
|
||||
<label for="cc">CC:</label>
|
||||
<input type="email" name="cc" id="cc" size="30" maxlength="60"><br />
|
||||
<label for="bcc">BCC:</label>
|
||||
<input type="email" name="bcc" id="bcc" size="30" maxlength="60"><br />
|
||||
<label for="body">Body / Text:</label>
|
||||
<input type="text" name="body" id="body" size="30" maxlength="180"><br />
|
||||
<br />
|
||||
<button type="reset">Eingaben zurücksetzen</button>
|
||||
<button type="submit">Eingaben absenden</button>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,20 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>QR-Code-Generator</title>
|
||||
</head>
|
||||
<body>
|
||||
<H1 style="text-align: center; background-color: #eee; border-radius: .5em;">QRCode-Generator</H1>
|
||||
<p style="text-align: center; font-size: 2em;">
|
||||
<b>folgender Text wurde im QR-Code codiert:</b><br>
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block inhalt %}
|
||||
<p>
|
||||
<b>folgendes wurde im QR-Code codiert:</b><br>
|
||||
{{ data }} <br>
|
||||
<br>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<img src="{{ data|qrcode }}" alt="QR-Code für {{ data }}">
|
||||
<img src="{{ data|qrcode(fit=True, box_size=15, border=2, ) }}" alt="QR-Code für {{ data }}">
|
||||
</p>
|
||||
<p style="text-align: center; font-size: 1.5em;">
|
||||
<p>
|
||||
<a href="./">Noch einmal bitte!</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
12
app/templates/tel.html
Normal file
12
app/templates/tel.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block inhalt %}
|
||||
<form action="qr.html">
|
||||
<label for="tel">Bitte Telefonnummer eingeben:</label><br>
|
||||
<input type="hidden" name="type" value="tel" required>
|
||||
<input type="tel" name="tel" id="tel" size="30" maxlength="30">
|
||||
<br><br>
|
||||
<button type="reset">Eingaben zurücksetzen</button>
|
||||
<button type="submit">Eingaben absenden</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
12
app/templates/text.html
Normal file
12
app/templates/text.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block inhalt %}
|
||||
<form action="qr.html">
|
||||
<label for="text">Was soll im QR-Code stehen?</label><br>
|
||||
<input type="hidden" name="type" value="text">
|
||||
<input type="text" name="text" id="text" size="30" maxlength="120" required>
|
||||
<br><br>
|
||||
<button type="reset">Eingaben zurücksetzen</button>
|
||||
<button type="submit">Eingaben absenden</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
15
app/templates/url.html
Normal file
15
app/templates/url.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block inhalt %}
|
||||
<form action="qr.html">
|
||||
<label>Wie lautet die URL / Webadresse?<br>(inkl. http...)</label><br />
|
||||
<input type="hidden" name="type" value="url">
|
||||
|
||||
<label for="url">URL:</label>
|
||||
<input type="url" name="url" id="url" size="30" maxlength="120" required><br />
|
||||
<br />
|
||||
<button type="reset">Eingaben zurücksetzen</button>
|
||||
<button type="submit">Eingaben absenden</button>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
23
app/templates/wifi.html
Normal file
23
app/templates/wifi.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block inhalt %}
|
||||
<form action="qr.html">
|
||||
<label>Gib bitte Details zum WIFI ein!</label><br />
|
||||
<input type="hidden" name="type" value="wifi">
|
||||
|
||||
<label for="ssid">SSID:</label>
|
||||
<input type="text" name="ssid" id="ssid" size="30" maxlength="60" required><br />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
<button type="reset">Eingaben zurücksetzen</button>
|
||||
<button type="submit">Eingaben absenden</button>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user