diff --git a/Dockerfile b/Dockerfile index 1e8a9f6..96fc7ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM alpine:latest WORKDIR /opt/ -ENV GIT_URL=https://git.adrianux.net -ENV WEBSITE_URL=https://adrianux.net ENV DEBUG_MODE=False COPY . . diff --git a/app.py b/app.py index 99b6757..e6f86b0 100755 --- a/app.py +++ b/app.py @@ -10,43 +10,15 @@ app = Flask(__name__) @app.route("/imprint") def root(): - return render_template("imprint.html") + return render_template("imprint.j2") @app.route("/about") def about(): - return render_template("about.html") + return render_template("about.j2") @app.route("/") def homepage(): - return render_template("homepage.html") - -@app.route("/monitoring") -def monitoring(): - global git_status - global website_status - executor = ThreadPoolExecutor(2) - executor.submit(monitor) - return render_template("monitoring.html", git_status = git_status, website_status = website_status) - - -def get_status(link): - requested_site = requests.get(link) - status_code = requested_site.status_code - try: - match status_code: - case 200: - return "ONLINE" - case _: - return "ERROR" - except: - return "OFFLINE" - -def monitor(): - while True: - git_status = get_status(os.environ['GIT_URL']) - website_status = get_status(os.environ['WEBSITE_URL']) - time.sleep(5) - + return render_template("homepage.j2") if __name__ == "__main__": diff --git a/templates/about.html b/templates/about.j2 similarity index 97% rename from templates/about.html rename to templates/about.j2 index 92bb7fe..0da40b0 100644 --- a/templates/about.html +++ b/templates/about.j2 @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base.j2" %} {% block title %}About{% endblock %} {% block head %} {{ super() }} diff --git a/templates/base.html b/templates/base.j2 similarity index 100% rename from templates/base.html rename to templates/base.j2 diff --git a/templates/homepage.html b/templates/homepage.j2 similarity index 91% rename from templates/homepage.html rename to templates/homepage.j2 index 72ce93c..493b71c 100644 --- a/templates/homepage.html +++ b/templates/homepage.j2 @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base.j2" %} {% block title %}Homepage{% endblock %} {% block head %} {{ super() }} diff --git a/templates/imprint.html b/templates/imprint.j2 similarity index 91% rename from templates/imprint.html rename to templates/imprint.j2 index 59c6e38..bdd4d3b 100644 --- a/templates/imprint.html +++ b/templates/imprint.j2 @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base.js" %} {% block title %}Imprint{% endblock %} {% block head %} {{ super() }} diff --git a/templates/monitoring.html b/templates/monitoring.html deleted file mode 100644 index c41ec0b..0000000 --- a/templates/monitoring.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "base.html" %} -{% block title %}Monitoring{% endblock %} -{% block head %} - {{ super() }} -{% endblock %} -{% block content %} -
Git status: {{ git_status }}
-Website status: {{ website_status }}
-{% endblock %}