Beispiel #1
0
def unban(request):
    data = _get_data(request)
    res = {}
    results = None

    try:
        ctl.do_unban(data["steam_id_64"])  # also remove bans
        audit("unban", request, data)
        if get_config()["MULTI_SERVERS"]["broadcast_unbans"]:
            results = forward_command(
                "/api/do_unban",
                json=data,
                sessionid=request.COOKIES.get("sessionid"))
        if get_config()["BANS"]["unban_does_unblacklist"]:
            try:
                remove_player_from_blacklist(data["steam_id_64"])
            except CommandFailedError:
                logger.warning("Player %s was not on blacklist",
                               data["steam_id_64"])
        failed = False
    except:
        logger.exception("Unable to unban player")
        failed = True

    return JsonResponse({
        "result": res,
        "command": "unban_player",
        "arguments": data,
        "failed": failed,
        "forward_results": results,
    })
Beispiel #2
0
def unblacklist_player(request):
    data = _get_data(request)
    res = {}
    try:
        remove_player_from_blacklist(data["steam_id_64"])
        audit("unblacklist", request, data)
        if get_config()["BANS"]["unblacklist_does_unban"]:
            ctl.do_unban(data["steam_id_64"])  # also remove bans
            if get_config()["MULTI_SERVERS"]["broadcast_unbans"]:
                forward_command(
                    "/api/do_unban",
                    json=data,
                    sessionid=request.COOKIES.get("sessionid"),
                )
        failed = False
    except:
        logger.exception("Unable to unblacklist player")
        failed = True

    return JsonResponse({
        "result": res,
        "command": "unblacklist_player",
        "arguments": data,
        "failed": failed,
    })
Beispiel #3
0
def unblacklist_player(request):
    data = _get_data(request)
    res = {}
    try:
        remove_player_from_blacklist(data["steam_id_64"])
        audit("unblacklist", request, data)
        failed = False
    except:
        logger.exception("Unable to unblacklist player")
        failed = True

    return JsonResponse({
        "result": res,
        "command": "players_history",
        "arguments": data,
        "failed": failed,
    })
Beispiel #4
0
def unblacklist_player(request):
    data = _get_data(request)
    res = {}
    try:
        send_to_discord_audit("Unblacklist '{}' for ''".format(data['steam_id_64']), get_client_ip(request))
        remove_player_from_blacklist(data['steam_id_64'])
        failed = False
    except:
        logger.exception("Unable to unblacklist player")
        failed = True

    return JsonResponse({
        "result": res,
        "command": "players_history",
        "arguments": data,
        "failed": failed
    })