Add news from text file

This commit is contained in:
sqozz 2021-04-30 02:21:40 +02:00
parent 5a2ebb7339
commit 5125b4d5b8
2 changed files with 11 additions and 10 deletions

View File

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

6
homepage/news.txt Normal file
View File

@ -0,0 +1,6 @@
=== 2021-03-24 ===
* TestABC
* FooBar
=== 2020-xx-xx ===
* Map now available