geo ergänzt

This commit is contained in:
2023-11-08 21:35:40 +01:00
parent 5fda85c456
commit 64de15839e
7 changed files with 72 additions and 29 deletions

2
.idea/misc.xml generated
View File

@@ -3,7 +3,7 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.12 (Docker-Flask-QR)" /> <option name="sdkName" value="Python 3.12 (Docker-Flask-QR)" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="Python 3.12 (Docker-Flask-QR)" project-jdk-type="Python SDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="Python 3.11 FlaskQR(venv)" project-jdk-type="Python SDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

42
.idea/workspace.xml generated
View File

@@ -4,10 +4,14 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3fdfc273-527d-4717-bd6d-4ba98fba7555" name="Changes" comment="MeCard ergänzt"> <list default="true" id="3fdfc273-527d-4717-bd6d-4ba98fba7555" name="Changes" comment="geo ergänzt">
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_Raspi.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_Raspi.xml" afterDir="false" /> <change afterPath="$PROJECT_DIR$/app/templates/geo.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/runConfigurations/Dockerfile_local.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Docker-Flask-QR.iml" beforeDir="false" afterPath="$PROJECT_DIR$/Docker-Flask-QR.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Flask-QR.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Flask-QR.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/templates/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/app/templates/index.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -62,20 +66,20 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;DefaultHtmlFileTemplate&quot;: &quot;HTML File&quot;, "DefaultHtmlFileTemplate": "HTML File",
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;, "RunOnceActivity.OpenProjectViewOnStart": "true",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;, "SHARE_PROJECT_CONFIGURATION_FILES": "true",
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;, "ignore.virus.scanning.warn.message": "true",
&quot;last_opened_file_path&quot;: &quot;/home/tebarius/IdeaProjects/Docker-Flask-QR/app/templates&quot;, "last_opened_file_path": "/home/tebarius/IdeaProjects/Docker-Flask-QR/app/templates",
&quot;project.structure.last.edited&quot;: &quot;Global Libraries&quot;, "project.structure.last.edited": "SDKs",
&quot;project.structure.proportion&quot;: &quot;0.15&quot;, "project.structure.proportion": "0.15",
&quot;project.structure.side.proportion&quot;: &quot;0.2&quot;, "project.structure.side.proportion": "0.2",
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.keymap&quot; "settings.editor.selected.configurable": "preferences.keymap"
} }
}</component> }]]></component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/app/templates" /> <recent name="$PROJECT_DIR$/app/templates" />
@@ -90,7 +94,7 @@
<recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR" /> <recent name="D:\mager\Documents\IntelliJ\Docker-Flask-QR" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Docker.Dockerfile-Raspi"> <component name="RunManager" selected="Python.Flask-QR">
<configuration name="Flask-QR" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> <configuration name="Flask-QR" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="Docker-Flask-QR" /> <module name="Docker-Flask-QR" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
@@ -99,7 +103,6 @@
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="SDK_NAME" value="Python 3.12 (Docker-Flask-QR)" />
<option name="WORKING_DIRECTORY" value="" /> <option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
@@ -214,7 +217,8 @@
<MESSAGE value="VCARD integriert" /> <MESSAGE value="VCARD integriert" />
<MESSAGE value="python3.11 - Kompatibilität wieder hergestellt" /> <MESSAGE value="python3.11 - Kompatibilität wieder hergestellt" />
<MESSAGE value="MeCard ergänzt" /> <MESSAGE value="MeCard ergänzt" />
<option name="LAST_COMMIT_MESSAGE" value="MeCard ergänzt" /> <MESSAGE value="geo ergänzt" />
<option name="LAST_COMMIT_MESSAGE" value="geo ergänzt" />
</component> </component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
<expand /> <expand />

View File

