From c0497a4941bf69b06828e0219d7ff077a15b7426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Vyb=C3=ADhal?= Date: Thu, 5 Jan 2023 14:14:35 +0100 Subject: [PATCH] zkracovac --- data.db | Bin 20480 -> 20480 bytes static/styles.css | 8 +++++++- templates/base.html | 1 + templates/zkracovac.html | 15 +++++++++++++++ webface.py | 16 ++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 templates/zkracovac.html diff --git a/data.db b/data.db index 5be4c1d505c72bbff33592bc1c427b1446960a1c..39be85425491ea75b5df1520b2febb583c8fedb5 100644 GIT binary patch delta 266 zcmZozz}T>Wae}lU4+8@OD-go~$3z`tQ62_8?}@zpISed(8yWcL@|W;!~hPzJ0Dn?z}GYSH9}{9-mRy_#H_+H7p%_L7VYnRzLx y6~%=)nI)<5iKQj^V17Kr!gxan%?$Jv$K(S332eL|{|NxS@Qa^~3&CDwpa1}sMMdxc delta 97 zcmZozz}T>Wae}lUHvjQ{`u diff --git a/static/styles.css b/static/styles.css index 041575d..d568b7f 100644 --- a/static/styles.css +++ b/static/styles.css @@ -76,7 +76,13 @@ footer { color: black; } - +.url{ + font-size: 150%; +} +.url input{ + width: 80%; + font-size: 170%; +} /*# sourceMappingURL=styles.css.map */ diff --git a/templates/base.html b/templates/base.html index 4797bac..a8a7a78 100644 --- a/templates/base.html +++ b/templates/base.html @@ -39,6 +39,7 @@
  • Info
  • ABC
  • Malina
  • +
  • Zkracovač
  • Login
  • logout
  • registrace
  • diff --git a/templates/zkracovac.html b/templates/zkracovac.html new file mode 100644 index 0000000..5c26bc5 --- /dev/null +++ b/templates/zkracovac.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %} + +{%block title%}Zkracovač{%endblock%} + +{% block obsah %} + +

    Zkracovač URL

    + +
    +

    + Zadej URL: + + +

    +{% endblock obsah %} \ No newline at end of file diff --git a/webface.py b/webface.py index b5aecde..a23d50c 100644 --- a/webface.py +++ b/webface.py @@ -4,6 +4,8 @@ from mysqlite import SQLite from werkzeug.security import generate_password_hash, check_password_hash import sqlite3 +import random +import string app = Flask(__name__) app.secret_key = b"totoj e zceLa n@@@hodny retezec nejlep os.urandom(24)" @@ -30,6 +32,20 @@ def wrapper(*args, **kwargs): def index(): return render_template("base.html") +@app.route("/zkracovac/") +def zkracovac(): + return render_template("zkracovac.html") + +@app.route("/zkracovac/", methods=["POST"]) +def zkracovac_post(): + url = request.form.get("url") + zkratka = "".join(random.choices(string.ascii_uppercase +string.digits, k=5)) + with SQLite("data.db") as cur: + cur.execute( " INSERT INTO adresy (zkratka,adresa) VALUES (?,?) ", [zkratka,url] ) + + return redirect(url_for("zkracovac")) + + @app.route("/info/") def info():