Ejemplo n.º 1
0
 def delete(self):
     '''Sets empty cookie (to simulate logging out)'''
     ret = 'Successfully logged out.'
     cookie_name = jwt.jwt_cookie_name
     return responses.success(ret, 200,
                              {'Set-Cookie': f'{cookie_name}=\'\''
                               ''})
Ejemplo n.º 2
0
 def post(self):
     '''
     Sets a stream as finished.
     on_publish_done callback. Return code does not matter.
     '''
     logger.debug('Posted stop data: %s', str(request.form.to_dict()))
     stream_id = request.form['name']
     stream_manager.end_stream(stream_id)
     return responses.success('Stream ended.')
Ejemplo n.º 3
0
 def post(self):
     post_data = request.get_json()
     stream_id = post_data.get('stream_id')
     name = post_data.get('name')
     start = float(post_data.get('start'))
     end = float(post_data.get('end'))
     ret = clip_manager.create_clip(
         stream_id=stream_id, name=name, start=start, end=end)
     return responses.success(ret, 201)
Ejemplo n.º 4
0
 def post(self):
     post_data = request.get_json()
     email = post_data.get('email')
     password = post_data.get('password')
     user = account_manager.authenticate_user(email, password)
     jwt_token = jwt.encode_jwt(user.login_id)
     cookie_name = jwt.jwt_cookie_name
     ret = {'token': jwt_token}
     return responses.success(ret, 200,
                              {'Set-Cookie': f'{cookie_name}={jwt_token}'})
Ejemplo n.º 5
0
 def get(self):
     user = account_manager.get_user(g.user)
     streams = stream_manager.get_user_streams(g.user)
     clips = clip_manager.get_user_clips(g.user)
     highlights = highlight_manager.get_user_highlights(g.user)
     ret = {
         'highlights': highlights,
         'streams': streams,
         'clips': clips,
         'user': user
     }
     return responses.success(ret, 200)
Ejemplo n.º 6
0
 def post(self):
     post_data = request.get_json()
     email = post_data.get('email')
     password = post_data.get('password')
     first_name = post_data.get('first_name')
     last_name = post_data.get('last_name')
     user = account_manager.create_new_user(email, password, first_name,
                                            last_name)
     jwt_token = jwt.encode_jwt(user.login_id)
     cookie_name = jwt.jwt_cookie_name
     ret = {'token': jwt_token}
     return responses.success(ret, 201,
                              {'Set-Cookie': f'{cookie_name}={jwt_token}'})
Ejemplo n.º 7
0
 def get(self):
     return responses.success({'id': g.user.id})
Ejemplo n.º 8
0
 def post(self):
     '''Login'''
     user = self.account_manager.authenticate_user('*****@*****.**', 'test')
     jwt_token = jwt.encode_jwt(user.login_id)
     return responses.success({'token': jwt_token})
Ejemplo n.º 9
0
 def get(self, id):
     highlight = highlight_manager.get_user_highlight(g.user, id)
     if highlight:
         return responses.success(highlight)
     return responses.client_error('Highlight can not be found.', 404)
Ejemplo n.º 10
0
 def post(self):
     post_data = request.get_json()
     name = post_data.get('name')
     new_highlight = highlight_manager.create_highlight(g.user, name=name)
     return responses.success(new_highlight, 204)
Ejemplo n.º 11
0
 def get(self):
     return responses.success(highlight_manager.get_user_highlights(g.user))
Ejemplo n.º 12
0
 def get(self):
     ret = account_manager.get_user(g.user)
     return responses.success(ret, 200)
Ejemplo n.º 13
0
 def get(self):
     '''Get list of streams'''
     user_streams = stream_manager.get_user_streams(g.user)
     return responses.success(user_streams)
Ejemplo n.º 14
0
 def get(self, id):
     clip_json = clip_manager.get_user_clip(g.user, id)
     if clip_json:
         return responses.success(clip_json, 200)
     return responses.client_error('Clip can not be found.', 404)
Ejemplo n.º 15
0
 def get(self):
     ret = clip_manager.get_user_clips(g.user)
     return responses.success(ret)