|
|
|
@ -320,6 +320,11 @@ def home(): |
|
|
|
player = get_player_from_ip(get_ip()) |
|
|
|
if DEBUG: |
|
|
|
print(player, 'arrived and the site is',STATE) |
|
|
|
with open(IMMUNITY_FILE, 'r') as f: |
|
|
|
immunity = f.read() |
|
|
|
ok = [line.split(' ') for line in immunity.split('\n') if line] |
|
|
|
ok = [get_player_from_full_name(names[0], names[1])['id'] for names in ok] |
|
|
|
player_has_immunity = player['id'] in ok |
|
|
|
|
|
|
|
bans = sorted(get_bans(player['id']), \ |
|
|
|
key=lambda ban: ban['time'], \ |
|
|
|
@ -349,7 +354,7 @@ def home(): |
|
|
|
|
|
|
|
if "down" in STATE: |
|
|
|
return render_template('down.html', user=player, stats=statistiques(), bans_hist=bans_hist) |
|
|
|
elif "up" in STATE: |
|
|
|
elif "up" in STATE or player_has_immunity: |
|
|
|
return render_template('home.html', bans_hist=bans_hist, stats=statistiques()) |
|
|
|
else: |
|
|
|
return render_template('precampagne.html', user=player,stats=statistiques()) |
|
|
|
@ -359,6 +364,11 @@ def home(): |
|
|
|
def play(): |
|
|
|
ip = get_ip() |
|
|
|
player = get_player_from_ip(ip) |
|
|
|
with open(IMMUNITY_FILE, 'r') as f: |
|
|
|
immunity = f.read() |
|
|
|
ok = [line.split(' ') for line in immunity.split('\n') if line] |
|
|
|
ok = [get_player_from_full_name(names[0], names[1])['id'] for names in ok] |
|
|
|
player_has_immunity = player['id'] in ok |
|
|
|
if "down" in STATE: |
|
|
|
bans = sorted(get_bans(player['id']), \ |
|
|
|
key=lambda ban: ban['time'], \ |
|
|
|
@ -387,7 +397,7 @@ def play(): |
|
|
|
bans_hist.append(entry) |
|
|
|
return render_template('down.html', user=player,stats=statistiques()) |
|
|
|
|
|
|
|
elif "up" in STATE: |
|
|
|
elif "up" in STATE or player_has_immunity: |
|
|
|
# Traitement de la requête de bannissement |
|
|
|
if request.method == 'POST': |
|
|
|
target_id = int(request.form['target_id']) |
|
|
|
|