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 "]" # echo -n "["; ls | xargs -I{} echo -n \"{}\",; echo "]"
BG_IMAGES = listdir("./static/img/background") BG_IMAGES = listdir("./static/img/background")
news = """
=== 2021-03-24 ===
* TestABC
* FooBar
=== 2020-xx-xx ===
* Map now available
"""
@route("/") @route("/")
def index(): def index():
players = currentPlayerData() 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") @route("/getPlayerSkins")
def getPlayerSkins(): def getPlayerSkins():
@ -102,6 +93,10 @@ def donations():
donations = donation_file.read() donations = donation_file.read()
return donations return donations
def news():
with open("news.txt", "r") as news_file:
news = news_file.read()
CONFIG = parseConfig() CONFIG = parseConfig()
run(host="localhost", port=8080) 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