From 5125b4d5b84c99e7c6d1ede53844d82a5bb53f55 Mon Sep 17 00:00:00 2001 From: sqozz Date: Fri, 30 Apr 2021 02:21:40 +0200 Subject: [PATCH] Add news from text file --- homepage/main.py | 15 +++++---------- homepage/news.txt | 6 ++++++ 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 homepage/news.txt diff --git a/homepage/main.py b/homepage/main.py index f122040..e5488ba 100644 --- a/homepage/main.py +++ b/homepage/main.py @@ -14,19 +14,10 @@ import re # echo -n "["; ls | xargs -I{} echo -n \"{}\",; echo "]" BG_IMAGES = listdir("./static/img/background") -news = """ -=== 2021-03-24 === -* TestABC -* FooBar - -=== 2020-xx-xx === -* Map now available -""" - @route("/") def index(): players = currentPlayerData() - return template("html/index.html", **{"player_count": players["count"]["current"] , "max_players": players["count"]["max"], "news": news, "donations": donations()}) + return template("html/index.html", **{"player_count": players["count"]["current"] , "max_players": players["count"]["max"], "news": news(), "donations": donations()}) @route("/getPlayerSkins") def getPlayerSkins(): @@ -102,6 +93,10 @@ def donations(): donations = donation_file.read() return donations +def news(): + with open("news.txt", "r") as news_file: + news = news_file.read() + CONFIG = parseConfig() run(host="localhost", port=8080) diff --git a/homepage/news.txt b/homepage/news.txt new file mode 100644 index 0000000..9538d56 --- /dev/null +++ b/homepage/news.txt @@ -0,0 +1,6 @@ +=== 2021-03-24 === +* TestABC +* FooBar + +=== 2020-xx-xx === +* Map now available