remove: monitoring(replaced by statping-ng); fix: template naming

This commit is contained in:
ahoemann 2025-03-14 17:19:35 +01:00
parent 053b573758
commit 341b725d5f
7 changed files with 6 additions and 45 deletions

View file

@ -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 . .

34
app.py
View file

@ -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__":

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base.j2" %}
{% block title %}About{% endblock %}
{% block head %}
{{ super() }}

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base.j2" %}
{% block title %}Homepage{% endblock %}
{% block head %}
{{ super() }}

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base.js" %}
{% block title %}Imprint{% endblock %}
{% block head %}
{{ super() }}

View file

@ -1,9 +0,0 @@
{% extends "base.html" %}
{% block title %}Monitoring{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
<p>Git status: {{ git_status }}</p>
<p>Website status: {{ website_status }}</p>
{% endblock %}