Add news from text file
This commit is contained in:
parent
5a2ebb7339
commit
5125b4d5b8
|
@ -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
6
homepage/news.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
=== 2021-03-24 ===
|
||||||
|
* TestABC
|
||||||
|
* FooBar
|
||||||
|
|
||||||
|
=== 2020-xx-xx ===
|
||||||
|
* Map now available
|
Loading…
Reference in a new issue