def tower(tower_id, decorator=None): try: towers.garbage_collection(tower_id) tower = towers[tower_id] except KeyError: log('Bad tower_id') abort(404) # Generate a jwt token to pass user_id # This allows us to pass user_id securely through the client html, # which in turn allows backup servers to get the current user without cross-domain cookies user_token = '' if current_user.is_anonymous \ else jwt.encode({'id': current_user.get_id()}, app.config['SECRET_KEY'], algorithm='HS256').decode('utf-8') # Pass in both the tower and the user_name return render_template('ringing_room.html', tower = tower, user_name = '' if current_user.is_anonymous else current_user.username, user_email = '' if current_user.is_anonymous else current_user.email, server_ip=get_server_ip(tower_id), user_token = user_token, host_permissions = current_user.check_permissions(tower_id,'host')\ if current_user.is_authenticated else False, listen_link = False)
def observer(tower_id, decorator=None): try: towers.garbage_collection(tower_id) tower = towers[tower_id] except KeyError: log('Bad tower_id') abort(404) return render_template('ringing_room.html', tower=tower, listen_link=True)
def tower(tower_id, decorator=None): try: towers.garbage_collection(tower_id) tower = towers[tower_id] except KeyError: log('Bad tower_id') abort(404) # Pass in both the tower and the user_name return render_template( 'ringing_room.html', tower=tower, user_name='' if current_user.is_anonymous else current_user.username, listen_link=False)