2021-05-18 19:15:49 +02:00
|
|
|
from autoreply_editor import app
|
2021-05-18 19:32:59 +02:00
|
|
|
from flask import Flask, request, render_template, redirect
|
2021-05-19 09:17:41 +02:00
|
|
|
from flask_basicauth import BasicAuth
|
|
|
|
|
|
|
|
|
|
basic_auth = BasicAuth(app)
|
2021-05-18 19:15:49 +02:00
|
|
|
|
|
|
|
|
@app.route("/")
|
|
|
|
|
def index():
|
|
|
|
|
with open(app.config.get("MESSAGE_FILE"), "r") as f:
|
2021-05-18 19:32:59 +02:00
|
|
|
message = f.read()
|
2021-05-18 19:15:49 +02:00
|
|
|
|
2021-05-18 19:32:59 +02:00
|
|
|
return render_template("index.html", message=message)
|
|
|
|
|
|
|
|
|
|
@app.route('/', methods=['POST'])
|
|
|
|
|
def index_post():
|
2021-05-18 19:53:31 +02:00
|
|
|
input_message = request.form['message']
|
|
|
|
|
|
2021-05-18 19:32:59 +02:00
|
|
|
if request.method == 'POST':
|
|
|
|
|
with open(app.config.get("MESSAGE_FILE"), 'w') as f:
|
|
|
|
|
f.write(str(input_message))
|
|
|
|
|
return redirect("/")
|