diff --git a/.idea/runConfigurations/Dockerfile_Raspi.xml b/.idea/runConfigurations/Dockerfile_Raspi.xml new file mode 100644 index 0000000..0e8fa78 --- /dev/null +++ b/.idea/runConfigurations/Dockerfile_Raspi.xml @@ -0,0 +1,20 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4620587..7e2bba4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,18 +4,23 @@ + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f41cb70..c712de4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM python:slim LABEL authors="tebarius" -LABEL version="1.0" -LABEL description="Simple QR-Code-Generator-Server" +LABEL version="1.1" +LABEL description="QR-Code-Generator-Server with Flask-App" WORKDIR /app COPY ./app /app/ diff --git a/Dockerfile-RasPi b/Dockerfile-RasPi index e3b7d86..f1c64a9 100644 --- a/Dockerfile-RasPi +++ b/Dockerfile-RasPi @@ -1,8 +1,8 @@ FROM python:slim LABEL authors="tebarius" -LABEL version="1.0" -LABEL description="Simple QR-Code-Generator-Server" +LABEL version="1.1" +LABEL description="QR-Code-Generator-Server with Flask-App" WORKDIR /app COPY ./app /app/ diff --git a/Flask-QR.zip b/Flask-QR.zip deleted file mode 100644 index 963a75d..0000000 Binary files a/Flask-QR.zip and /dev/null differ diff --git a/app/Flask-QR.py b/app/Flask-QR.py index 76229ef..6b0e97e 100644 --- a/app/Flask-QR.py +++ b/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: + # DESCRIPTION: + # LOCATION: + # 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) diff --git a/app/static/style.css b/app/static/style.css new file mode 100644 index 0000000..2447cc2 --- /dev/null +++ b/app/static/style.css @@ -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); + } diff --git a/app/templates/base.html b/app/templates/base.html new file mode 100644 index 0000000..7c4b9be --- /dev/null +++ b/app/templates/base.html @@ -0,0 +1,14 @@ + + + + QR-Code-Generator + + + + + +

QRCode-Generator

+ {% block inhalt %} + {% endblock %} + + diff --git a/app/templates/cal.html b/app/templates/cal.html new file mode 100644 index 0000000..0ac21d2 --- /dev/null +++ b/app/templates/cal.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} + +{% block inhalt %} +
+
+ + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+ +{% endblock %} diff --git a/app/templates/index.html b/app/templates/index.html index 6211232..65d5f3c 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,23 +1,14 @@ - - - - QR-Code-Generator - - -

QRCode-Generator

-

+{% extends "base.html" %} -

-
-
- -

- - -
- - - - - - +{% block inhalt %} +

+ Welche Art von QR-Code soll generiert werden?
+

+
+
+ + +
+ +
+{% endblock %} diff --git a/app/templates/mail.html b/app/templates/mail.html new file mode 100644 index 0000000..9167cea --- /dev/null +++ b/app/templates/mail.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} + +{% block inhalt %} +
+
+ + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+ +{% endblock %} diff --git a/app/templates/qr.html b/app/templates/qr.html index 09784b9..0d808e6 100644 --- a/app/templates/qr.html +++ b/app/templates/qr.html @@ -1,20 +1,15 @@ - - - - QR-Code-Generator - - -

QRCode-Generator

-

- folgender Text wurde im QR-Code codiert:
+{% extends "base.html" %} + +{% block inhalt %} +

+ folgendes wurde im QR-Code codiert:
{{ data }}

- QR-Code für {{ data }} + QR-Code für {{ data }}

-

+

Noch einmal bitte!

+{% endblock %} - - diff --git a/app/templates/tel.html b/app/templates/tel.html new file mode 100644 index 0000000..41e3737 --- /dev/null +++ b/app/templates/tel.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block inhalt %} +
+
+ + +

+ + +
+{% endblock %} diff --git a/app/templates/text.html b/app/templates/text.html new file mode 100644 index 0000000..e4db86d --- /dev/null +++ b/app/templates/text.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block inhalt %} +
+
+ + +

+ + +
+{% endblock %} diff --git a/app/templates/url.html b/app/templates/url.html new file mode 100644 index 0000000..5e44cc9 --- /dev/null +++ b/app/templates/url.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} + +{% block inhalt %} +
+
+ + + +
+
+ + +
+ +{% endblock %} diff --git a/app/templates/wifi.html b/app/templates/wifi.html new file mode 100644 index 0000000..06e84af --- /dev/null +++ b/app/templates/wifi.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} + +{% block inhalt %} +
+
+ + + +
+ + + + + + + + +
+ + +
+ +{% endblock %}