Ajout de l'etat
This commit is contained in:
parent
e9c244aa37
commit
77bf9f3147
3 changed files with 12 additions and 5 deletions
13
roulette.py
13
roulette.py
|
@ -16,6 +16,7 @@ DEBUG = True
|
|||
SECRET_KEY = "\xf3'\xd2\xf7\xa4[.h\x8e\x11|\xda\x00\x9fyS\xfe\xb3(!\x91'6\x16"
|
||||
USERNAME = 'admin'
|
||||
PASSWORD = 'pipo'
|
||||
ASSHOLES = []
|
||||
|
||||
SQLITE_FILENAME = '/var/roulette/players.db'
|
||||
SQLITE_SCHEMA = 'schema.sql'
|
||||
|
@ -31,7 +32,7 @@ IMMUNITY_FILE = '/var/roulette/immunity'
|
|||
ASSHOLES_FILE = '/var/roulette/assholes'
|
||||
STATE_FILE = '/var/roulette/state'
|
||||
|
||||
STATE = 'precampagne'
|
||||
STATE = 'down'
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(__name__)
|
||||
|
@ -305,7 +306,11 @@ def banned():
|
|||
def banned_ip():
|
||||
#Actualisation de l'etat de la roulette
|
||||
with open(STATE_FILE, 'r') as f:
|
||||
global STATE
|
||||
STATE = f.read()
|
||||
if DEBUG :
|
||||
print(STATE)
|
||||
|
||||
# Liste des ip pour récupération par babel et plop
|
||||
if not DEBUG:
|
||||
if get_ip() not in ['10.7.0.254']:
|
||||
|
@ -327,9 +332,11 @@ def banned_ip():
|
|||
@playable_required
|
||||
def home():
|
||||
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)
|
||||
elif STATE == "launched":
|
||||
elif "up" in STATE:
|
||||
if DEBUG:
|
||||
print(player, 'arrived')
|
||||
|
||||
|
|
1
state
Normal file
1
state
Normal file
|
@ -0,0 +1 @@
|
|||
precampagne
|
|
@ -2,7 +2,6 @@
|
|||
{% block content %}
|
||||
<h2>Pas de précampagne!</h2>
|
||||
<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>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue