Ajout de l'etat

This commit is contained in:
guimoz 2017-01-30 00:05:29 +01:00
parent e9c244aa37
commit 77bf9f3147
3 changed files with 12 additions and 5 deletions

View file

@ -16,6 +16,7 @@ DEBUG = True
SECRET_KEY = "\xf3'\xd2\xf7\xa4[.h\x8e\x11|\xda\x00\x9fyS\xfe\xb3(!\x91'6\x16" SECRET_KEY = "\xf3'\xd2\xf7\xa4[.h\x8e\x11|\xda\x00\x9fyS\xfe\xb3(!\x91'6\x16"
USERNAME = 'admin' USERNAME = 'admin'
PASSWORD = 'pipo' PASSWORD = 'pipo'
ASSHOLES = []
SQLITE_FILENAME = '/var/roulette/players.db' SQLITE_FILENAME = '/var/roulette/players.db'
SQLITE_SCHEMA = 'schema.sql' SQLITE_SCHEMA = 'schema.sql'
@ -31,7 +32,7 @@ IMMUNITY_FILE = '/var/roulette/immunity'
ASSHOLES_FILE = '/var/roulette/assholes' ASSHOLES_FILE = '/var/roulette/assholes'
STATE_FILE = '/var/roulette/state' STATE_FILE = '/var/roulette/state'
STATE = 'precampagne' STATE = 'down'
app = Flask(__name__) app = Flask(__name__)
app.config.from_object(__name__) app.config.from_object(__name__)
@ -305,7 +306,11 @@ def banned():
def banned_ip(): def banned_ip():
#Actualisation de l'etat de la roulette #Actualisation de l'etat de la roulette
with open(STATE_FILE, 'r') as f: with open(STATE_FILE, 'r') as f:
global STATE
STATE = f.read() STATE = f.read()
if DEBUG :
print(STATE)
# Liste des ip pour récupération par babel et plop # Liste des ip pour récupération par babel et plop
if not DEBUG: if not DEBUG:
if get_ip() not in ['10.7.0.254']: if get_ip() not in ['10.7.0.254']:
@ -327,9 +332,11 @@ def banned_ip():
@playable_required @playable_required
def home(): def home():
player = get_player_from_ip(get_ip()) player = get_player_from_ip(get_ip())
if STATE == "down": if DEBUG:
print(STATE)
if "down" in STATE:
return render_template('down.html', user=player) return render_template('down.html', user=player)
elif STATE == "launched": elif "up" in STATE:
if DEBUG: if DEBUG:
print(player, 'arrived') print(player, 'arrived')

1
state Normal file
View file

@ -0,0 +1 @@
precampagne

View file

@ -2,7 +2,6 @@
{% block content %} {% block content %}
<h2>Pas de précampagne!</h2> <h2>Pas de précampagne!</h2>
<p> <p>
Reviens bientôt {{ user['firstname']+' '+user['name'] }} pour jouer à la rezo-roulette Reviens plus tard {{ user['firstname']+' '+user['name'] }} pour jouer à la rezo-roulette
</p> </p>
{% endif %}
{% endblock %} {% endblock %}