@@ -5,7 +5,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.12 (Docker-Flask-QR)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.11 FlaskQR(venv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PackageRequirementsSettings"> <component name="PackageRequirementsSettings">

View File

@@ -69,7 +69,16 @@ def makeqr():
elif request.args.get('type') == "tel": elif request.args.get('type') == "tel":
data = f"tel:{request.args.get('tel')}" data = f"tel:{request.args.get('tel')}"
elif request.args.get('type') == "geo":
data = "GEO:"
if request.args.get('ns') == "S":
data += "-"
data += f"{request.args.get('nsk')},"
if request.args.get('we') == "W":
data += "-"
data += f"{request.args.get('wek')}"
if request.args.get('high') != "":
data += f",{request.args.get('high')}"
elif request.args.get('type') == "mecard": elif request.args.get('type') == "mecard":
titel = request.args.get("titel") titel = request.args.get("titel")
if titel != "": if titel != "":
@@ -92,9 +101,6 @@ def makeqr():
data += f"BDAY:{request.args.get('gebdate').replace('-','')};" data += f"BDAY:{request.args.get('gebdate').replace('-','')};"
if request.args.get('note') != "": if request.args.get('note') != "":
data += f"NOTE:{request.args.get('note')};" data += f"NOTE:{request.args.get('note')};"
elif request.args.get('type') == "vcard": elif request.args.get('type') == "vcard":
# BEGIN:VCARD # BEGIN:VCARD
# VERSION:3.0 # VERSION:3.0
@@ -153,7 +159,6 @@ def makeqr():
else: else:
data += f"BDAY:{gebdate}\n" data += f"BDAY:{gebdate}\n"
data += "END:VCARD\n" data += "END:VCARD\n"
elif request.args.get('type') == "wifi": elif request.args.get('type') == "wifi":
passw = (request.args.get("passw").replace("\\", "\\\\").replace(";", "\\;") passw = (request.args.get("passw").replace("\\", "\\\\").replace(";", "\\;")
.replace(",", "\\,").replace(":", "\\:").replace("\"", "\\\"")) .replace(",", "\\,").replace(":", "\\:").replace("\"", "\\\""))
@@ -190,7 +195,6 @@ def makeqr():
f"LOCATION:{request.args.get('location')}\n" f"LOCATION:{request.args.get('location')}\n"
f"DTSTART:{sdt}\nDTEND:{edt}\n" f"DTSTART:{sdt}\nDTEND:{edt}\n"
f"END:VEVENT") f"END:VEVENT")
elif request.args.get('type') == "mail": elif request.args.get('type') == "mail":
more = False more = False
data = f"mailto:{request.args.get('mail')}" data = f"mailto:{request.args.get('mail')}"

35
app/templates/geo.html Normal file
View File

@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block inhalt %}
<form action="qr.html">
<label>Bitte Koordinaten angeben<br />(Dezimale Gradangabe - Bsp. 51.2332)</label><br>
<input type="hidden" name="type" value="geo">
<label>
<input name="ns" type="radio" value="N" required>
</label>N
<label>
<input name="ns" type="radio" value="S" required>
</label>
<label>
<input type="text" name="nsk" id="nsk" size="15" maxlength="20" inputmode="numeric" pattern="[0-9\.]+" required>
<br /><br />
</label>
<label>
<input name="we" type="radio" value="W" required>
</label>W
<label>
<input name="we" type="radio" value="W" required>
</label>S
<label>
<input type="text" name="wek" id="wek" size="15" maxlength="20" inputmode="numeric" pattern="[0-9\.]+" required>
<br /><br />
</label>
<label>
Höhe (in m):
<input type="number" name="high" size="5" maxlength="10"><br />
</label>
<br />
<button type="reset">Eingaben zur&uuml;cksetzen</button>
<button type="submit">Eingaben absenden</button>
</form>
{% endblock %}

View File

@@ -6,10 +6,10 @@
<div><button><a href="./text.html">einfacher Text </a></button></div> <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="./url.html">URL/Website-Link</a></button></div>
<div><button><a href="./tel.html">Telefonnummer</a></button></div> <div><button><a href="./tel.html">Telefonnummer</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="./mail.html">EMail-Adresse</a></button></div>
<div><button><a href="./wifi.html">WIFI</a></button></div> <div><button><a href="./wifi.html">WIFI</a></button></div>
<div><button><a href="./cal.html">Kalender-Termin</a></button></div> <div><button><a href="./cal.html">Kalender-Termin</a></button></div>
<div><button><a href="./vcard.html">Visitenkarte (vCard)</a></button></div> <div><button><a href="./vcard.html">Visitenkarte (vCard)</a></button></div>
<div><button><a href="./mecard.html">Visitenkarte (MeCard)</a></button></div> <div><button><a href="./mecard.html">Visitenkarte (MeCard)</a></button></div>
<div><button><a href="./geo.html">geographische Koordinaten</a></button></div>
{% endblock %} {% endblock %}

View File

@@ -6,6 +6,6 @@ Dieses Programm benötigt Python und das Flask-Framework um einen kleinen Server
... installiert alles Notwendige ... installiert alles Notwendige
## Docker ## Docker
2 unterschiedliche Dockerfile's, da obwohl bei beiden python:slim als Basis genutzt wird, Es gibt 2 unterschiedliche Dockerfile's, da obwohl bei beiden python:slim als Basis genutzt wird,
noch die Installation von ein paar packages zusätzlich notwendig ist, damit flask auch auf noch die Installation von ein paar packages zusätzlich notwendig ist, damit flask auch auf
dem RaspberryPi 3 via pip install integriert werden kann dem RaspberryPi 3 via pip install integriert werden kann