Exemplo n.º 1
0
def get_steam_profile_or_random_response(steam_id):
    try:
        return steam_id_to_profile(steam_id)
    except BaseException as e:
        logger.warning(e)
        traceback.print_exc()
        player = create_default_player()
        print(player)
        return {
            'response': {
                'steamid': player.platformid,
                'personaname': player.platformname,
                'avatarfull': player.avatar,
                'players': [
                    {
                        'steamid': player.platformid,
                        'personaname': player.platformname,
                        'platformname': player.platformname,
                        'profileurl': f"https://steamcommunity.com/id/{player.platformid}/",
                        'avatarfull': player.avatar,
                        'avatar': player.avatar,
                    }
                ]
            }
        }
Exemplo n.º 2
0
 def lookup_current_user(session=None):
     g.user = None
     if 'openid' in flask_session:
         openid = flask_session['openid']
         g.user = session.query(Player).filter(
             Player.platformid == openid).first()
         if g.user is None:
             del flask_session['openid']
             return redirect('/')
         g.admin = ids['admin'] in g.user.groups
         g.alpha = ids['alpha'] in g.user.groups
         g.beta = ids['beta'] in g.user.groups
     elif is_local_dev():
         g.user = create_default_player(session=session)
         g.admin = True
Exemplo n.º 3
0
        def lookup_current_user(session=None):
            g.user = None
            if 'openid' in flask_session:
                openid = flask_session['openid']
                if len(ALLOWED_STEAM_ACCOUNTS
                       ) > 0 and openid not in ALLOWED_STEAM_ACCOUNTS:
                    return render_template('login.html')

                g.user = session.query(Player).filter(
                    Player.platformid == openid).first()
                if g.user is None:
                    del flask_session['openid']
                    return redirect('/')
                g.admin = ids['admin'] in g.user.groups
                g.alpha = ids['alpha'] in g.user.groups
                g.beta = ids['beta'] in g.user.groups
            elif is_local_dev():
                g.user = create_default_player(session=session)
                g.admin = True