def refresh_by_session(): """ Refreshes the running session for a currently logged in user. This prevents a users container from being terminated automatically. """ docker_interface.refresh(session['user_container_name']) return jsonify({'result': 'success'})
def refresh_by_session(): """ Refreshes the running session for a currently logged in user. This prevents a users container from being terminated automatically. """ if current_user.is_authenticated: docker_interface.refresh(current_user.username) return jsonify({'result': 'success'}) return jsonify({'error': 'not authenticated'})
def refresh_by_token(token): """ Refreshes the running session for the user assigned to the given API token. This prevents a users container from being terminated automatically. """ user = user_by_token(token) if user is None: return jsonify({'error': 'wrong api token'}) docker_interface.refresh(user.username) return jsonify({'result': 'success'})