qrgen: ułatwienia customizacji

This commit is contained in:
2020-12-28 19:17:48 +01:00
parent c2f70fb149
commit e6a8d314ec
3 changed files with 9 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ app = Flask(__name__)
app.config.from_object(__name__)
class ReusableForm(Form):
url = TextField("URL:")
url = TextField("Data:")
@app.route("/", methods=["GET", "POST"])
def main():
@@ -17,9 +17,10 @@ class ReusableForm(Form):
if request.method == "POST":
target_url = request.form["url"]
else:
target_url = "http://qrgen.tau.pipebreaker.pl/"
return render_template("main.html", form=form, target_url=target_url, genurl="http://qrgen.tau.pipebreaker.pl/render/")
# not POST? get back to ourselves
target_url = request.url_root
return render_template("main.html", form=form, target_url=target_url, genurl="/render/")
if __name__ == "__main__":
app.run(host='::')